Module
Control.Monad.Nope.Class
- Package
- purescript-jsinc
- Repository
- david-sledge/purescript-jsinc
#MonadNope Source
class MonadNope :: (Type -> Type) -> Constraintclass (MonadNuhUh m) <= MonadNope m where
The MonadNope type class represents those monads which support catching
nopes.
yup x hcalls the nope handlerhif a nope is thrown during the evaluation ofx.
An implementation is provided for MaybeT, and for other monad transformers
defined in this library.
Laws:
- Catch:
yup nope h = h - Pure:
yup (pure a) h = pure a
Members
yup :: forall a. m a -> m a -> m a
Instances
#MonadNuhUh Source
class MonadNuhUh :: (Type -> Type) -> Constraintclass (Monad m) <= MonadNuhUh m where
The MonadNuhUh type class represents those monads which support Nothing via
nope, where nope halts.
An implementation is provided for MaybeT, (TODO) and for other monad transformers
defined in this library.
Laws:
- Left zero:
nope >>= h = nope
Members
nope :: forall a. m a
Instances
(Monad m) => MonadNuhUh (MaybeT m)(MonadNuhUh m) => MonadNuhUh (ExceptT e m)(MonadNuhUh m) => MonadNuhUh (IdentityT m)(MonadNuhUh m) => MonadNuhUh (ReaderT r m)(MonadNuhUh m) => MonadNuhUh (StateT s m)(Monoid w, MonadNuhUh m) => MonadNuhUh (WriterT w m)MonadNuhUh Maybe
#liftMaybe Source
liftMaybe :: forall m a. MonadNuhUh m => Maybe a -> m aLift a Maybe value to a MonadNuhUh monad.
#withResource Source
withResource :: forall m r a. MonadNope m => m r -> (r -> m Unit) -> (r -> m a) -> m aMake sure that a resource is cleaned up in the event of a nope. The release action is called regardless of whether the body action nopes or returns.