automaton-1.3: Effectful streams and automata in initial encoding
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Stream.Except

Synopsis

Documentation

data StreamExcept a m e Source #

A stream that can terminate with an exception.

In automaton, such streams mainly serve as a vehicle to bring control flow to AutomatonExcept (which is based on StreamExcept), and the docs there apply here as well.

StreamExcept is not only a Monad, it also has more efficient Selective, Applicative, and Functor interfaces.

Constructors

FinalExcept (Final (ExceptT e m) a)

When using >>=, this encoding will be used.

InitialExcept (OptimizedStreamT (ExceptT e m) a)

This is usually the faster encoding, as it can be optimized by GHC.

Instances

Instances details
MFunctor (StreamExcept a :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Data.Stream.Except

Methods

hoist :: forall m n (b :: k). Monad m => (forall a0. m a0 -> n a0) -> StreamExcept a m b -> StreamExcept a n b #

MonadTrans (StreamExcept a) Source # 
Instance details

Defined in Data.Stream.Except

Methods

lift :: Monad m => m a0 -> StreamExcept a m a0 #

Monad m => Applicative (StreamExcept a m) Source # 
Instance details

Defined in Data.Stream.Except

Methods

pure :: a0 -> StreamExcept a m a0 #

(<*>) :: StreamExcept a m (a0 -> b) -> StreamExcept a m a0 -> StreamExcept a m b #

liftA2 :: (a0 -> b -> c) -> StreamExcept a m a0 -> StreamExcept a m b -> StreamExcept a m c #

(*>) :: StreamExcept a m a0 -> StreamExcept a m b -> StreamExcept a m b #

(<*) :: StreamExcept a m a0 -> StreamExcept a m b -> StreamExcept a m a0 #

Monad m => Functor (StreamExcept a m) Source # 
Instance details

Defined in Data.Stream.Except

Methods

fmap :: (a0 -> b) -> StreamExcept a m a0 -> StreamExcept a m b #

(<$) :: a0 -> StreamExcept a m b -> StreamExcept a m a0 #

Monad m => Monad (StreamExcept a m) Source #

return/pure throw exceptions, (>>=) uses the last thrown exception as input for an exception handler.

Instance details

Defined in Data.Stream.Except

Methods

(>>=) :: StreamExcept a m a0 -> (a0 -> StreamExcept a m b) -> StreamExcept a m b #

(>>) :: StreamExcept a m a0 -> StreamExcept a m b -> StreamExcept a m b #

return :: a0 -> StreamExcept a m a0 #

Monad m => Selective (StreamExcept a m) Source # 
Instance details

Defined in Data.Stream.Except

Methods

select :: StreamExcept a m (Either a0 b) -> StreamExcept a m (a0 -> b) -> StreamExcept a m b #

toFinal :: Functor m => StreamExcept a m e -> Final (ExceptT e m) a Source #