enumerate-function-0.0.0: TODO

Safe HaskellNone
LanguageHaskell2010

Enumerate.Function.Extra

Synopsis

Documentation

nothing :: Monad m => m () Source

failed :: MonadThrow m => String -> m a Source

failed = throwM . userError

maybe2throw :: (a -> Maybe b) -> forall m. MonadThrow m => a -> m b Source

generalize a function that fails with Nothing.

list2throw :: (a -> [b]) -> forall m. MonadThrow m => a -> m b Source

generalize a function that fails with [].

either2throw :: (a -> Either SomeException b) -> forall m. MonadThrow m => a -> m b Source

generalize a function that fails with Left.

throw2maybe :: (forall m. MonadThrow m => a -> m b) -> a -> Maybe b Source

specialization

throw2either :: (forall m. MonadThrow m => a -> m b) -> a -> Either SomeException b Source

specialization

throw2list :: (forall m. MonadThrow m => a -> m b) -> a -> [b] Source

specialization

totalizeFunction :: (NFData b, MonadThrow m) => (a -> b) -> a -> m b Source

makes an *unsafely*-partial function (i.e. a function that throws exceptions or that has inexhaustive pattern matching) into a *safely*-partial function (i.e. that explicitly returns in a monad that supports failure).

spoonWith :: (NFData a, MonadThrow m) => [Handler (m a)] -> a -> m a Source

Evaluate a value to normal form and throwM any exceptions are thrown during evaluation. For any error-free value, spoon = Just.

(taken from the spoon package.)

showsPrecWith :: Show b => String -> (a -> b) -> Int -> a -> ShowS Source

the eliminator as a function and the introducer as a string

helper for declaring Show instances of datatypes without visible constructors (like Map which is shown as a list).

module Data.Data

module Data.List