考虑以下代码:
fun g(a) =
let fun h(b)=g(a)
in h end;
当我在 SML 中运行它时,我得到:
- fun g(a) =
= let fun h(b)=g(a)
= in h end;
stdIn:55.5-57.10 Error: right-hand-side of clause doesn't agree with function re
sult type [circularity]
expression: 'Z -> 'Y
result type: 'Y
in declaration:
g = (fn a => let val <binding> in h end)
我无法理解这里的问题:g(a)
return h
,但我在声明中没有看到任何特定的返回值fun g(a)
(即没有什么类似
fun g(a):int
的),那么为什么会出现错误?
谢谢