fused-effects-0.5.0.0: A fast, flexible, fused effect system.

Safe HaskellNone
LanguageHaskell2010

Control.Effect.Fail

Contents

Synopsis

Fail effect

newtype Fail (m :: * -> *) k Source #

Constructors

Fail String 
Instances
Effect Fail Source # 
Instance details

Defined in Control.Effect.Fail

Methods

handle :: (Functor f, Monad m) => f () -> (forall x. f (m x) -> n (f x)) -> Fail m a -> Fail n (f a) Source #

HFunctor Fail Source # 
Instance details

Defined in Control.Effect.Fail

Methods

fmap' :: Functor (Fail f) => (a -> b) -> Fail f a -> Fail f b Source #

hmap :: Functor m => (forall x. m x -> n x) -> Fail m a -> Fail n a Source #

Functor (Fail m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

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

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

Generic1 (Fail m :: Type -> Type) Source # 
Instance details

Defined in Control.Effect.Fail

Associated Types

type Rep1 (Fail m) :: k -> Type #

Methods

from1 :: Fail m a -> Rep1 (Fail m) a #

to1 :: Rep1 (Fail m) a -> Fail m a #

(Carrier sig m, Effect sig) => Carrier (Fail :+: sig) (FailC m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

eff :: (Fail :+: sig) (FailC m) a -> FailC m a Source #

type Rep1 (Fail m :: Type -> Type) Source # 
Instance details

Defined in Control.Effect.Fail

type Rep1 (Fail m :: Type -> Type) = D1 (MetaData "Fail" "Control.Effect.Fail" "fused-effects-0.5.0.0-inplace" True) (C1 (MetaCons "Fail" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))

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.

run (runFail (pure a)) === Right a

newtype FailC m a Source #

Constructors

FailC 

Fields

Instances
MonadTrans FailC Source # 
Instance details

Defined in Control.Effect.Fail

Methods

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

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

Defined in Control.Effect.Fail

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 #

fail :: String -> FailC m a #

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

Defined in Control.Effect.Fail

Methods

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

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

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

Defined in Control.Effect.Fail

Methods

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

(Carrier sig m, Effect sig) => MonadFail (FailC m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

fail :: String -> FailC m a #

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

Defined in Control.Effect.Fail

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 #

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

Defined in Control.Effect.Fail

Methods

liftIO :: IO a -> FailC m a #

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

Defined in Control.Effect.Fail

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] #

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

Defined in Control.Effect.Fail

Methods

mzero :: FailC m a #

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

(Carrier sig m, Effect sig) => Carrier (Fail :+: sig) (FailC m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

eff :: (Fail :+: sig) (FailC m) a -> FailC m a Source #

Re-exports

class (HFunctor sig, Monad m) => Carrier sig m | m -> sig Source #

The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the eff method.

Minimal complete definition

eff

Instances
Carrier Pure PureC Source # 
Instance details

Defined in Control.Effect.Carrier

Methods

eff :: Pure PureC a -> PureC a Source #

(HFunctor eff, Carrier sig m, Member eff sig) => Carrier sig (InterposeC eff m) Source # 
Instance details

Defined in Control.Effect.Interpose

Methods

eff :: sig (InterposeC eff m) a -> InterposeC eff m a Source #

Monad m => Carrier (Lift m) (LiftC m) Source # 
Instance details

Defined in Control.Effect.Lift

Methods

eff :: Lift m (LiftC m) a -> LiftC m a Source #

(Carrier sig m, MonadIO m) => Carrier (Resource :+: sig) (ResourceC m) Source # 
Instance details

Defined in Control.Effect.Resource

Methods

eff :: (Resource :+: sig) (ResourceC m) a -> ResourceC m a Source #

(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (NonDetC m) Source # 
Instance details

Defined in Control.Effect.NonDet

Methods

eff :: (NonDet :+: sig) (NonDetC m) a -> NonDetC m a Source #

(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (OnceC m) Source # 
Instance details

Defined in Control.Effect.Cull

Methods

eff :: (NonDet :+: sig) (OnceC m) a -> OnceC m a Source #

(Carrier sig m, Effect sig) => Carrier (Fresh :+: sig) (FreshC m) Source # 
Instance details

Defined in Control.Effect.Fresh

Methods

eff :: (Fresh :+: sig) (FreshC m) a -> FreshC m a Source #

(Carrier sig m, Effect sig) => Carrier (Fail :+: sig) (FailC m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

eff :: (Fail :+: sig) (FailC m) a -> FailC m a Source #

(Carrier sig m, Effect sig) => Carrier (Cut :+: (NonDet :+: sig)) (CutC m) Source # 
Instance details

Defined in Control.Effect.Cut

Methods

eff :: (Cut :+: (NonDet :+: sig)) (CutC m) a -> CutC m a Source #

(Carrier sig m, Effect sig) => Carrier (Cull :+: (NonDet :+: sig)) (CullC m) Source # 
Instance details

Defined in Control.Effect.Cull

Methods

eff :: (Cull :+: (NonDet :+: sig)) (CullC m) a -> CullC m a Source #

(Carrier sig m, Effect sig) => Carrier (Trace :+: sig) (TraceByReturningC m) Source # 
Instance details

Defined in Control.Effect.Trace

Methods

eff :: (Trace :+: sig) (TraceByReturningC m) a -> TraceByReturningC m a Source #

Carrier sig m => Carrier (Trace :+: sig) (TraceByIgnoringC m) Source # 
Instance details

Defined in Control.Effect.Trace

Methods

eff :: (Trace :+: sig) (TraceByIgnoringC m) a -> TraceByIgnoringC m a Source #

(MonadIO m, Carrier sig m) => Carrier (Trace :+: sig) (TraceByPrintingC m) Source # 
Instance details

Defined in Control.Effect.Trace

Methods

eff :: (Trace :+: sig) (TraceByPrintingC m) a -> TraceByPrintingC m a Source #

(HFunctor eff, Carrier sig m) => Carrier (eff :+: sig) (InterpretC eff m) Source # 
Instance details

Defined in Control.Effect.Interpret

Methods

eff :: (eff :+: sig) (InterpretC eff m) a -> InterpretC eff m a Source #

(Carrier sig m, Effect sig) => Carrier (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Effect.State.Strict

Methods

eff :: (State s :+: sig) (StateC s m) a -> StateC s m a Source #

(Carrier sig m, Effect sig) => Carrier (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Effect.State.Lazy

Methods

eff :: (State s :+: sig) (StateC s m) a -> StateC s m a Source #

Carrier sig m => Carrier (Reader r :+: sig) (ReaderC r m) Source # 
Instance details

Defined in Control.Effect.Reader

Methods

eff :: (Reader r :+: sig) (ReaderC r m) a -> ReaderC r m a Source #

(Carrier sig m, Effect sig, RandomGen g) => Carrier (Random :+: sig) (RandomC g m) Source # 
Instance details

Defined in Control.Effect.Random

Methods

eff :: (Random :+: sig) (RandomC g m) a -> RandomC g m a Source #

(Carrier sig m, Effect sig) => Carrier (Error e :+: sig) (ErrorC e m) Source # 
Instance details

Defined in Control.Effect.Error

Methods

eff :: (Error e :+: sig) (ErrorC e m) a -> ErrorC e m a Source #

Carrier sig m => Carrier (Resumable err :+: sig) (ResumableWithC err m) Source # 
Instance details

Defined in Control.Effect.Resumable

Methods

eff :: (Resumable err :+: sig) (ResumableWithC err m) a -> ResumableWithC err m a Source #

(Carrier sig m, Effect sig) => Carrier (Resumable err :+: sig) (ResumableC err m) Source # 
Instance details

Defined in Control.Effect.Resumable

Methods

eff :: (Resumable err :+: sig) (ResumableC err m) a -> ResumableC err m a Source #

(Monoid w, Carrier sig m, Effect sig) => Carrier (Writer w :+: sig) (WriterC w m) Source # 
Instance details

Defined in Control.Effect.Writer

Methods

eff :: (Writer w :+: sig) (WriterC w m) a -> WriterC w m a Source #

(HFunctor eff, Carrier sig m, Effect sig) => Carrier (eff :+: sig) (InterpretStateC eff s m) Source # 
Instance details

Defined in Control.Effect.Interpret

Methods

eff :: (eff :+: sig) (InterpretStateC eff s m) a -> InterpretStateC eff s m a Source #

class Member (sub :: (* -> *) -> * -> *) sup Source #

Minimal complete definition

inj, prj

Instances
Member sub sub Source # 
Instance details

Defined in Control.Effect.Sum

Methods

inj :: sub m a -> sub m a Source #

prj :: sub m a -> Maybe (sub m a) Source #

Member sub sup => Member sub (sub' :+: sup) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

inj :: sub m a -> (sub' :+: sup) m a Source #

prj :: (sub' :+: sup) m a -> Maybe (sub m a) Source #

Member sub (sub :+: sup) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

inj :: sub m a -> (sub :+: sup) m a Source #

prj :: (sub :+: sup) m a -> Maybe (sub m a) Source #

class Monad m => MonadFail (m :: Type -> Type) where #

When a value is bound in do-notation, the pattern on the left hand side of <- might not match. In this case, this class provides a function to recover.

A Monad without a MonadFail instance may only be used in conjunction with pattern that always match, such as newtypes, tuples, data types with only a single data constructor, and irrefutable patterns (~pat).

Instances of MonadFail should satisfy the following law: fail s should be a left zero for >>=,

fail s >>= f  =  fail s

If your Monad is also MonadPlus, a popular definition is

fail _ = mzero

Since: base-4.9.0.0

Methods

fail :: String -> m a #

Instances
MonadFail []

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Fail

Methods

fail :: String -> [a] #

MonadFail Maybe

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Fail

Methods

fail :: String -> Maybe a #

MonadFail IO

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.Fail

Methods

fail :: String -> IO a #

MonadFail ReadP

Since: base-4.9.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

fail :: String -> ReadP a #

MonadFail P

Since: base-4.9.0.0

Instance details

Defined in Text.ParserCombinators.ReadP

Methods

fail :: String -> P a #

MonadFail (ST s)

Since: base-4.11.0.0

Instance details

Defined in GHC.ST

Methods

fail :: String -> ST s a #

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

Defined in Control.Effect.Resource

Methods

fail :: String -> ResourceC m a #

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

Defined in Control.Effect.NonDet

Methods

fail :: String -> NonDetC m a #

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

Defined in Control.Effect.Lift

Methods

fail :: String -> LiftC m a #

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

Defined in Control.Effect.Fresh

Methods

fail :: String -> FreshC m a #

(Carrier sig m, Effect sig) => MonadFail (FailC m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

fail :: String -> FailC m a #

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

Defined in Control.Effect.Cut

Methods

fail :: String -> CutC m a #

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

Defined in Control.Effect.Cull

Methods

fail :: String -> OnceC m a #

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

Defined in Control.Effect.Cull

Methods

fail :: String -> CullC m a #

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

Defined in Control.Effect.Trace

Methods

fail :: String -> TraceByReturningC m a #

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

Defined in Control.Effect.Trace

Methods

fail :: String -> TraceByIgnoringC m a #

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

Defined in Control.Effect.Trace

Methods

fail :: String -> TraceByPrintingC m a #

MonadFail f => MonadFail (Ap f)

Since: base-4.12.0.0

Instance details

Defined in Data.Monoid

Methods

fail :: String -> Ap f a #

MonadFail m => MonadFail (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

fail :: String -> IdentityT m a #

(Monad m, Error e) => MonadFail (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

fail :: String -> ErrorT e m a #

MonadFail m => MonadFail (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

fail :: String -> ReaderT r m a #

MonadFail m => MonadFail (StateC s m) Source # 
Instance details

Defined in Control.Effect.State.Strict

Methods

fail :: String -> StateC s m a #

MonadFail m => MonadFail (StateC s m) Source # 
Instance details

Defined in Control.Effect.State.Lazy

Methods

fail :: String -> StateC s m a #

MonadFail m => MonadFail (ReaderC r m) Source # 
Instance details

Defined in Control.Effect.Reader

Methods

fail :: String -> ReaderC r m a #

MonadFail m => MonadFail (RandomC g m) Source # 
Instance details

Defined in Control.Effect.Random

Methods

fail :: String -> RandomC g m a #

MonadFail m => MonadFail (InterpretC eff m) Source # 
Instance details

Defined in Control.Effect.Interpret

Methods

fail :: String -> InterpretC eff m a #

MonadFail m => MonadFail (InterposeC eff m) Source # 
Instance details

Defined in Control.Effect.Interpose

Methods

fail :: String -> InterposeC eff m a #

MonadFail m => MonadFail (ErrorC e m) Source # 
Instance details

Defined in Control.Effect.Error

Methods

fail :: String -> ErrorC e m a #

MonadFail m => MonadFail (ResumableWithC err m) Source # 
Instance details

Defined in Control.Effect.Resumable

Methods

fail :: String -> ResumableWithC err m a #

MonadFail m => MonadFail (ResumableC err m) Source # 
Instance details

Defined in Control.Effect.Resumable

Methods

fail :: String -> ResumableC err m a #

MonadFail m => MonadFail (WriterC w m) Source # 
Instance details

Defined in Control.Effect.Writer

Methods

fail :: String -> WriterC w m a #

MonadFail m => MonadFail (InterpretStateC eff s m) Source # 
Instance details

Defined in Control.Effect.Interpret

Methods

fail :: String -> InterpretStateC eff s m a #

run :: PureC a -> a Source #

Run an action exhausted of effects to produce its final result value.