Copyright | © 2015 Patryk Zadarnowski <pat@jantar.org> |
---|---|
License | BSD3 |
Maintainer | pat@jantar.org |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
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.
- type SP a b f r = forall b'. P () a b b' f r
- type SPResult e = Maybe (Maybe e)
- pattern SPIncomplete :: Maybe t
- pattern SPComplete :: Maybe (Maybe t)
- pattern SPFailed :: t -> Maybe (Maybe t)
- spfetch :: Functor f => SP a b f (Maybe a)
- sppure :: (a -> b) -> SP a b f ()
- spid :: SP a a f ()
- spconcat :: SP [a] a f [a]
- spfold :: (Functor f, Monoid a) => SP a a f ()
- spfoldl :: (b -> a -> b) -> b -> SP a b f ()
- spfoldr :: (a -> b -> b) -> b -> SP a b f ()
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:
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 ())
.
spfold :: (Functor f, Monoid a) => SP a a f () Source
A processor that folds an entire stream into a single value.