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