Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 8e73407480c13630e1be71907a07fad6 > files > 57

ghc-conduit-devel-0.2.2-1.fc15.i686.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>Data.Conduit.List</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_Data-Conduit-List.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-Conduit-List.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">conduit-0.2.2: Streaming data processing library.</p></div><div id="content"><div id="module-header"><p class="caption">Data.Conduit.List</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Sources
</a></li><li><a href="#g:2">Sinks
</a><ul><li><a href="#g:3">Pure
</a></li><li><a href="#g:4">Monadic
</a></li><li><a href="#g:5">Pure
</a></li><li><a href="#g:6">Monadic
</a></li></ul></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Higher-level functions to interact with the elements of a stream. Most of
 these are based on list functions.
</p><p>Note that these functions all deal with individual elements of a stream as a
 sort of &quot;black box&quot;, where there is no introspection of the contained
 elements. Values such as <code>ByteString</code> and <code>Text</code> will likely need to be
 treated specially to deal with their contents properly (<code>Word8</code> and <code>Char</code>,
 respectively). See the <a href="Data-Conduit-Binary.html">Data.Conduit.Binary</a> and <a href="Data-Conduit-Text.html">Data.Conduit.Text</a>
 modules.
</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"><a href="#v:sourceList">sourceList</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; [a] -&gt; <a href="Data-Conduit.html#t:Source">Source</a> m a</li><li class="src short"><a href="#v:sourceNull">sourceNull</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Source">Source</a> m a</li><li class="src short"><a href="#v:fold">fold</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (b -&gt; a -&gt; b) -&gt; b -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m b</li><li class="src short"><a href="#v:take">take</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m [a]</li><li class="src short"><a href="#v:drop">drop</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:head">head</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:zip">zip</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Source">Source</a> m a -&gt; <a href="Data-Conduit.html#t:Source">Source</a> m b -&gt; <a href="Data-Conduit.html#t:Source">Source</a> m (a, b)</li><li class="src short"><a href="#v:peek">peek</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:consume">consume</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m [a]</li><li class="src short"><a href="#v:sinkNull">sinkNull</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:foldM">foldM</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (b -&gt; a -&gt; m b) -&gt; b -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m b</li><li class="src short"><a href="#v:mapM_">mapM_</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a>) -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:map">map</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; b) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b</li><li class="src short"><a href="#v:concatMap">concatMap</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; [b]) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b</li><li class="src short"><a href="#v:concatMapAccum">concatMapAccum</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; accum -&gt; (accum, [b])) -&gt; accum -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b</li><li class="src short"><a href="#v:groupBy">groupBy</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; a -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m [a]</li><li class="src short"><a href="#v:isolate">isolate</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m a</li><li class="src short"><a href="#v:filter">filter</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m a</li><li class="src short"><a href="#v:mapM">mapM</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; m b) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b</li><li class="src short"><a href="#v:concatMapM">concatMapM</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; m [b]) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b</li><li class="src short"><a href="#v:concatMapAccumM">concatMapAccumM</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; accum -&gt; m (accum, [b])) -&gt; accum -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b</li></ul></div><div id="interface"><h1 id="g:1">Sources
</h1><div class="top"><p class="src"><a name="v:sourceList" class="def">sourceList</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; [a] -&gt; <a href="Data-Conduit.html#t:Source">Source</a> m a<a href="src/Data-Conduit-List.html#sourceList" class="link">Source</a></p><div class="doc"><p>Convert a list into a source.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:sourceNull" class="def">sourceNull</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Source">Source</a> m a<a href="src/Data-Conduit-List.html#sourceNull" class="link">Source</a></p><div class="doc"><p>A source that returns nothing. Note that this is just a type-restricted
 synonym for <code><a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Monoid.html#v:mempty">mempty</a></code>.
</p><p>Since 0.2.0
</p></div></div><h1 id="g:2">Sinks
</h1><h2 id="g:3">Pure
</h2><div class="top"><p class="src"><a name="v:fold" class="def">fold</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (b -&gt; a -&gt; b) -&gt; b -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m b<a href="src/Data-Conduit-List.html#fold" class="link">Source</a></p><div class="doc"><p>A strict left fold.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:take" class="def">take</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m [a]<a href="src/Data-Conduit-List.html#take" class="link">Source</a></p><div class="doc"><p>Take some values from the stream and return as a list. If you want to
 instead create a conduit that pipes data to another sink, see <code><a href="Data-Conduit-List.html#v:isolate">isolate</a></code>.
 This function is semantically equivalent to:
</p><pre> take i = isolate i =$ consume
</pre><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:drop" class="def">drop</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Data-Conduit-List.html#drop" class="link">Source</a></p><div class="doc"><p>Ignore a certain number of values in the stream. This function is
 semantically equivalent to:
</p><pre> drop i = take i &gt;&gt; return ()
</pre><p>However, <code>drop</code> is more efficient as it does not need to hold values in
 memory.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:head" class="def">head</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)<a href="src/Data-Conduit-List.html#head" class="link">Source</a></p><div class="doc"><p>Take a single value from the stream, if available.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:zip" class="def">zip</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Source">Source</a> m a -&gt; <a href="Data-Conduit.html#t:Source">Source</a> m b -&gt; <a href="Data-Conduit.html#t:Source">Source</a> m (a, b)<a href="src/Data-Conduit-List.html#zip" class="link">Source</a></p><div class="doc"><p>Combines two sources. The new source will stop producing once either
   source has been exhausted.
