Control.Monad.VexceptT
- Package
- purescript-vexceptt
- Repository
- JordanMartinez/purescript-vexceptt
#VexceptT Source
newtype VexceptT errorRows m a
Same as ExceptT
, but uses Veither
rather than Either
.
This type has instances for all the type classes that ExceptT
has
except for the following type classes:
- Alt
- Plus
- Alternative
- MonadPlus
Note: throwing and catching errors will need to throw and catch Variant
s.
Constructors
Instances
Newtype (VexceptT errorRows m a) _
(Functor m) => Functor (VexceptT errorRows m)
(Apply m) => Apply (VexceptT errorRows m)
(Applicative m) => Applicative (VexceptT errorRows m)
(Monad m) => Bind (VexceptT errorRows m)
(Monad m) => Monad (VexceptT errorRows m)
(MonadRec m) => MonadRec (VexceptT e m)
MonadTrans (VexceptT e)
(MonadEffect m) => MonadEffect (VexceptT e m)
(MonadAff m) => MonadAff (VexceptT e m)
(MonadCont m) => MonadCont (VexceptT e m)
(Monad m) => MonadThrow (Variant e) (VexceptT e m)
(Monad m) => MonadError (Variant e) (VexceptT e m)
(MonadAsk r m) => MonadAsk r (VexceptT e m)
(MonadReader r m) => MonadReader r (VexceptT e m)
(MonadState s m) => MonadState s (VexceptT e m)
(MonadTell w m) => MonadTell w (VexceptT e m)
(MonadWriter w m) => MonadWriter w (VexceptT e m)
(Monad m, Semigroup a) => Semigroup (VexceptT e m a)
(Monad m, Monoid a) => Monoid (VexceptT e m a)
#runVexceptT Source
runVexceptT :: forall errorRows m a. VexceptT errorRows m a -> m (Veither errorRows a)
Removes the VexceptT
newtype wrapper.
#mapVexceptT Source
mapVexceptT :: forall e e' m n a b. (m (Veither e a) -> n (Veither e' b)) -> VexceptT e m a -> VexceptT e' n b
Transform the unwrapped computation using the given function.
#vexcept Source
vexcept :: forall e m a. Applicative m => Veither e a -> VexceptT e m a
Construct a computation in the VexceptT
transformer from an Veither
value.
Re-exports from Control.Monad.Error.Class
#MonadError Source
class (MonadThrow e m) <= MonadError e m | m -> e where
The MonadError
type class represents those monads which support catching
errors.
catchError x f
calls the error handlerf
if an error is thrown during the evaluation ofx
.
An implementation is provided for ExceptT
, and for other monad transformers
defined in this library.
Laws:
- Catch:
catchError (throwError e) f = f e
- Pure:
catchError (pure a) f = pure a
Members
catchError :: forall a. m a -> (e -> m a) -> m a
Instances
#MonadThrow Source
class (Monad m) <= MonadThrow e m | m -> e where
The MonadThrow
type class represents those monads which support errors via
throwError
, where throwError e
halts, yielding the error e
.
An implementation is provided for ExceptT
, and for other monad transformers
defined in this library.
Laws:
- Left zero:
throwError e >>= f = throwError e
Members
throwError :: forall a. e -> m a
Instances
Re-exports from Control.Monad.Trans.Class
#MonadTrans Source
class MonadTrans t where
The MonadTrans
type class represents monad transformers.
A monad transformer is a type constructor of kind (* -> *) -> * -> *
, which
takes a Monad
as its first argument, and returns another Monad
.
This allows us to add additional effects to an existing monad. By iterating this process, we create monad transformer stacks, which contain all of the effects required for a particular computation.
The laws state that lift
is a Monad
morphism.
Laws:
lift (pure a) = pure a
lift (do { x <- m ; y }) = do { x <- lift m ; lift y }
Members
- Modules
- Control.
Monad. VexceptT