所以,它已經幾個月,我有點生疏,但我似乎記得Either b
是一個Monad
爲什麼不能GHCI找到無論是單子實例b
Prelude Control.Monad Data.Either> return "Hello" :: Either String String
<interactive>:0:1:
No instance for (Monad (Either String))
arising from a use of `return'
Possible fix:
add an instance declaration for (Monad (Either String))
In the expression: return "Hello" :: Either String String
In an equation for `it':
it = return "Hello" :: Either String String
Prelude> Right "Hi" == return "Hi"
<interactive>:0:15:
No instance for (Monad (Either a0))
arising from a use of `return'
Possible fix: add an instance declaration for (Monad (Either a0))
In the second argument of `(==)', namely `return "Hi"'
In the expression: Right "Hi" == return "Hi"
In an equation for `it': it = Right "Hi" == return "Hi"
所以我可能做錯了什麼,但我不確定是什麼。我正在使用GHC 7.2.2。
這也解決了我的問題。謝謝 :) –