エラー:
maybet.hs:8:14:
Couldn't match expected type `MaybeT m0 t0'
with actual type `Maybe a0'
In the return type of a call of `M.lookup'
In a stmt of a 'do' expression: m <- M.lookup "a" a
In the second argument of `($)', namely
`do { m <- M.lookup "a" a;
lift $ putStrLn m }'
そしてコード:
import qualified Data.Map as M
import Control.Monad.Trans.Maybe
import Control.Monad.Trans.Class
main = do
let a = M.fromList [("a", "b"), ("c", "d")]
runMaybeT $ do
m <- M.lookup "a" a
lift $ putStrLn m
putStrLn "done"
誰かが MaybeT トランスフォーマーで私を助けてくれるなら、私はそれを感謝します. これを機能させる方法がわかりません。