error-continuations-0.1.0.0: Error Continuations

Copyright(c) Eitan Chatav, 2015
LicensePublicDomain
Maintainereitan.chatav@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Trans.MaybeCont

Description

The MaybeContT type and API provide an idiomatic way to handle possibly failing computations in continuation passing style over some base monad.

Synopsis

Documentation

newtype MaybeContT a m r Source

The MaybeContT a l m r type encodes a nullable monad transformer in continuation passing style which is monadic in r. This property holds for any type constructor m.

Constructors

MaybeContT

Construct a continuation-passing computation from a function.

Fields

runMaybeContT :: m a -> (r -> m a) -> m a

The result of running a CPS computation with given nothing and just continuations.

Instances

MonadTrans (MaybeContT a)

MaybeContT a is a monad transformer.

Monad (MaybeContT a m)

The Monad instance encodes monadicity of MaybeContT a m.

Functor (MaybeContT a m)

The Functor instance encodes functoriality of MaybeContT a m.

Applicative (MaybeContT a m)

The Applicative instance encodes applicativity of MaybeContT a m.

MonadCont (MaybeContT a m)

Call with current just continuation.

nothingC :: MaybeContT a m r Source

nothingC is the CPS representation of Nothing.

mapMaybeContT :: (m a -> m a) -> MaybeContT a m r -> MaybeContT a m r Source

Apply a function to transform the result of a continuation-passing computation.

withMaybeContTJust :: ((r' -> m a) -> r -> m a) -> MaybeContT a m r -> MaybeContT a m r' Source

Apply a function to transform the just continuation passed to a continuation-passing computation.

withMaybeContTNothing :: (m a -> m a) -> MaybeContT a m r -> MaybeContT a m r Source

Apply a function to transform the nothing continuation passed to a continuation-passing computation.