Created
January 14, 2013 03:18
-
-
Save honda0510/4527544 to your computer and use it in GitHub Desktop.
reverse' はコンパイルエラーにならないのに reverse'' はコンパイルエラーになるのはなぜだろう
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| reverse' :: [a] -> [a] | |
| reverse' = foldl (flip (:)) [] | |
| reverse'' :: [a] -> [a] | |
| reverse'' = foldl (:) [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
今の僕の解釈
foldlとしては
(a -> b -> a) -> a
こういう型で渡さなければいけないのに、
(a -> [a] -> [a]) -> [a]
こういう型で渡そうとしていたってことですね。
aと[a]の型不一致が2つあるから、エラーメッセージも2つあったんですね。