[Haskell-beginners] Left vs Right

Kostiantyn Rybnikov k-bx at k-bx.com
Wed Apr 15 17:13:54 UTC 2015


You can still omit monads and keep pair of values in tuple and work with
them easily, but I understand the point you are making.

But I should note that migration from PHP to Python also takes first
impression of complication of many things, where instead of having "just
index.php" with everything inlined you would have some wsgi protocols, wsgi
servers etc, but later you understand that this was "the right thing". Same
with Haskell, it does pay off a lot in future :)
15 квіт. 2015 19:27 "emacstheviking" <objitsu at gmail.com> пише:

> I just love the way Haskell can blow something really simple into
> something truly mind blowingly obtuse looking at times!
> It's no wonder Haskell won't be "mainstream" for a while yet, but that's
> fine, it means the rest of us can charge better rates for now.
> :)
>
>
> On 15 April 2015 at 13:50, Kostiantyn Rybnikov <k-bx at k-bx.com> wrote:
>
>> Adding to others,
>>
>> For fmapping left value I suggest using fmapLeft from errors package, for
>> fmapping both you can use
>>
>> either (Left . replicate 3) (Right . replicate 3)
>> 14 квіт. 2015 19:48 "Shishir Srivastava" <shishir.srivastava at gmail.com>
>> пише:
>>
>>> 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
>>>
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>>
>>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>>
>>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20150415/5fdac0aa/attachment-0001.html>


More information about the Beginners mailing list