| Portability | Control.Monad.Error |
|---|---|
| Stability | provisional |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Safe Haskell | Trustworthy |
Control.Monad.Error.Lens
Description
- catching :: MonadError e m => Getting (First a) e t a b -> m r -> (a -> m r) -> m r
- catching_ :: MonadError e m => Getting (First a) e t a b -> m r -> m r -> m r
- handling :: MonadError e m => Getting (First a) e t a b -> (a -> m r) -> m r -> m r
- handling_ :: MonadError e m => Getting (First a) e t a b -> m r -> m r -> m r
- trying :: MonadError e m => Getting (First a) e t a b -> m r -> m (Either a r)
- throwing :: MonadError e m => AReview e e t t -> t -> m x
Catching
catching :: MonadError e m => Getting (First a) e t a b -> m r -> (a -> m r) -> m rSource
Catch exceptions that match a given Prism (or any Getter, really).
catching::MonadErrore m =>Prism'e a -> m r -> (a -> m r) -> m rcatching::MonadErrore m =>Lens'e a -> m r -> (a -> m r) -> m rcatching::MonadErrore m =>Traversal'e a -> m r -> (a -> m r) -> m rcatching::MonadErrore m =>Iso'e a -> m r -> (a -> m r) -> m rcatching::MonadErrore m =>Gettere a -> m r -> (a -> m r) -> m rcatching::MonadErrore m =>Folde a -> m r -> (a -> m r) -> m r
catching_ :: MonadError e m => Getting (First a) e t a b -> m r -> m r -> m rSource
Catch exceptions that match a given Prism (or any Getter), discarding
the information about the match. This is particuarly useful when you have
a where the result of the Prism' e ()Prism or Fold isn't
particularly valuable, just the fact that it matches.
catching_::MonadErrore m =>Prism'e a -> m r -> m r -> m rcatching_::MonadErrore m =>Lens'e a -> m r -> m r -> m rcatching_::MonadErrore m =>Traversal'e a -> m r -> m r -> m rcatching_::MonadErrore m =>Iso'e a -> m r -> m r -> m rcatching_::MonadErrore m =>Gettere a -> m r -> m r -> m rcatching_::MonadErrore m =>Folde a -> m r -> m r -> m r
Handling
handling :: MonadError e m => Getting (First a) e t a b -> (a -> m r) -> m r -> m rSource
A version of catching with the arguments swapped around; useful in
situations where the code for the handler is shorter.
handling::MonadErrore m =>Prism'e a -> (a -> m r) -> m r -> m rhandling::MonadErrore m =>Lens'e a -> (a -> m r) -> m r -> m rhandling::MonadErrore m =>Traversal'e a -> (a -> m r) -> m r -> m rhandling::MonadErrore m =>Iso'e a -> (a -> m r) -> m r -> m rhandling::MonadErrore m =>Folde a -> (a -> m r) -> m r -> m rhandling::MonadErrore m =>Gettere a -> (a -> m r) -> m r -> m r
handling_ :: MonadError e m => Getting (First a) e t a b -> m r -> m r -> m rSource
A version of catching_ with the arguments swapped around; useful in
situations where the code for the handler is shorter.
handling_::MonadErrore m =>Prism'e a -> m r -> m r -> m rhandling_::MonadErrore m =>Lens'e a -> m r -> m r -> m rhandling_::MonadErrore m =>Traversal'e a -> m r -> m r -> m rhandling_::MonadErrore m =>Iso'e a -> m r -> m r -> m rhandling_::MonadErrore m =>Gettere a -> m r -> m r -> m rhandling_::MonadErrore m =>Folde a -> m r -> m r -> m r
Trying
trying :: MonadError e m => Getting (First a) e t a b -> m r -> m (Either a r)Source
trying takes a Prism (or any Getter) to select which exceptions are caught
If the Exception does not match the predicate, it is re-thrown.
trying::MonadErrore m =>Prism'e a -> m r -> m (Eithera r)trying::MonadErrore m =>Lens'e a -> m r -> m (Eithera r)trying::MonadErrore m =>Traversal'e a -> m r -> m (Eithera r)trying::MonadErrore m =>Iso'e a -> m r -> m (Eithera r)trying::MonadErrore m =>Gettere a -> m r -> m (Eithera r)trying::MonadErrore m =>Folde a -> m r -> m (Eithera r)
Throwing
throwing :: MonadError e m => AReview e e t t -> t -> m xSource
Throw an Exception described by a Prism.
throwingl ≡reviewslthrowError
throwing::MonadErrore m =>Prism'e t -> t -> athrowing::MonadErrore m =>Iso'e t -> t -> a