maybeToEither

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
Converts a Maybe value to an Either value, using the supplied parameter as the Left value if the Maybe is Nothing. This function can be interpreted as:
maybeToEither :: e -> Maybe a -> Either e a
Its definition is given as it is so that it can be used in the Error and related monads.
Transform a Maybe value into an Either value. Just is mapped to Right and Nothing is mapped to Left. Default Left required.
Convert Maybe to Either e, given an error e for the Nothing case.
Convert a Maybe to an Either. If the Maybe is Just, then return the value in Right.
>>> maybeToEither 3 $ Just "hello"
Right "hello"
If the Maybe is Nothing, then use the given e as Left.
>>> maybeToEither 3 Nothing
Left 3
A fliped version of maybeToEither.
>>> maybeToEitherOr (Just "hello") 3
Right "hello"
>>> maybeToEitherOr Nothing 3
Left 3