15

私は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 (+)

このエラーが発生する理由は十分にわかっていますが、おかしな型シグネチャがそこにあることに気付きました: t ~ t -> t. このタイプはどういう意味ですか?haskell内の型シグネチャでチルダは何を意味しますか? それらはどこで使用されますか?

4

1 に答える 1