| Copyright | (C) 2013-2016 Edward Kmett |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Control.Lens.Internal.Exception
Synopsis
- class Handleable e (m :: Type -> Type) (h :: Type -> Type) | h -> e m where
- data HandlingException = HandlingException
Documentation
class Handleable e (m :: Type -> Type) (h :: Type -> Type) | h -> e m where Source #
Both exceptions and Control.Exception provide a Handler type.
This lets us write combinators to build handlers that are agnostic about the choice of which of these they use.
Minimal complete definition
Methods
handler :: Typeable a => Getting (First a) e a -> (a -> m r) -> h r Source #
This builds a Handler for just the targets of a given Prism (or any Getter, really).
catches... [handler_AssertionFailed(s ->$"Assertion Failed\n"++s) ,handler_ErrorCall(s ->$"Error\n"++s) ]
This works ith both the Handler type provided by Control.Exception:
handler::GetterSomeExceptiona -> (a ->IOr) ->Handlerrhandler::FoldSomeExceptiona -> (a ->IOr) ->Handlerrhandler::Prism'SomeExceptiona -> (a ->IOr) ->Handlerrhandler::Lens'SomeExceptiona -> (a ->IOr) ->Handlerrhandler::Traversal'SomeExceptiona -> (a ->IOr) ->Handlerr
and with the Handler type provided by Control.Monad.Catch:
handler::GetterSomeExceptiona -> (a -> m r) ->Handlerm rhandler::FoldSomeExceptiona -> (a -> m r) ->Handlerm rhandler::Prism'SomeExceptiona -> (a -> m r) ->Handlerm rhandler::Lens'SomeExceptiona -> (a -> m r) ->Handlerm rhandler::Traversal'SomeExceptiona -> (a -> m r) ->Handlerm r
and with the Handler type provided by Control.Monad.Error.Lens:
handler::Gettere a -> (a -> m r) ->Handlere m rhandler::Folde a -> (a -> m r) ->Handlere m rhandler::Prism'e a -> (a -> m r) ->Handlere m rhandler::Lens'e a -> (a -> m r) ->Handlere m rhandler::Traversal'e a -> (a -> m r) ->Handlere m r
handler_ :: Typeable a => Getting (First a) e a -> m r -> h r Source #
This builds a Handler for just the targets of a given Prism (or any Getter, really).
that ignores its input and just recovers with the stated monadic action.
catches... [handler__NonTermination(return"looped") ,handler__StackOverflow(return"overflow") ]
This works with the Handler type provided by Control.Exception:
handler_::GetterSomeExceptiona ->IOr ->Handlerrhandler_::FoldSomeExceptiona ->IOr ->Handlerrhandler_::Prism'SomeExceptiona ->IOr ->Handlerrhandler_::Lens'SomeExceptiona ->IOr ->Handlerrhandler_::Traversal'SomeExceptiona ->IOr ->Handlerr
and with the Handler type provided by Control.Monad.Catch:
handler_::GetterSomeExceptiona -> m r ->Handlerm rhandler_::FoldSomeExceptiona -> m r ->Handlerm rhandler_::Prism'SomeExceptiona -> m r ->Handlerm rhandler_::Lens'SomeExceptiona -> m r ->Handlerm rhandler_::Traversal'SomeExceptiona -> m r ->Handlerm r
and with the Handler type provided by Control.Monad.Error.Lens:
handler_::Gettere a -> m r ->Handlere m rhandler_::Folde a -> m r ->Handlere m rhandler_::Prism'e a -> m r ->Handlere m rhandler_::Lens'e a -> m r ->Handlere m rhandler_::Traversal'e a -> m r ->Handlere m r
Instances
| Handleable SomeException IO Handler Source # | |
| Typeable m => Handleable SomeException m (Handler m) Source # | |
| Handleable e m (Handler e m) Source # | |
data HandlingException Source #
Constructors
| HandlingException |
Instances
| Exception HandlingException Source # | |
Defined in Control.Lens.Internal.Exception Methods toException :: HandlingException -> SomeException # | |
| Show HandlingException Source # | |
Defined in Control.Lens.Internal.Exception Methods showsPrec :: Int -> HandlingException -> ShowS # show :: HandlingException -> String # showList :: [HandlingException] -> ShowS # | |
| AsHandlingException HandlingException Source # | |
Defined in Control.Exception.Lens | |