Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Convenience function for turning (Maybe a) values into (MonadError e a) actions plus a function for expressing Data.Map lookups as MonadError actions
- maybeThrow :: MonadError e m => e -> Maybe a -> m a
- lookupEWith :: (MonadError e m, Ord k) => (k -> e) -> k -> Map k a -> m a
- lookupE :: (Ord k, Show k, MonadError String m) => k -> Map k a -> m a
Documentation
maybeThrow :: MonadError e m => e -> Maybe a -> m a Source
Turn an error value and a (Maybe a) into a (MonadError e a) action
lookupEWith :: (MonadError e m, Ord k) => (k -> e) -> k -> Map k a -> m a Source
Look up a String key in a Map as an action in (MonadError e), providing a function to transform key type k to error type e.
See lookupE below for a usage example.