fused-effects-1.1.1.1: A fast, flexible, fused effect system.
Safe HaskellNone
LanguageHaskell2010

Control.Carrier.Error.Church

Description

A church-encoded carrier for Error.

Since: 1.1.0.0

Synopsis

Error carrier

runError :: (e -> m b) -> (a -> m b) -> ErrorC e m a -> m b Source #

Run an Error effect, applying the first continuation to uncaught errors and the second continuation to successful computations’ results.

runError j k (pure a) = k a
runError j k (throwError e) = j e
runError j k (throwError e `catchError` pure) = k e

Since: 1.1.0.0

newtype ErrorC e m a Source #

Since: 1.1.0.0

Constructors

ErrorC 

Fields

  • runErrorC :: forall b. (e -> m b) -> (a -> m b) -> m b
     

Instances

Instances details
MonadTrans (ErrorC e) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

lift :: Monad m => m a -> ErrorC e m a #

Monad (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

(>>=) :: ErrorC e m a -> (a -> ErrorC e m b) -> ErrorC e m b #

(>>) :: ErrorC e m a -> ErrorC e m b -> ErrorC e m b #

return :: a -> ErrorC e m a #

Functor (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

fmap :: (a -> b) -> ErrorC e m a -> ErrorC e m b #

(<$) :: a -> ErrorC e m b -> ErrorC e m a #

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

Defined in Control.Carrier.Error.Church

Methods

mfix :: (a -> ErrorC e m a) -> ErrorC e m a #

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

Defined in Control.Carrier.Error.Church

Methods

fail :: String -> ErrorC e m a #

Applicative (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

pure :: a -> ErrorC e m a #

(<*>) :: ErrorC e m (a -> b) -> ErrorC e m a -> ErrorC e m b #

liftA2 :: (a -> b -> c) -> ErrorC e m a -> ErrorC e m b -> ErrorC e m c #

(*>) :: ErrorC e m a -> ErrorC e m b -> ErrorC e m b #

(<*) :: ErrorC e m a -> ErrorC e m b -> ErrorC e m a #

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

Defined in Control.Carrier.Error.Church

Methods

liftIO :: IO a -> ErrorC e m a #

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

Defined in Control.Carrier.Error.Church

Methods

empty :: ErrorC e m a #

(<|>) :: ErrorC e m a -> ErrorC e m a -> ErrorC e m a #

some :: ErrorC e m a -> ErrorC e m [a] #

many :: ErrorC e m a -> ErrorC e m [a] #

(Alternative m, Monad m) => MonadPlus (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

mzero :: ErrorC e m a #

mplus :: ErrorC e m a -> ErrorC e m a -> ErrorC e m a #

Algebra sig m => Algebra (Error e :+: sig) (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (ErrorC e m) -> (Error e :+: sig) n a -> ctx () -> ErrorC e m (ctx a) Source #

Error effect