</p><p>Since 0.2.2
</p></div></div><div class="top"><p class="src"><a name="v:peek" class="def">peek</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m (<a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)<a href="src/Data-Conduit-List.html#peek" class="link">Source</a></p><div class="doc"><p>Look at the next value in the stream, if available. This function will not
 change the state of the stream.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:consume" class="def">consume</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m [a]<a href="src/Data-Conduit-List.html#consume" class="link">Source</a></p><div class="doc"><p>Consume all values from the stream and return as a list. Note that this
 will pull all values into memory. For a lazy variant, see
 <a href="Data-Conduit-Lazy.html">Data.Conduit.Lazy</a>.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:sinkNull" class="def">sinkNull</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Data-Conduit-List.html#sinkNull" class="link">Source</a></p><div class="doc"><p>Ignore the remainder of values in the source. Particularly useful when
 combined with <code><a href="Data-Conduit-List.html#v:isolate">isolate</a></code>.
</p><p>Since 0.2.0
</p></div></div><h2 id="g:4">Monadic
</h2><div class="top"><p class="src"><a name="v:foldM" class="def">foldM</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (b -&gt; a -&gt; m b) -&gt; b -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m b<a href="src/Data-Conduit-List.html#foldM" class="link">Source</a></p><div class="doc"><p>A monadic strict left fold.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:mapM_" class="def">mapM_</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a>) -&gt; <a href="Data-Conduit.html#t:Sink">Sink</a> a m <a href="/usr/share/doc/ghc/html/libraries/ghc-prim-0.2.0.0/GHC-Unit.html#t:-40--41-">()</a><a href="src/Data-Conduit-List.html#mapM_" class="link">Source</a></p><div class="doc"><p>Apply the action to all values in the stream.
</p><p>Since 0.2.0
</p></div></div><h2 id="g:5">Pure
</h2><div class="top"><p class="src"><a name="v:map" class="def">map</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; b) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b<a href="src/Data-Conduit-List.html#map" class="link">Source</a></p><div class="doc"><p>Apply a transformation to all values in a stream.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:concatMap" class="def">concatMap</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; [b]) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b<a href="src/Data-Conduit-List.html#concatMap" class="link">Source</a></p><div class="doc"><p>Apply a transformation to all values in a stream, concatenating the output
 values.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:concatMapAccum" class="def">concatMapAccum</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; accum -&gt; (accum, [b])) -&gt; accum -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b<a href="src/Data-Conduit-List.html#concatMapAccum" class="link">Source</a></p><div class="doc"><p><code><a href="Data-Conduit-List.html#v:concatMap">concatMap</a></code> with an accumulator.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:groupBy" class="def">groupBy</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; a -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m [a]<a href="src/Data-Conduit-List.html#groupBy" class="link">Source</a></p><div class="doc"><p>Grouping input according to an equality function.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:isolate" class="def">isolate</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Int.html#t:Int">Int</a> -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m a<a href="src/Data-Conduit-List.html#isolate" class="link">Source</a></p><div class="doc"><p>Ensure that the inner sink consumes no more than the given number of
 values. Note this this does <em>not</em> ensure that the sink consumes all of those
 values. To get the latter behavior, combine with <code><a href="Data-Conduit-List.html#v:sinkNull">sinkNull</a></code>, e.g.:
</p><pre> src $$ do
     x &lt;- isolate count =$ do
         x &lt;- someSink
         sinkNull
         return x
     someOtherSink
     ...
</pre><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:filter" class="def">filter</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Data-Bool.html#t:Bool">Bool</a>) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m a<a href="src/Data-Conduit-List.html#filter" class="link">Source</a></p><div class="doc"><p>Keep only values in the stream passing a given predicate.
</p><p>Since 0.2.0
</p></div></div><h2 id="g:6">Monadic
</h2><div class="top"><p class="src"><a name="v:mapM" class="def">mapM</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; m b) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b<a href="src/Data-Conduit-List.html#mapM" class="link">Source</a></p><div class="doc"><p>Apply a monadic transformation to all values in a stream.
</p><p>If you do not need the transformed values, and instead just want the monadic
 side-effects of running the action, see <code><a href="Data-Conduit-List.html#v:mapM_">mapM_</a></code>.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:concatMapM" class="def">concatMapM</a> :: <a href="/usr/share/doc/ghc/html/libraries/base-4.3.1.0/Control-Monad.html#t:Monad">Monad</a> m =&gt; (a -&gt; m [b]) -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b<a href="src/Data-Conduit-List.html#concatMapM" class="link">Source</a></p><div class="doc"><p>Apply a monadic transformation to all values in a stream, concatenating
 the output values.
</p><p>Since 0.2.0
</p></div></div><div class="top"><p class="src"><a name="v:concatMapAccumM" class="def">concatMapAccumM</a> :: <a href="Control-Monad-Trans-Resource.html#t:Resource">Resource</a> m =&gt; (a -&gt; accum -&gt; m (accum, [b])) -&gt; accum -&gt; <a href="Data-Conduit.html#t:Conduit">Conduit</a> a m b<a href="src/Data-Conduit-List.html#concatMapAccumM" class="link">Source</a></p><div class="doc"><p><code><a href="Data-Conduit-List.html#v:concatMapM">concatMapM</a></code> with an accumulator.
</p><p>Since 0.2.0
</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.9.2</p></div></body></html>