in-other-words-0.1.1.0: A higher-order effect system where the sky's the limit
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Exceptional

Synopsis

Effects

data Exceptional eff exc m a Source #

An effect that allows for the safe use of an effect eff that may throw exceptions of the type exc by forcing the user to eventually catch those exceptions at some point of the program.

The main combinator of Exceptional is catching.

This could be unsafe in the presence of Conc. If you use catching on a computation that:

  • Spawns an asynchronous computation
  • Throws an exception inside the asynchronous computation from a use of eff
  • Returns the Async of that asynchronous computation

Then waiting on that Async outside of the catching will throw that exception without it being caught.

type SafeError exc = Exceptional (Throw exc) exc Source #

A particularly useful specialization of Exceptional, for gaining restricted access to an Error exc effect. Main combinators are catchSafe and trySafe.

Actions

catching :: forall eff exc m a. Eff (Exceptional eff exc) m => ExceptionallyC eff exc m a -> (exc -> m a) -> m a Source #

Gain access to eff and Catch exc within a region, but only if you're ready to handle any unhandled exception e :: exc that may arise from the use of eff within that region.

For example:

-- A part of the program unknowing and uncaring that the use of SomeEffect
-- may throw exceptions.
uncaringProgram :: Eff SomeEffect m => m String
uncaringProgram = do
  doSomeThing
  doSomeOtherThing

caringProgram :: Eff (Exceptional SomeEffect SomeEffectExc) m => m String
caringProgram =
  catching @eff uncaringProgram (\(exc :: SomeEffectExc) -> handlerForSomeEffectExc exc)

trying :: forall eff exc m a. Eff (Exceptional eff exc) m => ExceptionallyC eff exc m a -> m (Either exc a) Source #

Gain access to eff within a region. If any use of eff within that region throws an unhandled exception e :: exc, then this returns Left e.

throwing :: forall eff exc m a. Effs [Exceptional eff exc, Throw exc] m => ExceptionallyC eff exc m a -> m a Source #

Gain access to eff within a region, rethrowing any exception e :: exc that may occur from the use of eff within that region.

catchSafe :: forall exc m a. Eff (SafeError exc) m => ExceptionallyC (Throw exc) exc m a -> (exc -> m a) -> m a Source #

Gain access to Error exc within a region, but only if you're ready to handle any unhandled exception e :: exc that may arise from within that region.

trySafe :: forall exc m a. Eff (SafeError exc) m => ExceptionallyC (Throw exc) exc m a -> m (Either exc a) Source #

Gain access to Error exc within a region. If any unhandled exception e :: exc is thrown within that region, then this returns Left e.

Interpretations

runExceptional :: forall eff exc m a. (Member eff (Derivs m), Eff (Catch exc) m) => ExceptionalC eff exc m a -> m a Source #

Run an Exceptional eff exc effect if both eff and Catch exc are part of the effect stack.

In order for this to be safe, you must ensure that the Catch exc catches all exceptions that arise from the use of eff and that only uses of eff throws those exceptions. Otherwise, the use of catching is liable to catch exceptions not arising from uses of eff, or fail to catch exceptions that do arise from uses of eff.

runExceptionalJust :: forall eff smallExc bigExc m a. (Member eff (Derivs m), Eff (Error bigExc) m) => (bigExc -> Maybe smallExc) -> InterpretReifiedC (Exceptional eff smallExc) m a -> m a Source #

Run an Exceptional eff exc effect if eff is part of the effect stack, provided a function that identifies the kind of exceptions that may arise from the use of eff.

In order for this to be safe, you must ensure that the function identifies all exceptions that arise from the use of eff and that only uses of eff throws those exceptions. Otherwise, the use of catching is liable to catch other exceptions not arising from uses of eff, or fail to catch exceptions that do arise from uses of eff.

The type of this interpreter is higher-rank, as it makes use of InterpretReifiedC. This makes runExceptionalJust difficult to use partially applied; for example, you can't compose it using .. You may prefer the simpler, but less performant, runExceptionalJustSimple.

safeErrorToError :: forall exc m a. Eff (Error exc) m => SafeErrorToErrorC exc m a -> m a Source #

Run a SafeError exc effect by transforming it into an Error exc effect.

