Sophie

Sophie

distrib > Fedora > 18 > x86_64 > media > updates > by-pkgid > 765adc18ec52512b3512a9992c59746e > files > 53

ghc-arrows-devel-0.4.4.1-1.fc18.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Control.Arrow.Transformer.Stream</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Control-Arrow-Transformer-Stream.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Control-Arrow-Transformer-Stream.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">arrows-0.4.4.1: Arrow classes and transformers</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>non-portable (multi-parameter type classes)</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>ross@soi.city.ac.uk</td></tr><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Control.Arrow.Transformer.Stream</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Arrow transformer lifting an arrow to streams.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">newtype</span>  <a href="#t:StreamArrow">StreamArrow</a> a b c = <a href="#v:StreamArrow">StreamArrow</a> (a (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> b) (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> c))</li><li class="src short"><a href="#v:runStream">runStream</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a =&gt; <a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a (e, b) c -&gt; a (e, <a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> b) (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> c)</li><li class="src short"><span class="keyword">type</span> <a href="#t:StreamMap">StreamMap</a> = <a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> (-&gt;)</li><li class="src short"><span class="keyword">type</span> <a href="#t:StreamMapST">StreamMapST</a> s = <a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Kleisli">Kleisli</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-ST-Safe.html#t:ST">ST</a> s))</li><li class="src short"><a href="#v:runStreamST">runStreamST</a> ::  (<span class="keyword">forall</span> s.  <a href="Control-Arrow-Transformer-Stream.html#t:StreamMapST">StreamMapST</a> s e c) -&gt; <a href="Control-Arrow-Transformer-Stream.html#t:StreamMap">StreamMap</a> e c</li><li class="src short"><span class="keyword">class</span> (<a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a') =&gt; <a href="#t:ArrowAddStream">ArrowAddStream</a> a a' | a -&gt; a' <span class="keyword">where</span><ul class="subs"><li><a href="#v:liftStream">liftStream</a> ::  a' e b -&gt; a e b</li><li><a href="#v:elimStream">elimStream</a> ::  a (e, b) c -&gt; a' (e, <a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> b) (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> c)</li></ul></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">newtype</span>  <a name="t:StreamArrow" class="def">StreamArrow</a> a b c <a href="src/Control-Arrow-Transformer-Stream.html#StreamArrow" class="link">Source</a></p><div class="doc"><p>Arrows between streams.
</p><p><em>Note</em>: <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> is only a functor if <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#v:-42--42--42-">***</a></code> in the underlying arrow is.
</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:StreamArrow" class="def">StreamArrow</a> (a (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> b) (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> c))</td><td class="doc empty">&nbsp;</td></tr></table></div><div class="subs instances"><p id="control.i:StreamArrow" class="caption collapser" onclick="toggleSection('i:StreamArrow')">Instances</p><div id="section.i:StreamArrow" class="show"><table><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a =&gt; <a href="Control-Arrow-Transformer.html#t:ArrowTransformer">ArrowTransformer</a> <a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w a =&gt; <a href="Control-Arrow-Operations.html#t:ArrowWriter">ArrowWriter</a> w (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s a =&gt; <a href="Control-Arrow-Operations.html#t:ArrowState">ArrowState</a> s (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowZero">ArrowZero</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowZero">ArrowZero</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowPlus">ArrowPlus</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowPlus">ArrowPlus</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowChoice">ArrowChoice</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Category.html#t:Category">Category</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Category.html#t:Category">Category</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a =&gt; <a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a =&gt; <a href="Control-Arrow-Transformer-Stream.html#t:ArrowAddStream">ArrowAddStream</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a) a</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad.html#t:Functor">Functor</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowPlus">ArrowPlus</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Alternative">Alternative</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a b)</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowPlus">ArrowPlus</a> a =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Data-Monoid.html#t:Monoid">Monoid</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a b c)</td><td class="doc empty">&nbsp;</td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:runStream" class="def">runStream</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a =&gt; <a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a (e, b) c -&gt; a (e, <a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> b) (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> c)<a href="src/Control-Arrow-Transformer-Stream.html#runStream" class="link">Source</a></p><div class="doc"><p>Run a stream processor on a stream of inputs, obtaining a stream
 of outputs.
</p><p>Typical usage in arrow notation:
</p><pre>	proc p -&gt; do
		...
		ys &lt;- (|runStream (\x -&gt; ...)|) xs
</pre><p>Here <code>xs</code> refers to the input stream and <code>x</code> to individual
 elements of that stream.  <code>ys</code> is bound to the output stream.
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:StreamMap" class="def">StreamMap</a> = <a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> (-&gt;)<a href="src/Control-Arrow-Transformer-Stream.html#StreamMap" class="link">Source</a></p><div class="doc"><p>Mappings of streams
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:StreamMapST" class="def">StreamMapST</a> s = <a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Kleisli">Kleisli</a> (<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-ST-Safe.html#t:ST">ST</a> s))<a href="src/Control-Arrow-Transformer-Stream.html#StreamMapST" class="link">Source</a></p><div class="doc"><p>In-place state updates.
</p><p><em>Note</em>: this is an arrow type, and <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> can be used to promote arrows
 from <code><code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Kleisli">Kleisli</a></code> (<code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Monad-ST-Safe.html#t:ST">ST</a></code> s)</code>: the resulting arrow updates the state for
 each stream element in turn, and as long as the final state in not
 required all is well.  However, <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> does not preserve composition,
 because this monad isn't commutative.  In particular, a composition
 of <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code>s of state transformers will not work, as the second will
 require the final state of the first.
</p></div></div><div class="top"><p class="src"><a name="v:runStreamST" class="def">runStreamST</a> ::  (<span class="keyword">forall</span> s.  <a href="Control-Arrow-Transformer-Stream.html#t:StreamMapST">StreamMapST</a> s e c) -&gt; <a href="Control-Arrow-Transformer-Stream.html#t:StreamMap">StreamMap</a> e c<a href="src/Control-Arrow-Transformer-Stream.html#runStreamST" class="link">Source</a></p><div class="doc"><p>Encapsulate a local state.
</p></div></div><div class="top"><p class="src"><span class="keyword">class</span> (<a href="Control-Arrow-Operations.html#t:ArrowCircuit">ArrowCircuit</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Arrow">Arrow</a> a') =&gt; <a name="t:ArrowAddStream" class="def">ArrowAddStream</a> a a' | a -&gt; a' <span class="keyword">where</span><a href="src/Control-Arrow-Internals.html#ArrowAddStream" class="link">Source</a></p><div class="doc"><p>Adding a <code><a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a></code> to an
 arrow type, but not necessarily as the outer arrow transformer.
</p><p>Typically a composite arrow type is built by applying a series
 of arrow transformer to a base arrow (usually either a function
 arrow or a <code><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:Kleisli">Kleisli</a></code> arrow.  One can add a transformer to the
 top of this stack using the <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code>
 method of the <code><a href="Control-Arrow-Transformer.html#t:ArrowTransformer">ArrowTransformer</a></code> class,
 or remove a state transformer from the top of the stack using the
 <code><a href="Control-Arrow-Transformer-Stream.html#v:runStream">runStream</a></code> encapsulation operator.
 The methods of this class add and remove state transformers anywhere
 in the stack.  In the instance
</p><pre>	instance Arrow a =&gt; ArrowAddStream (ArrowStream a) a
</pre><p>they are equivalent to <code><a href="Control-Arrow-Transformer.html#v:lift">lift</a></code> and
 <code><a href="Control-Arrow-Transformer-Stream.html#v:runStream">runStream</a></code> respectively.
 Instances are lifted through other transformers with
</p><pre>	instance ArrowAddStream a a' =&gt;
		ArrowAddStream (FooArrow a) (FooArrow a')
</pre></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:liftStream" class="def">liftStream</a> ::  a' e b -&gt; a e b<a href="src/Control-Arrow-Internals.html#liftStream" class="link">Source</a></p><div class="doc"><p>Lift a computation from an arrow to a stream processing one.
</p><p>Typical usage in arrow notation:
</p><pre>	proc p -&gt; ...
		(|liftStream cmd|)
</pre></div><p class="src"><a name="v:elimStream" class="def">elimStream</a> ::  a (e, b) c -&gt; a' (e, <a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> b) (<a href="/usr/share/doc/ghc/html/libraries/Stream-0.4.6/Data-Stream.html#t:Stream">Stream</a> c)<a href="src/Control-Arrow-Internals.html#elimStream" class="link">Source</a></p><div class="doc"><p>Run a stream processor on a stream of inputs,
 obtaining a stream of outputs.
</p><p>Typical usage in arrow notation:
</p><pre>	proc p -&gt; do
		...
		ys &lt;- (|elimStream (\x -&gt; ...)|) xs
</pre><p>Here <code>xs</code> refers to the input stream and <code>x</code> to individual
 elements of that stream.  <code>ys</code> is bound to the output stream.
</p></div></div><div class="subs instances"><p id="control.i:ArrowAddStream" class="caption collapser" onclick="toggleSection('i:ArrowAddStream')">Instances</p><div id="section.i:ArrowAddStream" class="show"><table><tr><td class="src">(<a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a, <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowApply">ArrowApply</a> a) =&gt; <a href="Control-Arrow-Transformer-Stream.html#t:ArrowAddStream">ArrowAddStream</a> (<a href="Control-Arrow-Transformer-Automaton.html#t:Automaton">Automaton</a> a) a</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src"><a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Arrow.html#t:ArrowLoop">ArrowLoop</a> a =&gt; <a href="Control-Arrow-Transformer-Stream.html#t:ArrowAddStream">ArrowAddStream</a> (<a href="Control-Arrow-Transformer-Stream.html#t:StreamArrow">StreamArrow</a> a) a</td><td class="doc empty">&nbsp;</td></tr><tr><td class="src">(<a href="Control-Arrow-Transformer-Stream.html#t:ArrowAddStream">ArrowAddStream</a> a a', <a href="/usr/share/doc/ghc/html/libraries/base-4.5.0.0/Control-Applicative.html#t:Applicative">Applicative</a> f) =&gt; <a href="Control-Arrow-Transformer-Stream.html#t:ArrowAddStream">ArrowAddStream</a> (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a) (<a href="Control-Arrow-Transformer-Static.html#t:StaticArrow">StaticArrow</a> f a')</td><td class="doc empty">&nbsp;</td></tr></table></div></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>