Copyright | (c) Justin Le 2018 |
---|---|
License | BSD3 |
Maintainer | justin@jle.im |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Assorted utility functions and orphans used for solutions.
Synopsis
- strip :: String -> String
- eitherToMaybe :: Alternative m => Either e a -> m a
- findMaybe :: Foldable t => (a -> Maybe b) -> t a -> Maybe b
- maybeToEither :: MonadError e m => e -> Maybe a -> m a
Documentation
eitherToMaybe :: Alternative m => Either e a -> m a Source #
Convert an Either
into a Maybe
, or any Alternative
instance,
forgetting the error value.
findMaybe :: Foldable t => (a -> Maybe b) -> t a -> Maybe b Source #
Like find
, but instead of taking an a -> Bool
, takes an a ->
Maybe b
and returns the first success.
maybeToEither :: MonadError e m => e -> Maybe a -> m a Source #
Convert a Maybe
into an Either
, or any MonadError
instance, by
providing an error value in case Nothing
was given.