【发布时间】:2013-02-25 20:04:46
【问题描述】:
考虑以下代码:
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) ,那为什么会出错呢?
谢谢
【问题讨论】: