monad-resumption-0.1.1.4: Resumption and reactive resumption monads for Haskell.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Resumption.Reactive

Description

A reactive resumption monad transformer, based on the formulation in the article Cheap (But Functional) Threads by William L. Harrison and Adam Procter.

Synopsis

Documentation

newtype ReacT input output m a Source

Reactive resumption monad transformer.

Constructors

ReacT 

Fields

deReacT :: m (Either a (output, input -> ReacT input output m a))
 

Instances

MFunctor (ReacT i o) 
MonadTrans (ReacT input output) 
Monad m => Monad (ReacT input output m) 
Monad m => Functor (ReacT input output m) 
Monad m => Applicative (ReacT input output m) 
MonadIO m => MonadIO (ReacT input output m) 

signal :: Monad m => output -> ReacT input output m input Source

Outputs its argument, then waits for the next input and returns it.

(<~>) :: Monad m => ReacT i o m a -> ReacT o i m b -> ResT m (Either a b) Source

Tennis operator.

runReacT :: Monad m => ReacT input output m a -> (output -> m input) -> m a Source

A basic runner function. Provide the ReacT and a handler in the underlying monad to run.