[Haskell-cafe] Why Either = Left | Right instead of something like Result = Success | Failure

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu May 27 18:29:47 EDT 2010


On May 27, 2010, at 10:53 , Vo Minh Thu wrote:
> 2010/5/27 Ionut G. Stan <ionut.g.stan at gmail.com>:
>>
>> I was just wondering if there's any particular reason for which the  
>> two
>> constructors of the Either data type are named Left and Right. I'm  
>> thinking
>> that something like Success | Failure or Right | Wrong would have  
>> been a
>> little better.
>>
>> I've recently seen that Scala uses a similar convention for some  
>> error
>> notifications so I'm starting to believe there's more background  
>> behind it
>> than just an unfortunate naming.
>
> Either *can* be used to represent success and failures, but not
> necessarily. It is a convention, when using Either to model
> success/failure, to use Right for success and Left for failure. Even
> if Left as a word does not match with the meaning of failure, it is
> easy to get it Right :)


Historically it *has* been related to negativity in many cultures.   
(Consider "sinister", cognate of Italian "sinistro/a", and the  
prevalence of and preference for right-handed-ness.)

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20100527/e1f04b1c/PGP.bin


More information about the Haskell-Cafe mailing list