
27 May
2010
27 May
'10
10:53 a.m.
2010/5/27 Ionut G. Stan
Hi,
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.
Hi, 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 :) Cheers, Thu