sprinkles-0.6.0.0: JSON API to HTML website wrapper

Safe HaskellSafe
LanguageHaskell2010

Control.MaybeEitherMonad

Description

A collection of utility functions to mediate between Maybe, Either, other Monads, and exceptions.

Synopsis

Documentation

maybeFail :: Monad m => Maybe a -> m a Source #

Return the Just value, or fail on Nothing

eitherFailS :: Monad m => Either String a -> m a Source #

Return the Right value, or fail with the Left error message.

eitherFail :: (Show s, Monad m) => Either s a -> m a Source #

Return the Right value, or fail with the Left error value.

maybeThrow :: Maybe a -> a Source #

Get Just the value, or throw a NothingException

eitherThrowS :: Either String a -> a Source #

Get the Right value, or throw a LeftException

eitherThrow :: Exception err => Either err a -> a Source #

Get the Right value, or throw a LeftException

eitherThrowWith :: Exception err => (x -> err) -> Either x a -> a Source #

optionally :: Monad m => (a -> m ()) -> Maybe a -> m () Source #

optionally f v executes the f action on Just the value of v, or does nothing if v is Nothing.