类型记录似乎能够推断递归函数的类型: * Typescript correctly infers the type is * const referencesSelf: () =>means recursion of the functionconst referencesSelf = () => {};
但是,无法推断具有递归性质的
In an equation for `runcountacc':但是,当删除runcountacc的类型声明时) = runcountacc (n+(if head xs==x then 0 else 1)) xs 代码加载正常,当ghci被询问runcountacc的类型时,我们得到以下结果:runcountacc :: (N