
Actually your comment in parenthesis is what made it click. If i do "result
<- return $ runEval ..." it works too. The fact that the first error was
complaining that it expected something of type IO should have tipped me
off.
Thank you,
Matt P.
On Thu, Feb 20, 2014 at 7:10 PM, Brandon Allbery
On Thu, Feb 20, 2014 at 8:05 PM, Mathew Phillips < mathewrphillips@gmail.com> wrote:
Ok now I'm even more confused! That works, but I thought that "let" was for when the value inside the do block was pure, and the <- notation when it's inside another monad?
Are you referring to the fact that Either has a Monad instance? Because you're not *using* it monadically, but purely, so its Monad instance is not relevant. Likewise lists have a Monad instance, but most of the time you don't use it, you treat them as pure values.
(You also can't mix monads; if you're using <- in a do block in IO, it must be working with a value in IO, not merely one in some monad. This is clearer when you learn how do blocks desugar into functions.)
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners