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

Control.Carrier.Cut.Church

Description

A carrier for Cut and NonDet effects used in tandem (Cut :+: NonDet).

Since: 1.0.0.0

Synopsis

Cut carrier

runCut :: (a -> m b -> m b) -> m b -> m b -> CutC m a -> m b Source #

Run a Cut effect with continuations respectively interpreting pure / <|>, empty, and cutfail.

runCut cons nil fail (pure a <|> empty) = cons a nil
runCut cons nil fail cutfail = fail
runCut cons nil fail (call cutfail) = nil

Since: 1.0.0.0

runCutA :: (Alternative f, Applicative m) => CutC m a -> m (f a) Source #

Run a Cut effect, returning all its results in an Alternative collection.

Since: 1.0.0.0

runCutM :: (Applicative m, Monoid b) => (a -> b) -> CutC m a -> m b Source #

Run a Cut effect, mapping results into a Monoid.

Since: 1.0.0.0

newtype CutC m a Source #

Since: 1.0.0.0

Constructors

CutC (forall b. (a -> m b -> m b) -> m b -> m b -> m b) 

Instances

Instances details
MonadTrans CutC Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

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

MonadFail m => MonadFail (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

fail :: String -> CutC m a #

MonadFix m => MonadFix (CutC m) Source #

A single fixpoint is shared between all branches.

Instance details

Defined in Control.Carrier.Cut.Church

Methods

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

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

Defined in Control.Carrier.Cut.Church

Methods

liftIO :: IO a -> CutC m a #

Alternative (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

empty :: CutC m a #

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

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

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

Applicative (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

pure :: a -> CutC m a #

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

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

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

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

Functor (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

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

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

Monad (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

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

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

return :: a -> CutC m a #

MonadPlus (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

mzero :: CutC m a #

mplus :: CutC m a -> CutC m a -> CutC m a #

Algebra sig m => Algebra (Cut :+: (NonDet :+: sig)) (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

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

Cut effect

NonDet effects