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

Data.Stream.Result

Synopsis

Documentation

data Result s a Source #

A tuple that is strict in its first argument.

This type is used in streams and automata to encode the result of a state transition. The new state should always be strict to avoid space leaks.

Constructors

Result 

Fields

Instances

Instances details
Bifunctor Result Source # 
Instance details

Defined in Data.Stream.Result

Methods

bimap :: (a -> b) -> (c -> d) -> Result a c -> Result b d #

first :: (a -> b) -> Result a c -> Result b c #

second :: (b -> c) -> Result a b -> Result a c #

Functor (Result s) Source # 
Instance details

Defined in Data.Stream.Result

Methods

fmap :: (a -> b) -> Result s a -> Result s b #

(<$) :: a -> Result s b -> Result s a #

mapResultState :: (s1 -> s2) -> Result s1 a -> Result s2 a Source #

Apply a function to the state of a Result.

apResult :: Result s1 (a -> b) -> Result s2 a -> Result (JointState s1 s2) b Source #

Analogous to Applicative's (<*>).

newtype ResultStateT s m a Source #

A state transformer with Result instead of a standard tuple as its result.

Constructors

ResultStateT 

Fields

Instances

Instances details
Monad m => Applicative (ResultStateT s m) Source # 
Instance details

Defined in Data.Stream.Result

Methods

pure :: a -> ResultStateT s m a #

(<*>) :: ResultStateT s m (a -> b) -> ResultStateT s m a -> ResultStateT s m b #

liftA2 :: (a -> b -> c) -> ResultStateT s m a -> ResultStateT s m b -> ResultStateT s m c #

(*>) :: ResultStateT s m a -> ResultStateT s m b -> ResultStateT s m b #

(<*) :: ResultStateT s m a -> ResultStateT s m b -> ResultStateT s m a #

Functor m => Functor (ResultStateT s m) Source # 
Instance details

Defined in Data.Stream.Result

Methods

fmap :: (a -> b) -> ResultStateT s m a -> ResultStateT s m b #

(<$) :: a -> ResultStateT s m b -> ResultStateT s m a #