Proposal: Add isLeft/isRight to Data.Either

Simon Hengel sol at
Fri Nov 30 21:38:59 CET 2012

I propose to add isLeft/isRight to Data.Either, with the obvious

    isLeft :: Either a b -> Bool
    isLeft (Left  _) = True
    isLeft (Right _) = False

    isRight :: Either a b -> Bool
    isRight (Left  _) = False
    isRight (Right _) = True

There has been a discussion on that before [1].  While I agree that
fromLeft/fromRight are moot, I don't see issues with isLeft/isRight.

Personally I care mostly about isLeft, but for orthogonality I propose
to add both isLeft and isRight.

Here is a (possibly incomplete) list of packages that come with their
own definition of isLeft:

    snap-core, multifocal, PriorityChansConverger, tamarin-prover-utils,
    Agda, PCLT, cmdtheline, scyther-proof, xmlhtml, hspec-expectations,
    Glob, language-glsl, Craft3e, hledger-lib, narc, nemesis,
    type-settheory, PCLT-DB, RJson, bio, errors, rss2irc, heist

Discussion period: 2 Weeks



More information about the Libraries mailing list