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

Control.Carrier.Empty.Maybe

Description

A carrier for an Empty effect, indicating failure with a Nothing value. Users that need access to an error message should use the Fail effect.

Note that Empty effects can, when they are the last effect in a stack, be interpreted directly to a Maybe without a call to runEmpty.

Since: 1.0.0.0

Synopsis

Empty carrier

runEmpty :: EmptyC m a -> m (Maybe a) Source #

Run an Empty effect, returning Nothing for empty computations, or Just the result otherwise.

runEmpty empty = pure Nothing
runEmpty (pure a) = Just a

Since: 1.0.0.0

newtype EmptyC m a Source #

Since: 1.0.0.0

Constructors

EmptyC (MaybeT m a) 

Instances

Instances details
MonadTrans EmptyC Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

lift :: Monad m => m a -> EmptyC m a #

Monad m => Monad (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

(>>=) :: EmptyC m a -> (a -> EmptyC m b) -> EmptyC m b #

(>>) :: EmptyC m a -> EmptyC m b -> EmptyC m b #

return :: a -> EmptyC m a #

Functor m => Functor (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

fmap :: (a -> b) -> EmptyC m a -> EmptyC m b #

(<$) :: a -> EmptyC m b -> EmptyC m a #

MonadFix m => MonadFix (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

mfix :: (a -> EmptyC m a) -> EmptyC m a #

MonadFail m => MonadFail (EmptyC m) Source #

EmptyC passes MonadFail operations along to the underlying monad m, rather than interpreting it as a synonym for empty à la MaybeT.

Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

fail :: String -> EmptyC m a #

Monad m => Applicative (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

pure :: a -> EmptyC m a #

(<*>) :: EmptyC m (a -> b) -> EmptyC m a -> EmptyC m b #

liftA2 :: (a -> b -> c) -> EmptyC m a -> EmptyC m b -> EmptyC m c #

(*>) :: EmptyC m a -> EmptyC m b -> EmptyC m b #

(<*) :: EmptyC m a -> EmptyC m b -> EmptyC m a #

MonadIO m => MonadIO (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

liftIO :: IO a -> EmptyC m a #

(Algebra sig m, Effect sig) => Algebra (Empty :+: sig) (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

alg :: (Empty :+: sig) (EmptyC m) a -> EmptyC m a Source #

Empty effect