:: a -> Maybe b -> Either a b -package:from-sum

Given a Maybe, convert it to an Either, providing a suitable value for the Left should the value be Nothing.
\a b -> maybeToEither a (Just b) == Right b
\a -> maybeToEither a Nothing == Left a
Tag the Nothing value of a Maybe
Convert a Maybe to an Either.
Maybe produce a Right, otherwise produce a Left.
>>> maybeToRight "default" (Just 12)
Right 12
>>> maybeToRight "default" Nothing
Left "default"
Transform a Maybe value into an Either value. Just is mapped to Right and Nothing is mapped to Left. Default Left required.
A fromJust that fails in the Either monad
Convert Maybe to Either e, given an error e for the Nothing case.
Maps Maybe to Either wrapping default value into Left.
>>> maybeToRight True (Just "aba")
Right "aba"

>>> maybeToRight True Nothing
Left True
Turn Just into Right and Nothing into Left with the supplied value.
Create a Parse result from a Textual error message and a Maybe value