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

Safe HaskellNone
LanguageHaskell2010

Control.Effect.Fail

Synopsis

Documentation

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

Constructors

Fail String 
Instances
Effect Fail Source # 
Instance details

Defined in Control.Effect.Fail.Internal

Methods

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

HFunctor Fail Source # 
Instance details

Defined in Control.Effect.Fail.Internal

Methods

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

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

Functor (Fail m) Source # 
Instance details

Defined in Control.Effect.Fail.Internal

Methods

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

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

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

Defined in Control.Effect.Fail

Methods

ret :: a -> FailC m a Source #

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

class Monad m => MonadFail (m :: * -> *) 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

Minimal complete definition

fail

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 #

(Member Fail sig, Carrier sig carrier) => MonadFail (Eff carrier) # 
Instance details

Defined in Control.Effect.Internal

Methods

fail :: String -> Eff carrier a #

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

Defined in Control.Monad.Trans.Error

Methods

fail :: String -> ErrorT e m a #

runFail :: (Carrier sig m, Effect sig) => Eff (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
(Carrier sig m, Effect sig) => Carrier (Fail :+: sig) (FailC m) Source # 
Instance details

Defined in Control.Effect.Fail

Methods

ret :: a -> FailC m a Source #

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