tagged-exception-core-2.1.0.0: Reflect exceptions using phantom types.

Copyright(c) 2009-2015 Peter Trsko
LicenseBSD3
Stabilityprovisional
PortabilityNoImplicitPrelude; depends on non-portable module
Safe HaskellSafe
LanguageHaskell2010

Control.Monad.TaggedException.Unsafe

Description

Unsafe exception tag cobinators and specific lifting functions. Import this module if creating new MonadException instance(s) that can not be created otherwise.

Preferably import as:

import qualified Control.Monad.TaggedException.Unsafe as Unsafe

Synopsis

Documentation

data Throws e m a Source

Exception tag.

Instances

(Monoid w, MonadReader r m, MonadWriter w m, MonadState s m) => MonadRWS r w s (Throws k * e m) Source

Since 2.1.0.0

MonadError e m => MonadError e (Throws k * e' m) Source

Since 2.1.0.0

MonadReader r m => MonadReader r (Throws k * e m) Source

Since 2.1.0.0

MonadState s m => MonadState s (Throws k * e m) Source

Since 2.1.0.0

(Monoid w, MonadWriter w m) => MonadWriter w (Throws k * e m) Source

Since 2.1.0.0

MFunctor (Throws k * e) Source

Since 1.2.0.0.

MMonad (Throws k * e) Source

Since 1.2.0.0.

MonadTrans (Throws k * e) Source 
Monad m => Monad (Throws k * e m) Source 
Functor f => Functor (Throws k * e f) Source 
Applicative f => Applicative (Throws k * e f) Source 
Alternative f => Alternative (Throws k * e f) Source 
MonadPlus m => MonadPlus (Throws k * e m) Source 
MonadThrow m => MonadThrow (Throws k * e m) Source

Since 2.0.0.0.

MonadCatch m => MonadCatch (Throws k * e m) Source

Since 2.0.0.0.

MonadMask m => MonadMask (Throws k * e m) Source

Since 2.0.0.0.

MonadIO m => MonadIO (Throws k * e m) Source 
MonadCont m => MonadCont (Throws k * e m) Source

Since 2.1.0.0

Generic (Throws k k e m a) Source 
type Rep (Throws k k1 e m a) Source 

throwsOne :: m a -> Throws e m a Source

Construct exception tag, but without MonadThrow restriction.

throwsTwo :: m a -> Throws e' (Throws e m) a Source

Shorthand for throwsOne . throwsOne.

throwsThree :: m a -> Throws e'' (Throws e' (Throws e m)) a Source

Shorthand for throwsOne . throwsOne . throwsOne.

hideOne :: Throws e m a -> m a Source

Hide one exceptions, but without MonadThrow restriction.

hideTwo :: Throws e (Throws e' m) a -> m a Source

Hide two exceptions, but without MonadThrow restriction.

hideThree :: Throws e (Throws e' (Throws e'' m)) a -> m a Source

Hide three exceptions, but without MonadThrow restriction.

liftT1 :: (m a -> m b) -> Throws e m a -> Throws e m b Source

liftT for functions with arity one. Isn't restricted just to MonadThrow instances.

liftT2 :: (m a -> m b -> m c) -> Throws e m a -> Throws e m b -> Throws e m c Source

liftT for functions with arity two. Isn't restricted just to MonadThrow instances.

liftT3 :: (m a -> m b -> m c -> m d) -> Throws e m a -> Throws e m b -> Throws e m c -> Throws e m d Source

liftT for functions with arity three. Isn't restricted just to MonadThrow instances.

insideT :: (m a -> m' b) -> Throws e m a -> Throws e m' b Source

Generalized liftT.

insideTf :: Functor f => (f (m a) -> m' b) -> f (Throws e m a) -> Throws e m' b Source

Variant insideT.

insideTf2 :: (Functor f, Functor f') => (f (f' (m a)) -> m' b) -> f (f' (Throws e m a)) -> Throws e m' b Source

Variant insideT.

insideT2 :: (m1 a -> m2 b -> m3 c) -> Throws e m1 a -> Throws e m2 b -> Throws e m3 c Source

Generalized liftT2.

insideT3 :: (m1 a -> m2 b -> m3 c -> m4 d) -> Throws e m1 a -> Throws e m2 b -> Throws e m3 c -> Throws e m4 d Source

Generalized liftT3.

joinT :: Throws e (Throws e m) a -> Throws e m a Source

Join two exception tags in to one. Isn't restricted just to MonadThrow instances.

joinT3 :: Throws e (Throws e (Throws e m)) a -> Throws e m a Source

Join three exception tags in to one. Isn't restricted just to MonadThrow instances.

flipT :: Throws e' (Throws e m) a -> Throws e (Throws e' m) a Source

Flip two outermost exception tags. Isn't restricted just to MonadThrow instances.

embedT :: (m a -> Throws e n b) -> Throws e m a -> Throws e n b Source

Since 1.2.0.0.

liftMask :: (((forall a. m a -> m a) -> m b) -> m b) -> ((forall a. Throws e m a -> Throws e m a) -> Throws e m b) -> Throws e m b Source

Lift operation similar to the one of mask.

liftBindLike :: (m a -> (b -> m c) -> m d) -> Throws e m a -> (b -> Throws e m c) -> Throws e m d Source

Lift operations with type similar to monadic bind. In example:

(>>=) :: Monad m => m a -> (a -> m b) -> m b
catch
    :: IO a
    -> (IOError -> IO a)
    -> IO a
catch
    :: Exception e
    => IO a -> (e -> IO a) -> IO a

Since 1.2.0.0.

liftFlipBindLike :: ((a -> m b) -> m c -> m d) -> (a -> Throws e m b) -> Throws e m c -> Throws e m d Source

Lift operations with type similar to flipped monadic bind. In example:

(=<<) :: Monad m => (a -> m b) -> m a -> m b
handle
    :: Exception e
    => (e -> IO a) -> IO a -> IO a

Since 1.2.0.0.

liftKleisliLike :: ((a -> m a') -> (b -> m b') -> c -> m c') -> (a -> Throws e m a') -> (b -> Throws e m b') -> c -> Throws e m c' Source

Lift klieisli composition like operations. In example:

(>=>)
    :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
(<=<)
    :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c

Since 1.2.0.0.

liftCCLike :: (((a -> m b) -> m' c) -> m'' d) -> ((a -> Throws e m b) -> Throws e m' c) -> Throws e m'' d Source

Lift operation with type similar to liftCC:

liftCC
    :: Monad m => ((a -> m b) -> m a) -> m a

Since 2.1.0.0

liftHoistLike :: (forall a. m a -> n a) -> Throws e m b -> Throws e' n b Source

Generalized form of embed from instance MFunctor (Throws e).

Since 2.1.0.0

liftEmbedLike :: (forall a. m a -> Throws e n a) -> Throws e' m b -> Throws e n b Source

Generalized form of embed from instance MMonad (Throws e).

Since 2.1.0.0