machines-0.6: Networked stream transducers

Copyright(C) 2012 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <>
PortabilityRank-2 Types
Safe HaskellSafe







type Source b = forall k. Machine k b Source

A Source never reads from its inputs.

type SourceT m b = forall k. MachineT m k b Source

A SourceT never reads from its inputs, but may have monadic side-effects.

source :: Foldable f => f b -> Source b Source

Generate a Source from any Foldable container.

repeated :: o -> Source o Source

Repeat the same value, over and over.

cycled :: Foldable f => f b -> Source b Source

Loop through a Foldable container over and over.

cap :: Process a b -> Source a -> Source b Source

You can transform a Source with a Process.

Alternately you can view this as capping the Source end of a Process, yielding a new Source.

cap l r = l <~ r

iterated :: (a -> a) -> a -> Source a Source

iterated f x returns an infinite source of repeated applications of f to x

replicated :: Int -> a -> Source a Source

replicated n x is a source of x emitted n time(s)

enumerateFromTo :: (Enum a, Eq a) => a -> a -> Source a Source

Enumerate from a value to a final value, inclusive, via succ