Haskell の型システムについてかなり一般的な質問があります。私はそれに慣れようとしていますが、次の機能があります。
getN :: Num a => a
getN = 5.0 :: Double
これをコンパイルしようとすると、次のエラーが発生します。
Couldn't match expected type `a' against inferred type `Double'
`a' is a rigid type variable bound by
the type signature for `getN' at Perlin.hs:15:12
In the expression: 5.0 :: Double
In the definition of `getN': getN = 5.0 :: Double
私がこれを理解しているように、関数はクラス Num の型を「返す」ように設定されています。Double はこのクラス ( http://www.zvon.org/other/haskell/Outputprelude/Num_c.html ) に含まれているため、この場合は Double を「返して」も問題ないと思っていました。
誰かがこれを説明できますか?