Because you're treating vv as a pure value when you use it, so ghc looks for a way to treat it as a monad and concludes that it is a List. If you want it to be in IO, you need to use <- on its result, not use it directly.On Wed, Jul 23, 2014 at 10:18 AM, 양철웅 <cwyang@aranetworks.com> wrote:
('x':'x':name2) -> return obj { clientReqHdr = ((name2, vv) : prev) }where prev = clientReqHdr objvv = case value of"client_ip_addr" -> clientIp request"now" -> do utcTime <- currentUTCTimereturn $ formatRFC1123 utcTime_ -> value_ -> return objHowever, above code does not compile also :-(*Main> :l test[1 of 1] Compiling Main ( test.hs, interpreted )test.hs:101:64:Couldn't match expected type `[t0]' with actual type `IO UTCTime'In a stmt of a 'do' block: utcTime <- currentUTCTimeIn the expression:do { utcTime <- currentUTCTime;return $ formatRFC1123 utcTime }In a case alternative:"now"-> do { utcTime <- currentUTCTime;return $ formatRFC1123 utcTime }Failed, modules loaded: none.Obviously outer do-block is inside IO monad, as the type of scanQuery isRequest -> IO Object. But GHC puts inner do-block (in "now" case) inside list monad,doesn't it? Why does ghc look for List monad?
--brandon s allbery kf8nh sine nomine associatesunix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners