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

Lutz Donnerhacke lutz at iks-jena.de
Thu May 27 15:33:41 EDT 2010


* Ionut G. Stan wrote:
> 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.

Yes. The basic function on this type is "either".

either a b (Left  x) = Left  (a x)
either a b (Right x) = Right (b x)

So the names of the constuctors are "natural".


More information about the Haskell-Cafe mailing list