Prog Aが正常にコンパイルおよび実行されるのに、Prog Bがコンパイルに失敗するのはなぜですか?ありがとう
Prog A
func :: String -> String
func a = a
mydofn a = do
x <- func a
return x
main = print "Finished"
プログラムB
func :: Int -> Int
func a = a
mydofn a = do
x <- func a
return x
main = print "Finished"
Prog Bコンパイルエラー:
Couldn't match expected type `m0 t0' with actual type `Int'
In the return type of a call of `func'
In a stmt of a 'do' block: x <- func a
In the expression:
do { x <- func a;
return x }