EitherT

Type alias for ExceptT
Not on Stackage, so not searched. EitherT monad transformer
Map over both arguments at the same time. Specialised version of bimap for EitherT.
Tag type for Either to use it as a DSum.
Convert from Either to Errors (inverse of runErrors).
Given an Either, convert it to a Maybe, where Left becomes Nothing.
\x -> eitherToMaybe (Left x) == Nothing
\x -> eitherToMaybe (Right x) == Just x
Generalize Either e as MonadError e m. If the argument has form Left e, an error is produced in the monad via throwError. Otherwise, the Right a part is forwarded.
Takes an either and transforms it into something of the more generic MonadError class.
Convert Either to a DSum. Inverse of dsumToEither.
Transform Either into TomlState.
Transform an Either value into a Maybe value. Right is mapped to Just and Left is mapped to Nothing. The value inside Left is lost.
Encode Either into a generalised sum type.
Transform an Either into a Validation.
>>> eitherToValidation (Right "whoop")
Success "whoop"
>>> eitherToValidation (Left "nahh")
Failure "nahh"
This function can be used to implement tryFrom with a function that returns Either. For example:
-- Avoid this:
tryFrom s = case f s of
Left e -> Left . TryFromException s . Just $ toException e
Right t -> Right t

-- Prefer this:
tryFrom = eitherTryFrom f
Convert an Either to a Maybe. A Right value becomes Just.
>>> eitherToMaybe $ Right 3
Just 3
A Left value becomes Nothing.
>>> eitherToMaybe $ Left "bye"
Nothing
Convert an Either to an Envelope.
Convert Either to Gauge, 0 meaning Right
Converts Left to ParseFailed noLoc, and a Right to ParseOk.