AJF*_*mar 12 haskell types tilde
我一直在搞乱这个fix功能,我碰巧遇到了这个问题:
? let fix f = let x = f x in x
? fix (+)
<interactive>:15:5:
Occurs check: cannot construct the infinite type: t ~ t -> t
Expected type: t -> t
Actual type: t -> t -> t
Relevant bindings include it :: t (bound at <interactive>:15:1)
In the first argument of ‘fix’, namely ‘(+)’
In the expression: fix (+)
Run Code Online (Sandbox Code Playgroud)
我完全知道为什么会出现这个错误,但我注意到那里有一个有趣的签名:t ~ t -> t.这种类型意味着什么?什么代字号在haskell中的类型签名中意味着什么?他们在哪里使用?
| 归档时间: |
|
| 查看次数: |
3824 次 |
| 最近记录: |