runSafeError :: forall e m a p. (Carrier m, Threaders '[ErrorThreads] m p) => SafeErrorC e m a -> m a Source #

Run a SafeError e effect purely.

Derivs (SafeErrorC e m) = SafeError e ': Prims m
Prims (SafeErrorC e m) = Optional ((->) e) ': Prims m

safeErrorToIO :: forall e m a. (Eff (Embed IO) m, MonadCatch m) => SafeErrorToIOC e m a -> m a Source #

Runs a SafeError e effect by making use of IO exceptions.

Derivs (SafeErrorToIOC e m) = SafeError e ': Derivs m
Prims (SafeErrorToIOC e m) = Optional ((->) SomeException) ': Prims m

This has a higher-rank type, as it makes use of SafeErrorToIOC. This makes safeErrorToIO very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower safeErrorToIOSimple, which doesn't have a higher-rank type.

safeErrorToErrorIO :: forall e m a. Effs '[Embed IO, ErrorIO] m => SafeErrorToErrorIOC e m a -> m a Source #

Runs a SafeError e effect by transforming it into ErrorIO and Embed IO.

This has a higher-rank type, as it makes use of SafeErrorToErrorIOC. This makes safeErrorToErrorIO very difficult to use partially applied. In particular, it can't be composed using ..

If performance is secondary, consider using the slower safeErrorToErrorIOSimple, which doesn't have a higher-rank type.

Simple variants of interpretations

runExceptionalJustSimple :: forall eff smallExc bigExc m a p. (Member eff (Derivs m), Eff (Error bigExc) m, Threaders '[ReaderThreads] m p) => (bigExc -> Maybe smallExc) -> InterpretSimpleC (Exceptional eff smallExc) m a -> m a Source #

Run an Exceptional eff exc effect if eff is part of the effect stack, provided a function that identifies the kind of exceptions that may arise from the use of eff.

In order for this to be safe, you must ensure that the function identifies all exceptions that arise from the use of eff and that only uses of eff throws those exceptions. Otherwise, the use of catching is liable to catch exceptions not arising from uses of eff, or fail to catch exceptions that do arise from uses of eff.

This is a less performant version of runExceptionalJust, but doesn't have a higher-rank type. This makes runExceptionalJustSimple much easier to use partially applied.

safeErrorToIOSimple :: forall e m a p. (Eff (Embed IO) m, MonadCatch m, Threaders '[ReaderThreads] m p) => SafeErrorToIOSimpleC e m a -> m a Source #

Runs a SafeError e effect by making use of IO exceptions.

Derivs (SafeErrorToIOSimpleC e m) = SafeError e ': Derivs m
Prims (SafeErrorToIOSimpleC e m) = Optional ((->) SomeException) ': Prims m

This is a less performant version of safeErrorToIO that doesn't have a higher-rank type, making it much easier to use partially applied.

safeErrorToErrorIOSimple :: forall e m a p. (Effs '[ErrorIO, Embed IO] m, Threaders '[ReaderThreads] m p) => SafeErrorToErrorIOSimpleC e m a -> m a Source #

Runs a SafeError e effect by transforming it into ErrorIO and Embed IO.

This is a less performant version of safeErrorToErrorIO that doesn't have a higher-rank type, making it much easier to use partially applied.

Threading constraints

class (forall e. Threads (ExceptT e) p) => ErrorThreads p Source #

ErrorThreads accepts the following primitive effects:

Instances

Instances details
(forall e. Threads (ExceptT e) p) => ErrorThreads p Source # 
Instance details

Defined in Control.Effect.Internal.Error

MonadCatch

class MonadThrow m => MonadCatch (m :: Type -> Type) #

A class for monads which allow exceptions to be caught, in particular exceptions which were thrown by throwM.

Instances should obey the following law:

catch (throwM e) f = f e

Note that the ability to catch an exception does not guarantee that we can deal with all possible exit points from a computation. Some monads, such as continuation-based stacks, allow for more than just a success/failure strategy, and therefore catch cannot be used by those monads to properly implement a function such as finally. For more information, see MonadMask.

Minimal complete definition

catch

Instances

Instances details
MonadCatch IO 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => IO a -> (e -> IO a) -> IO a #

MonadCatch STM 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => STM a -> (e -> STM a) -> STM a #

e ~ SomeException => MonadCatch (Either e)

Since: exceptions-0.8.3

Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e0 => Either e a -> (e0 -> Either e a) -> Either e a #

MonadCatch m => MonadCatch (MaybeT m)

Catches exceptions from the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a #

MonadCatch m => MonadCatch (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => ListT m a -> (e -> ListT m a) -> ListT m a #

MonadCatch m => MonadCatch (ListT m) Source # 
Instance details

Defined in Control.Monad.Trans.List.Church

Methods

catch :: Exception e => ListT m a -> (e -> ListT m a) -> ListT m a #

MonadCatch m => MonadCatch (NonDetC m) Source # 
Instance details

Defined in Control.Effect.Internal.NonDet

Methods

catch :: Exception e => NonDetC m a -> (e -> NonDetC m a) -> NonDetC m a #

MonadCatch m => MonadCatch (CullCutC m) Source # 
Instance details

Defined in Control.Effect.Internal.NonDet

Methods

catch :: Exception e => CullCutC m a -> (e -> CullCutC m a) -> CullCutC m a #

MonadCatch m => MonadCatch (LogicC m) Source # 
Instance details

Defined in Control.Effect.Internal.NonDet

Methods

catch :: Exception e => LogicC m a -> (e -> LogicC m a) -> LogicC m a #

MonadCatch m => MonadCatch (InterpretFailSimpleC m) Source # 
Instance details

Defined in Control.Effect.Fail

MonadCatch m => MonadCatch (InterpretAltSimpleC m) Source # 
Instance details

Defined in Control.Effect.Alt

MonadCatch m => MonadCatch (ExceptT e m)

Catches exceptions from the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e0 => ExceptT e m a -> (e0 -> ExceptT e m a) -> ExceptT e m a #

(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a #

MonadCatch m => MonadCatch (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a #

MonadCatch m => MonadCatch (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => ReaderT r m a -> (e -> ReaderT r m a) -> ReaderT r m a #

(Error e, MonadCatch m) => MonadCatch (ErrorT e m)

Catches exceptions from the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e0 => ErrorT e m a -> (e0 -> ErrorT e m a) -> ErrorT e m a #

MonadCatch m => MonadCatch (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => IdentityT m a -> (e -> IdentityT m a) -> IdentityT m a #

MonadCatch m => MonadCatch (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a #

(MonadCatch m, Monoid w) => MonadCatch (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => WriterT w m a -> (e -> WriterT w m a) -> WriterT w m a #

MonadCatch (CompositionBaseT ts m) => MonadCatch (CompositionC ts m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Compose

Methods

catch :: Exception e => CompositionC ts m a -> (e -> CompositionC ts m a) -> CompositionC ts m a #

Eff ErrorIO m => MonadCatch (Effly m) Source # 
Instance details

Defined in Control.Effect.Internal.Effly

Methods

catch :: Exception e => Effly m a -> (e -> Effly m a) -> Effly m a #

MonadCatch m => MonadCatch (InterpretPrimSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretPrimSimpleC e m a -> (e0 -> InterpretPrimSimpleC e m a) -> InterpretPrimSimpleC e m a #

MonadCatch m => MonadCatch (InterpretSimpleC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretSimpleC e m a -> (e0 -> InterpretSimpleC e m a) -> InterpretSimpleC e m a #

MonadCatch m => MonadCatch (EmbedC m) Source # 
Instance details

Defined in Control.Effect.Embed

Methods

catch :: Exception e => EmbedC m a -> (e -> EmbedC m a) -> EmbedC m a #

MonadCatch m => MonadCatch (RunMC m) Source # 
Instance details

Defined in Control.Effect.Embed

Methods

catch :: Exception e => RunMC m a -> (e -> RunMC m a) -> RunMC m a #

(Monoid o, MonadCatch m) => MonadCatch (WriterLazyC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

catch :: Exception e => WriterLazyC o m a -> (e -> WriterLazyC o m a) -> WriterLazyC o m a #

(Monoid o, MonadCatch m) => MonadCatch (ListenLazyC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

catch :: Exception e => ListenLazyC o m a -> (e -> ListenLazyC o m a) -> ListenLazyC o m a #

(Monoid o, MonadCatch m) => MonadCatch (TellLazyC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

catch :: Exception e => TellLazyC o m a -> (e -> TellLazyC o m a) -> TellLazyC o m a #

(Monoid o, MonadCatch m) => MonadCatch (WriterC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

catch :: Exception e => WriterC o m a -> (e -> WriterC o m a) -> WriterC o m a #

(Monoid o, MonadCatch m) => MonadCatch (ListenC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

catch :: Exception e => ListenC o m a -> (e -> ListenC o m a) -> ListenC o m a #

(Monoid o, MonadCatch m) => MonadCatch (TellC o m) Source # 
Instance details

Defined in Control.Effect.Internal.Writer

Methods

catch :: Exception e => TellC o m a -> (e -> TellC o m a) -> TellC o m a #

MonadCatch m => MonadCatch (UnliftC m) Source # 
Instance details

Defined in Control.Effect.Internal.Unlift

Methods

catch :: Exception e => UnliftC m a -> (e -> UnliftC m a) -> UnliftC m a #

MonadCatch m => MonadCatch (StateLazyC s m) Source # 
Instance details

Defined in Control.Effect.Internal.State

Methods

catch :: Exception e => StateLazyC s m a -> (e -> StateLazyC s m a) -> StateLazyC s m a #

MonadCatch m => MonadCatch (StateC s m) Source # 
Instance details

Defined in Control.Effect.Internal.State

Methods

catch :: Exception e => StateC s m a -> (e -> StateC s m a) -> StateC s m a #

MonadCatch m => MonadCatch (HoistC m) Source # 
Instance details

Defined in Control.Effect.Internal.Regional

Methods

catch :: Exception e => HoistC m a -> (e -> HoistC m a) -> HoistC m a #

MonadCatch m => MonadCatch (ReaderC i m) Source # 
Instance details

Defined in Control.Effect.Internal.Reader

Methods

catch :: Exception e => ReaderC i m a -> (e -> ReaderC i m a) -> ReaderC i m a #

MonadCatch m => MonadCatch (HoistOptionC m) Source # 
Instance details

Defined in Control.Effect.Internal.Optional

Methods

catch :: Exception e => HoistOptionC m a -> (e -> HoistOptionC m a) -> HoistOptionC m a #

MonadCatch m => MonadCatch (UnwrapTopC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Newtype

Methods

catch :: Exception e0 => UnwrapTopC e m a -> (e0 -> UnwrapTopC e m a) -> UnwrapTopC e m a #

MonadCatch m => MonadCatch (UnwrapC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Newtype

Methods

catch :: Exception e0 => UnwrapC e m a -> (e0 -> UnwrapC e m a) -> UnwrapC e m a #

MonadCatch m => MonadCatch (ErrorC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Error

Methods

catch :: Exception e0 => ErrorC e m a -> (e0 -> ErrorC e m a) -> ErrorC e m a #

MonadCatch m => MonadCatch (ThrowC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Error

Methods

catch :: Exception e0 => ThrowC e m a -> (e0 -> ThrowC e m a) -> ThrowC e m a #

MonadCatch m => MonadCatch (BaseControlC m) Source # 
Instance details

Defined in Control.Effect.Internal.BaseControl

Methods

catch :: Exception e => BaseControlC m a -> (e -> BaseControlC m a) -> BaseControlC m a #

MonadCatch m => MonadCatch (FreeT f m) Source # 
Instance details

Defined in Control.Monad.Trans.Free.Church.Alternate

Methods

catch :: Exception e => FreeT f m a -> (e -> FreeT f m a) -> FreeT f m a #

MonadCatch m => MonadCatch (ShiftC r m) Source # 
Instance details

Defined in Control.Effect.Internal.Cont

Methods

catch :: Exception e => ShiftC r m a -> (e -> ShiftC r m a) -> ShiftC r m a #

MonadCatch m => MonadCatch (ContC r m) Source # 
Instance details

Defined in Control.Effect.Internal.Cont

Methods

catch :: Exception e => ContC r m a -> (e -> ContC r m a) -> ContC r m a #

MonadCatch m => MonadCatch (SteppedC e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Stepped

Methods

catch :: Exception e0 => SteppedC e m a -> (e0 -> SteppedC e m a) -> SteppedC e m a #

MonadCatch m => MonadCatch (InterceptRC e m) Source # 
Instance details

Defined in Control.Effect.Internal.Intercept

Methods

catch :: Exception e0 => InterceptRC e m a -> (e0 -> InterceptRC e m a) -> InterceptRC e m a #

MonadCatch m => MonadCatch (InterpretFailC h m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

catch :: Exception e => InterpretFailC h m a -> (e -> InterpretFailC h m a) -> InterpretFailC h m a #

MonadCatch m => MonadCatch (InterpretAltC h m) Source # 
Instance details

Defined in Control.Effect.Alt

Methods

catch :: Exception e => InterpretAltC h m a -> (e -> InterpretAltC h m a) -> InterpretAltC h m a #

MonadCatch m => MonadCatch (SubsumeC e m) Source # 
Instance details

Defined in Control.Effect.Internal

Methods

catch :: Exception e0 => SubsumeC e m a -> (e0 -> SubsumeC e m a) -> SubsumeC e m a #

MonadCatch m => MonadCatch (IntroC top new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Intro

Methods

catch :: Exception e => IntroC top new m a -> (e -> IntroC top new m a) -> IntroC top new m a #

MonadCatch m => MonadCatch (ReinterpretSimpleC e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => ReinterpretSimpleC e new m a -> (e0 -> ReinterpretSimpleC e new m a) -> ReinterpretSimpleC e new m a #

MonadCatch m => MonadCatch (InterpretC h e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretC h e m a -> (e0 -> InterpretC h e m a) -> InterpretC h e m a #

MonadCatch m => MonadCatch (InterpretPrimC s e m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => InterpretPrimC s e m a -> (e0 -> InterpretPrimC s e m a) -> InterpretPrimC s e m a #

MonadCatch m => MonadCatch (UnionC l m) Source # 
Instance details

Defined in Control.Effect.Union

Methods

catch :: Exception e => UnionC l m a -> (e -> UnionC l m a) -> UnionC l m a #

MonadCatch m => MonadCatch (WrapC e e' m) Source # 
Instance details

Defined in Control.Effect.Internal.Newtype

Methods

catch :: Exception e0 => WrapC e e' m a -> (e0 -> WrapC e e' m a) -> WrapC e e' m a #

(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #

(MonadCatch m, Monoid w) => MonadCatch (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

catch :: Exception e => RWST r w s m a -> (e -> RWST r w s m a) -> RWST r w s m a #

MonadCatch (t (u m)) => MonadCatch (ComposeT t u m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Compose

Methods

catch :: Exception e => ComposeT t u m a -> (e -> ComposeT t u m a) -> ComposeT t u m a #

Monad m => MonadCatch (ViaAlg s Bracket m) Source # 
Instance details

Defined in Control.Effect.Type.Bracket

Methods

catch :: Exception e => ViaAlg s Bracket m a -> (e -> ViaAlg s Bracket m a) -> ViaAlg s Bracket m a #

Monad m => MonadCatch (ViaAlg s Mask m) Source # 
Instance details

Defined in Control.Effect.Type.Mask

Methods

catch :: Exception e => ViaAlg s Mask m a -> (e -> ViaAlg s Mask m a) -> ViaAlg s Mask m a #

MonadCatch m => MonadCatch (ReinterpretC h e new m) Source # 
Instance details

Defined in Control.Effect.Carrier.Internal.Interpret

Methods

catch :: Exception e0 => ReinterpretC h e new m a -> (e0 -> ReinterpretC h e new m a) -> ReinterpretC h e new m a #

MonadCatch m => MonadCatch (UnionizeC b m) Source # 
Instance details

Defined in Control.Effect.Union

Methods

catch :: Exception e => UnionizeC b m a -> (e -> UnionizeC b m a) -> UnionizeC b m a #

MonadCatch m => MonadCatch (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

catch :: Exception e => ExceptionallyC eff exc m a -> (e -> ExceptionallyC eff exc m a) -> ExceptionallyC eff exc m a #

MonadCatch m => MonadCatch (GainBaseControlC b z m) Source # 
Instance details

Defined in Control.Effect.BaseControl

Methods

catch :: Exception e => GainBaseControlC b z m a -> (e -> GainBaseControlC b z m a) -> GainBaseControlC b z m a #

Carriers

data ExceptionallyC (eff :: Effect) (exc :: *) m a Source #

Instances

Instances details
MonadBase b m => MonadBase b (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

liftBase :: b α -> ExceptionallyC eff exc m α #

MonadBaseControl b m => MonadBaseControl b (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Associated Types

type StM (ExceptionallyC eff exc m) a #

Methods

liftBaseWith :: (RunInBase (ExceptionallyC eff exc m) b -> b a) -> ExceptionallyC eff exc m a #

restoreM :: StM (ExceptionallyC eff exc m) a -> ExceptionallyC eff exc m a #

MonadTrans (ExceptionallyC eff exc :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

lift :: Monad m => m a -> ExceptionallyC eff exc m a #

MonadTransControl (ExceptionallyC eff exc :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Control.Effect.Exceptional

Associated Types

type StT (ExceptionallyC eff exc) a #

Methods

liftWith :: Monad m => (Run (ExceptionallyC eff exc) -> m a) -> ExceptionallyC eff exc m a #

restoreT :: Monad m => m (StT (ExceptionallyC eff exc) a) -> ExceptionallyC eff exc m a #

Monad m => Monad (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

(>>=) :: ExceptionallyC eff exc m a -> (a -> ExceptionallyC eff exc m b) -> ExceptionallyC eff exc m b #

(>>) :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m b -> ExceptionallyC eff exc m b #

return :: a -> ExceptionallyC eff exc m a #

Functor m => Functor (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

fmap :: (a -> b) -> ExceptionallyC eff exc m a -> ExceptionallyC eff exc m b #

(<$) :: a -> ExceptionallyC eff exc m b -> ExceptionallyC eff exc m a #

MonadFix m => MonadFix (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

mfix :: (a -> ExceptionallyC eff exc m a) -> ExceptionallyC eff exc m a #

MonadFail m => MonadFail (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

fail :: String -> ExceptionallyC eff exc m a #

Applicative m => Applicative (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

pure :: a -> ExceptionallyC eff exc m a #

(<*>) :: ExceptionallyC eff exc m (a -> b) -> ExceptionallyC eff exc m a -> ExceptionallyC eff exc m b #

liftA2 :: (a -> b -> c) -> ExceptionallyC eff exc m a -> ExceptionallyC eff exc m b -> ExceptionallyC eff exc m c #

(*>) :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m b -> ExceptionallyC eff exc m b #

(<*) :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m b -> ExceptionallyC eff exc m a #

MonadIO m => MonadIO (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

liftIO :: IO a -> ExceptionallyC eff exc m a #

Alternative m => Alternative (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

empty :: ExceptionallyC eff exc m a #

(<|>) :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a #

some :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m [a] #

many :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m [a] #

MonadPlus m => MonadPlus (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

mzero :: ExceptionallyC eff exc m a #

mplus :: ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a #

MonadThrow m => MonadThrow (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

throwM :: Exception e => e -> ExceptionallyC eff exc m a #

MonadCatch m => MonadCatch (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

catch :: Exception e => ExceptionallyC eff exc m a -> (e -> ExceptionallyC eff exc m a) -> ExceptionallyC eff exc m a #

MonadMask m => MonadMask (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Methods

mask :: ((forall a. ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a) -> ExceptionallyC eff exc m b) -> ExceptionallyC eff exc m b #

uninterruptibleMask :: ((forall a. ExceptionallyC eff exc m a -> ExceptionallyC eff exc m a) -> ExceptionallyC eff exc m b) -> ExceptionallyC eff exc m b #

generalBracket :: ExceptionallyC eff exc m a -> (a -> ExitCase b -> ExceptionallyC eff exc m c) -> (a -> ExceptionallyC eff exc m b) -> ExceptionallyC eff exc m (b, c) #

Eff (Exceptional eff exc) m => Carrier (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

Associated Types

type Derivs (ExceptionallyC eff exc m) :: [Effect] Source #

type Prims (ExceptionallyC eff exc m) :: [Effect] Source #

Methods

algPrims :: Algebra' (Prims (ExceptionallyC eff exc m)) (ExceptionallyC eff exc m) a Source #

reformulate :: Monad z => Reformulation' (Derivs (ExceptionallyC eff exc m)) (Prims (ExceptionallyC eff exc m)) (ExceptionallyC eff exc m) z a Source #

algDerivs :: Algebra' (Derivs (ExceptionallyC eff exc m)) (ExceptionallyC eff exc m) a Source #

type StT (ExceptionallyC eff exc :: (Type -> Type) -> Type -> Type) a Source # 
Instance details

Defined in Control.Effect.Exceptional

type StT (ExceptionallyC eff exc :: (Type -> Type) -> Type -> Type) a = StT (IdentityT :: (Type -> Type) -> Type -> Type) a
type Derivs (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

type Derivs (ExceptionallyC eff exc m) = eff ': (Catch exc ': Derivs m)
type Prims (ExceptionallyC eff exc m) Source # 
Instance details

Defined in Control.Effect.Exceptional

type Prims (ExceptionallyC eff exc m) = Prims m
type StM (ExceptionallyC eff exc m) a Source # 
Instance details

Defined in Control.Effect.Exceptional

type StM (ExceptionallyC eff exc m) a = StM m a

type ExceptionalC eff exc = InterpretC ExceptionalH (Exceptional eff exc) Source #

type SafeErrorToIOC e m a = forall s s'. ReifiesErrorHandler s s' e (ErrorIOToIOC m) => SafeErrorToIOC' s s' e m a Source #

type SafeErrorToErrorIOC e m a = forall s s'. ReifiesErrorHandler s s' e m => SafeErrorToErrorIOC' s s' e m a Source #