quiver-0.0.0.7: Quiver finite stream processing library

Copyright© 2015 Patryk Zadarnowski <pat@jantar.org>
LicenseBSD3
Maintainerpat@jantar.org
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Control.Quiver.SP

Description

This module provides a definition of a simple processor with a unit request type and an unspecified acknowledgement type, together with a number of common combinators for their definitions.

Synopsis

Documentation

type SP a b f r = forall b'. P () a b b' f r Source

A simple processor with a unit request type and an unspecified response type:

type SPResult e = Maybe (Maybe e) Source

Simple processor result type.

pattern SPIncomplete :: Maybe t Source

Simple processor result value indicating premature termination of the consumer.

pattern SPComplete :: Maybe (Maybe t) Source

Simple processor result value indicating successful processing of the entire input stream.

pattern SPFailed :: t -> Maybe (Maybe t) Source

Simple processor result value indicating unsuccessful processing of the input stream.

spfetch :: Functor f => SP a b f (Maybe a) Source

spfetch represents a singleton simple stream processor that sends the request value x upstream and delivers the next input value received, or Nothing if the upstream processor has been depleted.

sppure :: (a -> b) -> SP a b f () Source

sppure f produces an infinite consumer/producer that uses a pure function f to convert every input value into an output; equivalent to qpure id f (const ()).

spid :: SP a a f () Source

A simple identity processor, equivalent to 'sppure id'.

spconcat :: SP [a] a f [a] Source

A simple list flattening processor requests.

spfold :: (Functor f, Monoid a) => SP a a f () Source

A processor that folds an entire stream into a single value.

spfoldl :: (b -> a -> b) -> b -> SP a b f () Source

A processor that folds an entire stream into a single value.

spfoldr :: (a -> b -> b) -> b -> SP a b f () Source

A processor that folds an entire stream into a single value.