[Haskell-beginners] Left vs Right

Shishir Srivastava shishir.srivastava at gmail.com
Tue Apr 14 16:47:33 UTC 2015


Hi,

Can someone please explain the difference in outputs of the following two
expressions -

--------------

ghci> fmap (replicate 3) (Right "blah")
Right ["blah","blah","blah"]

ghci> fmap (replicate 3) (Left "foo")
Left "foo"

---------------

Why does 'Right' return a list of Strings whereas 'Left' returns just a
String.

Thanks,
Shishir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150414/f0cdb84c/attachment.html>


More information about the Beginners mailing list