fused-effects-1.1.2.2: A fast, flexible, fused effect system.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Carrier.Fail.Either

Description

A carrier for a Fail effect, returning the result as an Either String. Failed computations will return a Left containing the String value passed to fail.

Since: 1.0.0.0

Synopsis

Fail carrier

runFail :: FailC m a -> m (Either String a) Source #

Run a Fail effect, returning failure messages in Left and successful computations’ results in Right.

runFail (pure a) = pure (Right a)
runFail (fail s) = pure (Left s)

Since: 1.0.0.0

newtype FailC m a Source #

Since: 1.0.0.0

Constructors

FailC (ThrowC String m a) 

Instances

Instances details
MonadTrans FailC Source # 
Instance details

Defined in Control.Carrier.Fail.Either

Methods

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

Algebra sig m => MonadFail (FailC m) Source # 
Instance details

Defined in Control.Carrier.Fail.Either

Methods

fail :: String -> FailC m a #

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

Defined in Control.Carrier.Fail.Either

Methods

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

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

Defined in Control.Carrier.Fail.Either

Methods

liftIO :: IO a -> FailC m a #

(Alternative m, Monad m) => Alternative (FailC m) Source # 
Instance details

Defined in Control.Carrier.Fail.Either

Methods

empty :: FailC m a #

(<|>) :: FailC m a -> FailC m a -> FailC m a #

some :: FailC m a -> FailC m [a] #

many :: FailC m a -> FailC m [a] #

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

Defined in Control.Carrier.Fail.Either

Methods

pure :: a -> FailC m a #

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

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

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

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

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

Defined in Control.Carrier.Fail.Either

Methods

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

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

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

Defined in Control.Carrier.Fail.Either

Methods

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

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

return :: a -> FailC m a #

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

Defined in Control.Carrier.Fail.Either

Methods

mzero :: FailC m a #

mplus :: FailC m a -> FailC m a -> FailC m a #

Algebra sig m => Algebra (Fail :+: sig) (FailC m) Source # 
Instance details

Defined in Control.Carrier.Fail.Either

Methods

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

Fail effect