[Haskell-beginners] Print values stored in an "Either" in the main method

Brandon Allbery allbery.b at gmail.com
Fri Feb 21 01:32:32 UTC 2014


On Thu, Feb 20, 2014 at 8:16 PM, Mathew Phillips
<mathewrphillips at gmail.com>wrote:

> 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.
>

Note also that, while using <- that way "should" have the same effect as
using let, it forces the value to be sequenced with I/O actions, which you
may not want. It may disable optimizations, for one thing, and changes
laziness since it is now constrained by sequencing with I/O when I/O isn't
actually involved with it.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140220/0640a633/attachment.html>


More information about the Beginners mailing list