在GHC中编译此程序时:
import Control.Monad
f x = let
g y = let
h z = liftM not x
in h 0
in g 0
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
test.hs:5:21:
Could not deduce (m ~ m1)
from the context (Monad m)
bound by the inferred type of f :: Monad m => m Bool -> m Bool
at test.hs:(3,1)-(7,8)
or from (m Bool ~ m1 Bool, Monad m1)
bound by the inferred type of
h :: (m Bool ~ m1 Bool, Monad m1) => t1 …Run Code Online (Sandbox Code Playgroud) haskell ×1