comonad-transformers-0.2.1: Haskell 98 comonad transformers

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>

Control.Comonad.Trans.Stream

Contents

Description

The f-branching stream comonad, aka the cofree comonad for a Functor f.

Provided here as a comonad-transformer version of the 'ListT done right' monad transformer.

Synopsis

The Stream comonad

stream :: a -> f (Stream f a) -> Stream f aSource

runStream :: Stream f a -> (a, f (Stream f a))Source

The Stream comonad transformer

data StreamT f w a Source

Constructors

StreamT 

Fields

runStreamT :: w (a, f (StreamT f w a))
 

Operations

tails :: Comonad w => StreamT f w a -> f (StreamT f w a)Source

unfolds :: Functor f => (a -> (b, f a)) -> a -> Stream f bSource

unfoldsW :: (Comonad w, Functor f) => (w a -> (b, f a)) -> w a -> StreamT f w bSource