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

Data.Stream.Final

Synopsis

Documentation

newtype Final m a Source #

A stream transformer in final encoding.

One step of the stream transformer performs a monadic action and results in an output and a new stream.

Constructors

Final 

Fields

Instances

Instances details
MFunctor Final Source # 
Instance details

Defined in Data.Stream.Final

Methods

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

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

Defined in Data.Stream.Final

Methods

empty :: Final m a #

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

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

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

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

Defined in Data.Stream.Final

Methods

pure :: a -> Final m a #

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

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

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

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

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

Defined in Data.Stream.Final

Methods

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

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

toFinal :: Functor m => StreamT m a -> Final m a Source #

Translate an initially encoded stream into a finally encoded one.

This is usually a performance penalty.

fromFinal :: Final m a -> StreamT m a Source #

Translate a finally encoded stream into an initially encoded one.

The internal state is the stream itself.

constM :: Functor m => m a -> Final m a Source #

Constantly perform the same effect, without remembering a state.