/usr/share/doc/libghc-pipes-doc/html/Pipes-Prelude.html is in libghc-pipes-doc 4.3.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | <!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>Pipes.Prelude</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script src="file:///usr/share/javascript/mathjax/MathJax.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Pipes-Prelude.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Pipes-Prelude.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">pipes-4.3.7: Compositional pipelines</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Trustworthy</td></tr><tr><th>Language</th><td>Haskell2010</td></tr></table><p class="caption">Pipes.Prelude</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Producers</a></li><li><a href="#g:2">Consumers</a></li><li><a href="#g:3">Pipes</a></li><li><a href="#g:4">ListT</a></li><li><a href="#g:5">Folds</a></li><li><a href="#g:6">Zips</a></li><li><a href="#g:7">Utilities</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>General purpose utilities</p><p>The names in this module clash heavily with the Haskell Prelude, so I
recommend the following import scheme:</p><pre>import Pipes
import qualified Pipes.Prelude as P -- or use any other qualifier you prefer</pre><p>Note that <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>-based <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#t:IO">IO</a></code> is inefficient. The <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>-based utilities
in this module exist only for simple demonstrations without incurring a
dependency on the <code>text</code> package.</p><p>Also, <code><a href="Pipes-Prelude.html#v:stdinLn">stdinLn</a></code> and <code><a href="Pipes-Prelude.html#v:stdoutLn">stdoutLn</a></code> remove and add newlines, respectively. This
behavior is intended to simplify examples. The corresponding <code>stdin</code> and
<code>stdout</code> utilities from <code>pipes-bytestring</code> and <code>pipes-text</code> preserve
newlines.</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:stdinLn">stdinLn</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m ()</li><li class="src short"><a href="#v:readLn">readLn</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> a m ()</li><li class="src short"><a href="#v:fromHandle">fromHandle</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m ()</li><li class="src short"><a href="#v:repeatM">repeatM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => m a -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> a m r</li><li class="src short"><a href="#v:replicateM">replicateM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> m a -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> a m ()</li><li class="src short"><a href="#v:unfoldr">unfoldr</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (s -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> r (a, s))) -> s -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r</li><li class="src short"><a href="#v:stdoutLn">stdoutLn</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m ()</li><li class="src short"><a href="#v:stdoutLn-39-">stdoutLn'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m r</li><li class="src short"><a href="#v:mapM_">mapM_</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m ()) -> <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> a m r</li><li class="src short"><a href="#v:print">print</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> a) => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> a m r</li><li class="src short"><a href="#v:toHandle">toHandle</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m r</li><li class="src short"><a href="#v:drain">drain</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> a m r</li><li class="src short"><a href="#v:map">map</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r</li><li class="src short"><a href="#v:mapM">mapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r</li><li class="src short"><a href="#v:sequence">sequence</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Pipe">Pipe</a> (m a) a m r</li><li class="src short"><a href="#v:mapFoldable">mapFoldable</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Pipes.html#t:Foldable">Foldable</a> t) => (a -> t b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r</li><li class="src short"><a href="#v:filter">filter</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r</li><li class="src short"><a href="#v:filterM">filterM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r</li><li class="src short"><a href="#v:take">take</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m ()</li><li class="src short"><a href="#v:takeWhile">takeWhile</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m ()</li><li class="src short"><a href="#v:takeWhile-39-">takeWhile'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m a</li><li class="src short"><a href="#v:drop">drop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r</li><li class="src short"><a href="#v:dropWhile">dropWhile</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r</li><li class="src short"><a href="#v:concat">concat</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Pipes.html#t:Foldable">Foldable</a> f) => <a href="Pipes-Core.html#t:Pipe">Pipe</a> (f a) a m r</li><li class="src short"><a href="#v:elemIndices">elemIndices</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> m r</li><li class="src short"><a href="#v:findIndices">findIndices</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> m r</li><li class="src short"><a href="#v:scan">scan</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> x) -> x -> (x -> b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r</li><li class="src short"><a href="#v:scanM">scanM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> m x) -> m x -> (x -> m b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r</li><li class="src short"><a href="#v:chain">chain</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m ()) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r</li><li class="src short"><a href="#v:read">read</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="Pipes-Core.html#t:Pipe">Pipe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> a m r</li><li class="src short"><a href="#v:show">show</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> a) => <a href="Pipes-Core.html#t:Pipe">Pipe</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m r</li><li class="src short"><a href="#v:seq">seq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r</li><li class="src short"><a href="#v:loop">loop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="Pipes.html#t:ListT">ListT</a> m b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r</li><li class="src short"><a href="#v:fold">fold</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> x) -> x -> (x -> b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m b</li><li class="src short"><a href="#v:fold-39-">fold'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> x) -> x -> (x -> b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> m (b, r)</li><li class="src short"><a href="#v:foldM">foldM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> m x) -> m x -> (x -> m b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m b</li><li class="src short"><a href="#v:foldM-39-">foldM'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> m x) -> m x -> (x -> m b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> m (b, r)</li><li class="src short"><a href="#v:all">all</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:any">any</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:and">and</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:or">or</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:elem">elem</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:notElem">notElem</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:find">find</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:findIndex">findIndex</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a>)</li><li class="src short"><a href="#v:head">head</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:index">index</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:last">last</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:length">length</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a></li><li class="src short"><a href="#v:maximum">maximum</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:minimum">minimum</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a)</li><li class="src short"><a href="#v:null">null</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:sum">sum</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Num">Num</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m a</li><li class="src short"><a href="#v:product">product</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Num">Num</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m a</li><li class="src short"><a href="#v:toList">toList</a> :: <a href="Pipes-Core.html#t:Producer">Producer</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor-Identity.html#t:Identity">Identity</a> () -> [a]</li><li class="src short"><a href="#v:toListM">toListM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m [a]</li><li class="src short"><a href="#v:toListM-39-">toListM'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> m ([a], r)</li><li class="src short"><a href="#v:zip">zip</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> <a href="Pipes-Core.html#t:Producer">Producer</a> b m r -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> (a, b) m r</li><li class="src short"><a href="#v:zipWith">zipWith</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> b -> c) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> <a href="Pipes-Core.html#t:Producer">Producer</a> b m r -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> c m r</li><li class="src short"><a href="#v:tee">tee</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Consumer">Consumer</a> a m r -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r</li><li class="src short"><a href="#v:generalize">generalize</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r -> x -> <a href="Pipes-Internal.html#t:Proxy">Proxy</a> x a x b m r</li></ul></div><div id="interface"><h1 id="g:1">Producers</h1><div class="doc"><p>Use <code><a href="Pipes.html#v:for">for</a></code> loops to iterate over <code><a href="Pipes-Core.html#t:Producer">Producer</a></code>s whenever you want to perform the
same action for every element:</p><pre>-- Echo all lines from standard input to standard output
runEffect $ for P.stdinLn $ \str -> do
lift $ putStrLn str</pre><p>... or more concisely:</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>runEffect $ for P.stdinLn (lift . putStrLn)
</code></strong>Test<Enter>
Test
ABC<Enter>
ABC
...
</pre></div><div class="top"><p class="src"><a id="v:stdinLn" class="def">stdinLn</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m () <a href="src/Pipes-Prelude.html#stdinLn" class="link">Source</a> <a href="#v:stdinLn" class="selflink">#</a></p><div class="doc"><p>Read <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>s from <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle-FD.html#v:stdin">stdin</a></code> using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#v:getLine">getLine</a></code></p><p>Terminates on end of input</p></div></div><div class="top"><p class="src"><a id="v:readLn" class="def">readLn</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> a m () <a href="src/Pipes-Prelude.html#readLn" class="link">Source</a> <a href="#v:readLn" class="selflink">#</a></p><div class="doc"><p><code><a href="Pipes-Prelude.html#v:read">read</a></code> values from <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle-FD.html#v:stdin">stdin</a></code>, ignoring failed parses</p></div></div><div class="top"><p class="src"><a id="v:fromHandle" class="def">fromHandle</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m () <a href="src/Pipes-Prelude.html#fromHandle" class="link">Source</a> <a href="#v:fromHandle" class="selflink">#</a></p><div class="doc"><p>Read <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>s from a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle.html#t:Handle">Handle</a></code> using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle.html#v:hGetLine">hGetLine</a></code></p><p>Terminates on end of input</p></div></div><div class="top"><p class="src"><a id="v:repeatM" class="def">repeatM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => m a -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> a m r <a href="src/Pipes-Prelude.html#repeatM" class="link">Source</a> <a href="#v:repeatM" class="selflink">#</a></p><div class="doc"><p>Repeat a monadic action indefinitely, <code><a href="Pipes.html#v:yield">yield</a></code>ing each result</p></div></div><div class="top"><p class="src"><a id="v:replicateM" class="def">replicateM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> m a -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> a m () <a href="src/Pipes-Prelude.html#replicateM" class="link">Source</a> <a href="#v:replicateM" class="selflink">#</a></p><div class="doc"><p>Repeat a monadic action a fixed number of times, <code><a href="Pipes.html#v:yield">yield</a></code>ing each result</p><pre>replicateM 0 x = return ()
replicateM (m + n) x = replicateM m x >> replicateM n x -- 0 <= {m,n}</pre></div></div><div class="top"><p class="src"><a id="v:unfoldr" class="def">unfoldr</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (s -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Either.html#t:Either">Either</a> r (a, s))) -> s -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r <a href="src/Pipes-Prelude.html#unfoldr" class="link">Source</a> <a href="#v:unfoldr" class="selflink">#</a></p><div class="doc"><p>The natural unfold into a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> with a step function and a seed </p><pre>unfoldr next = id</pre></div></div><h1 id="g:2">Consumers</h1><div class="doc"><p>Feed a <code><a href="Pipes-Core.html#t:Consumer">Consumer</a></code> the same value repeatedly using (<code><a href="Pipes.html#v:-62--126-">>~</a></code>):</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>runEffect $ lift getLine >~ P.stdoutLn
</code></strong>Test<Enter>
Test
ABC<Enter>
ABC
...
</pre></div><div class="top"><p class="src"><a id="v:stdoutLn" class="def">stdoutLn</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m () <a href="src/Pipes-Prelude.html#stdoutLn" class="link">Source</a> <a href="#v:stdoutLn" class="selflink">#</a></p><div class="doc"><p>Write <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>s to <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle-FD.html#v:stdout">stdout</a></code> using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#v:putStrLn">putStrLn</a></code></p><p>Unlike <code><a href="Pipes-Prelude.html#v:toHandle">toHandle</a></code>, <code><a href="Pipes-Prelude.html#v:stdoutLn">stdoutLn</a></code> gracefully terminates on a broken output pipe</p></div></div><div class="top"><p class="src"><a id="v:stdoutLn-39-" class="def">stdoutLn'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m r <a href="src/Pipes-Prelude.html#stdoutLn%27" class="link">Source</a> <a href="#v:stdoutLn-39-" class="selflink">#</a></p><div class="doc"><p>Write <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>s to <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle-FD.html#v:stdout">stdout</a></code> using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#v:putStrLn">putStrLn</a></code></p><p>This does not handle a broken output pipe, but has a polymorphic return
value</p></div></div><div class="top"><p class="src"><a id="v:mapM_" class="def">mapM_</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m ()) -> <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> a m r <a href="src/Pipes-Prelude.html#mapM_" class="link">Source</a> <a href="#v:mapM_" class="selflink">#</a></p><div class="doc"><p>Consume all values using a monadic function</p></div></div><div class="top"><p class="src"><a id="v:print" class="def">print</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> a) => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> a m r <a href="src/Pipes-Prelude.html#print" class="link">Source</a> <a href="#v:print" class="selflink">#</a></p><div class="doc"><p><code><a href="Pipes-Prelude.html#v:print">print</a></code> values to <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle-FD.html#v:stdout">stdout</a></code></p></div></div><div class="top"><p class="src"><a id="v:toHandle" class="def">toHandle</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle.html#t:Handle">Handle</a> -> <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m r <a href="src/Pipes-Prelude.html#toHandle" class="link">Source</a> <a href="#v:toHandle" class="selflink">#</a></p><div class="doc"><p>Write <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>s to a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/GHC-IO-Handle.html#t:Handle">Handle</a></code> using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/System-IO.html#v:hPutStrLn">hPutStrLn</a></code></p></div></div><div class="top"><p class="src"><a id="v:drain" class="def">drain</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Consumer-39-">Consumer'</a> a m r <a href="src/Pipes-Prelude.html#drain" class="link">Source</a> <a href="#v:drain" class="selflink">#</a></p><div class="doc"><p><code><a href="Pipes.html#v:discard">discard</a></code> all incoming values</p></div></div><h1 id="g:3">Pipes</h1><div class="doc"><p>Use (<code><a href="Pipes.html#v:-62--45--62-">>-></a></code>) to connect <code><a href="Pipes-Core.html#t:Producer">Producer</a></code>s, <code><a href="Pipes-Core.html#t:Pipe">Pipe</a></code>s, and <code><a href="Pipes-Core.html#t:Consumer">Consumer</a></code>s:</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>runEffect $ P.stdinLn >-> P.takeWhile (/= "quit") >-> P.stdoutLn
</code></strong>Test<Enter>
Test
ABC<Enter>
ABC
quit<Enter>
<code class="prompt">>>> </code><strong class="userinput"><code>
</code></strong></pre></div><div class="top"><p class="src"><a id="v:map" class="def">map</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r <a href="src/Pipes-Prelude.html#map" class="link">Source</a> <a href="#v:map" class="selflink">#</a></p><div class="doc"><p>Apply a function to all values flowing downstream</p><pre>map id = cat
map (g . f) = map f >-> map g</pre></div></div><div class="top"><p class="src"><a id="v:mapM" class="def">mapM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r <a href="src/Pipes-Prelude.html#mapM" class="link">Source</a> <a href="#v:mapM" class="selflink">#</a></p><div class="doc"><p>Apply a monadic function to all values flowing downstream</p><pre>mapM return = cat
mapM (f >=> g) = mapM f >-> mapM g</pre></div></div><div class="top"><p class="src"><a id="v:sequence" class="def">sequence</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Pipe">Pipe</a> (m a) a m r <a href="src/Pipes-Prelude.html#sequence" class="link">Source</a> <a href="#v:sequence" class="selflink">#</a></p><div class="doc"><p>Convert a stream of actions to a stream of values</p></div></div><div class="top"><p class="src"><a id="v:mapFoldable" class="def">mapFoldable</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Pipes.html#t:Foldable">Foldable</a> t) => (a -> t b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r <a href="src/Pipes-Prelude.html#mapFoldable" class="link">Source</a> <a href="#v:mapFoldable" class="selflink">#</a></p><div class="doc"><p>Apply a function to all values flowing downstream, and
forward each element of the result.</p></div></div><div class="top"><p class="src"><a id="v:filter" class="def">filter</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r <a href="src/Pipes-Prelude.html#filter" class="link">Source</a> <a href="#v:filter" class="selflink">#</a></p><div class="doc"><p><code>(filter predicate)</code> only forwards values that satisfy the predicate.</p><pre>filter (pure True) = cat
filter (liftA2 (&&) p1 p2) = filter p1 >-> filter p2</pre></div></div><div class="top"><p class="src"><a id="v:filterM" class="def">filterM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r <a href="src/Pipes-Prelude.html#filterM" class="link">Source</a> <a href="#v:filterM" class="selflink">#</a></p><div class="doc"><p><code>(filterM predicate)</code> only forwards values that satisfy the monadic
predicate</p><pre>filterM (pure (pure True)) = cat
filterM (liftA2 (liftA2 (&&)) p1 p2) = filterM p1 >-> filterM p2</pre></div></div><div class="top"><p class="src"><a id="v:take" class="def">take</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m () <a href="src/Pipes-Prelude.html#take" class="link">Source</a> <a href="#v:take" class="selflink">#</a></p><div class="doc"><p><code>(take n)</code> only allows <code>n</code> values to pass through</p><pre>take 0 = return ()
take (m + n) = take m >> take n</pre><pre>take <infinity> = cat
take (min m n) = take m >-> take n</pre></div></div><div class="top"><p class="src"><a id="v:takeWhile" class="def">takeWhile</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m () <a href="src/Pipes-Prelude.html#takeWhile" class="link">Source</a> <a href="#v:takeWhile" class="selflink">#</a></p><div class="doc"><p><code>(takeWhile p)</code> allows values to pass downstream so long as they satisfy
the predicate <code>p</code>.</p><pre>takeWhile (pure True) = cat
takeWhile (liftA2 (&&) p1 p2) = takeWhile p1 >-> takeWhile p2</pre></div></div><div class="top"><p class="src"><a id="v:takeWhile-39-" class="def">takeWhile'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m a <a href="src/Pipes-Prelude.html#takeWhile%27" class="link">Source</a> <a href="#v:takeWhile-39-" class="selflink">#</a></p><div class="doc"><p><code>(takeWhile' p)</code> is a version of takeWhile that returns the value failing
the predicate.</p><pre>takeWhile' (pure True) = cat
takeWhile' (liftA2 (&&) p1 p2) = takeWhile' p1 >-> takeWhile' p2</pre></div></div><div class="top"><p class="src"><a id="v:drop" class="def">drop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r <a href="src/Pipes-Prelude.html#drop" class="link">Source</a> <a href="#v:drop" class="selflink">#</a></p><div class="doc"><p><code>(drop n)</code> discards <code>n</code> values going downstream</p><pre>drop 0 = cat
drop (m + n) = drop m >-> drop n</pre></div></div><div class="top"><p class="src"><a id="v:dropWhile" class="def">dropWhile</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r <a href="src/Pipes-Prelude.html#dropWhile" class="link">Source</a> <a href="#v:dropWhile" class="selflink">#</a></p><div class="doc"><p><code>(dropWhile p)</code> discards values going downstream until one violates the
predicate <code>p</code>.</p><pre>dropWhile (pure False) = cat
dropWhile (liftA2 (||) p1 p2) = dropWhile p1 >-> dropWhile p2</pre></div></div><div class="top"><p class="src"><a id="v:concat" class="def">concat</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Pipes.html#t:Foldable">Foldable</a> f) => <a href="Pipes-Core.html#t:Pipe">Pipe</a> (f a) a m r <a href="src/Pipes-Prelude.html#concat" class="link">Source</a> <a href="#v:concat" class="selflink">#</a></p><div class="doc"><p>Flatten all <code><a href="Pipes.html#t:Foldable">Foldable</a></code> elements flowing downstream</p></div></div><div class="top"><p class="src"><a id="v:elemIndices" class="def">elemIndices</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> m r <a href="src/Pipes-Prelude.html#elemIndices" class="link">Source</a> <a href="#v:elemIndices" class="selflink">#</a></p><div class="doc"><p>Outputs the indices of all elements that match the given element</p></div></div><div class="top"><p class="src"><a id="v:findIndices" class="def">findIndices</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> m r <a href="src/Pipes-Prelude.html#findIndices" class="link">Source</a> <a href="#v:findIndices" class="selflink">#</a></p><div class="doc"><p>Outputs the indices of all elements that satisfied the predicate</p></div></div><div class="top"><p class="src"><a id="v:scan" class="def">scan</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> x) -> x -> (x -> b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r <a href="src/Pipes-Prelude.html#scan" class="link">Source</a> <a href="#v:scan" class="selflink">#</a></p><div class="doc"><p>Strict left scan</p><pre>Control.Foldl.purely scan :: Monad m => Fold a b -> Pipe a b m r</pre></div></div><div class="top"><p class="src"><a id="v:scanM" class="def">scanM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> m x) -> m x -> (x -> m b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r <a href="src/Pipes-Prelude.html#scanM" class="link">Source</a> <a href="#v:scanM" class="selflink">#</a></p><div class="doc"><p>Strict, monadic left scan</p><pre>Control.Foldl.impurely scan :: Monad m => FoldM a m b -> Pipe a b m r</pre></div></div><div class="top"><p class="src"><a id="v:chain" class="def">chain</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> m ()) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r <a href="src/Pipes-Prelude.html#chain" class="link">Source</a> <a href="#v:chain" class="selflink">#</a></p><div class="doc"><p>Apply an action to all values flowing downstream</p><pre>chain (pure (return ())) = cat
chain (liftA2 (>>) m1 m2) = chain m1 >-> chain m2</pre></div></div><div class="top"><p class="src"><a id="v:read" class="def">read</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a> a) => <a href="Pipes-Core.html#t:Pipe">Pipe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> a m r <a href="src/Pipes-Prelude.html#read" class="link">Source</a> <a href="#v:read" class="selflink">#</a></p><div class="doc"><p>Parse <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Read.html#t:Read">Read</a></code>able values, only forwarding the value if the parse succeeds</p></div></div><div class="top"><p class="src"><a id="v:show" class="def">show</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a> a) => <a href="Pipes-Core.html#t:Pipe">Pipe</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a> m r <a href="src/Pipes-Prelude.html#show" class="link">Source</a> <a href="#v:show" class="selflink">#</a></p><div class="doc"><p>Convert <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Text-Show.html#t:Show">Show</a></code>able values to <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-String.html#t:String">String</a></code>s</p></div></div><div class="top"><p class="src"><a id="v:seq" class="def">seq</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r <a href="src/Pipes-Prelude.html#seq" class="link">Source</a> <a href="#v:seq" class="selflink">#</a></p><div class="doc"><p>Evaluate all values flowing downstream to WHNF</p></div></div><h1 id="g:4">ListT</h1><div class="top"><p class="src"><a id="v:loop" class="def">loop</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="Pipes.html#t:ListT">ListT</a> m b) -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r <a href="src/Pipes-Prelude.html#loop" class="link">Source</a> <a href="#v:loop" class="selflink">#</a></p><div class="doc"><p>Create a <code><a href="Pipes-Core.html#t:Pipe">Pipe</a></code> from a <code><a href="Pipes.html#t:ListT">ListT</a></code> transformation</p><pre>loop (k1 >=> k2) = loop k1 >-> loop k2
loop return = cat</pre></div></div><h1 id="g:5">Folds</h1><div class="doc"><p>Use these to fold the output of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code>. Many of these folds will stop
drawing elements if they can compute their result early, like <code><a href="Pipes-Prelude.html#v:any">any</a></code>:</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>P.any Prelude.null P.stdinLn
</code></strong>Test<Enter>
ABC<Enter>
<Enter>
True
<code class="prompt">>>> </code><strong class="userinput"><code>
</code></strong></pre></div><div class="top"><p class="src"><a id="v:fold" class="def">fold</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> x) -> x -> (x -> b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m b <a href="src/Pipes-Prelude.html#fold" class="link">Source</a> <a href="#v:fold" class="selflink">#</a></p><div class="doc"><p>Strict fold of the elements of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p><pre>Control.Foldl.purely fold :: Monad m => Fold a b -> Producer a m () -> m b</pre></div></div><div class="top"><p class="src"><a id="v:fold-39-" class="def">fold'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> x) -> x -> (x -> b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> m (b, r) <a href="src/Pipes-Prelude.html#fold%27" class="link">Source</a> <a href="#v:fold-39-" class="selflink">#</a></p><div class="doc"><p>Strict fold of the elements of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> that preserves the return value</p><pre>Control.Foldl.purely fold' :: Monad m => Fold a b -> Producer a m r -> m (b, r)</pre></div></div><div class="top"><p class="src"><a id="v:foldM" class="def">foldM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> m x) -> m x -> (x -> m b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m b <a href="src/Pipes-Prelude.html#foldM" class="link">Source</a> <a href="#v:foldM" class="selflink">#</a></p><div class="doc"><p>Strict, monadic fold of the elements of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p><pre>Control.Foldl.impurely foldM :: Monad m => FoldM a b -> Producer a m () -> m b</pre></div></div><div class="top"><p class="src"><a id="v:foldM-39-" class="def">foldM'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (x -> a -> m x) -> m x -> (x -> m b) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> m (b, r) <a href="src/Pipes-Prelude.html#foldM%27" class="link">Source</a> <a href="#v:foldM-39-" class="selflink">#</a></p><div class="doc"><p>Strict, monadic fold of the elements of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p><pre>Control.Foldl.impurely foldM' :: Monad m => FoldM a b -> Producer a m r -> m (b, r)</pre></div></div><div class="top"><p class="src"><a id="v:all" class="def">all</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Pipes-Prelude.html#all" class="link">Source</a> <a href="#v:all" class="selflink">#</a></p><div class="doc"><p><code>(all predicate p)</code> determines whether all the elements of <code>p</code> satisfy the
predicate.</p></div></div><div class="top"><p class="src"><a id="v:any" class="def">any</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Pipes-Prelude.html#any" class="link">Source</a> <a href="#v:any" class="selflink">#</a></p><div class="doc"><p><code>(any predicate p)</code> determines whether any element of <code>p</code> satisfies the
predicate.</p></div></div><div class="top"><p class="src"><a id="v:and" class="def">and</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Pipes-Prelude.html#and" class="link">Source</a> <a href="#v:and" class="selflink">#</a></p><div class="doc"><p>Determines whether all elements are <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#v:True">True</a></code></p></div></div><div class="top"><p class="src"><a id="v:or" class="def">or</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Pipes-Prelude.html#or" class="link">Source</a> <a href="#v:or" class="selflink">#</a></p><div class="doc"><p>Determines whether any element is <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#v:True">True</a></code></p></div></div><div class="top"><p class="src"><a id="v:elem" class="def">elem</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Pipes-Prelude.html#elem" class="link">Source</a> <a href="#v:elem" class="selflink">#</a></p><div class="doc"><p><code>(elem a p)</code> returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#v:True">True</a></code> if <code>p</code> has an element equal to <code>a</code>, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#v:False">False</a></code>
otherwise</p></div></div><div class="top"><p class="src"><a id="v:notElem" class="def">notElem</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Eq.html#t:Eq">Eq</a> a) => a -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Pipes-Prelude.html#notElem" class="link">Source</a> <a href="#v:notElem" class="selflink">#</a></p><div class="doc"><p><code>(notElem a)</code> returns <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#v:False">False</a></code> if <code>p</code> has an element equal to <code>a</code>, <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#v:True">True</a></code>
otherwise</p></div></div><div class="top"><p class="src"><a id="v:find" class="def">find</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Pipes-Prelude.html#find" class="link">Source</a> <a href="#v:find" class="selflink">#</a></p><div class="doc"><p>Find the first element of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> that satisfies the predicate</p></div></div><div class="top"><p class="src"><a id="v:findIndex" class="def">findIndex</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a>) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a>) <a href="src/Pipes-Prelude.html#findIndex" class="link">Source</a> <a href="#v:findIndex" class="selflink">#</a></p><div class="doc"><p>Find the index of the first element of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> that satisfies the
predicate</p></div></div><div class="top"><p class="src"><a id="v:head" class="def">head</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Pipes-Prelude.html#head" class="link">Source</a> <a href="#v:head" class="selflink">#</a></p><div class="doc"><p>Retrieve the first element from a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:index" class="def">index</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Pipes-Prelude.html#index" class="link">Source</a> <a href="#v:index" class="selflink">#</a></p><div class="doc"><p>Index into a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:last" class="def">last</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Pipes-Prelude.html#last" class="link">Source</a> <a href="#v:last" class="selflink">#</a></p><div class="doc"><p>Retrieve the last element from a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:length" class="def">length</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Int.html#t:Int">Int</a> <a href="src/Pipes-Prelude.html#length" class="link">Source</a> <a href="#v:length" class="selflink">#</a></p><div class="doc"><p>Count the number of elements in a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:maximum" class="def">maximum</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Pipes-Prelude.html#maximum" class="link">Source</a> <a href="#v:maximum" class="selflink">#</a></p><div class="doc"><p>Find the maximum element of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:minimum" class="def">minimum</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Ord.html#t:Ord">Ord</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Maybe.html#t:Maybe">Maybe</a> a) <a href="src/Pipes-Prelude.html#minimum" class="link">Source</a> <a href="#v:minimum" class="selflink">#</a></p><div class="doc"><p>Find the minimum element of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:null" class="def">null</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Bool.html#t:Bool">Bool</a> <a href="src/Pipes-Prelude.html#null" class="link">Source</a> <a href="#v:null" class="selflink">#</a></p><div class="doc"><p>Determine if a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> is empty</p></div></div><div class="top"><p class="src"><a id="v:sum" class="def">sum</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Num">Num</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m a <a href="src/Pipes-Prelude.html#sum" class="link">Source</a> <a href="#v:sum" class="selflink">#</a></p><div class="doc"><p>Compute the sum of the elements of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:product" class="def">product</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Prelude.html#t:Num">Num</a> a) => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m a <a href="src/Pipes-Prelude.html#product" class="link">Source</a> <a href="#v:product" class="selflink">#</a></p><div class="doc"><p>Compute the product of the elements of a <code><a href="Pipes-Core.html#t:Producer">Producer</a></code></p></div></div><div class="top"><p class="src"><a id="v:toList" class="def">toList</a> :: <a href="Pipes-Core.html#t:Producer">Producer</a> a <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Data-Functor-Identity.html#t:Identity">Identity</a> () -> [a] <a href="src/Pipes-Prelude.html#toList" class="link">Source</a> <a href="#v:toList" class="selflink">#</a></p><div class="doc"><p>Convert a pure <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> into a list</p></div></div><div class="top"><p class="src"><a id="v:toListM" class="def">toListM</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m () -> m [a] <a href="src/Pipes-Prelude.html#toListM" class="link">Source</a> <a href="#v:toListM" class="selflink">#</a></p><div class="doc"><p>Convert an effectful <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> into a list</p><p>Note: <code><a href="Pipes-Prelude.html#v:toListM">toListM</a></code> is not an idiomatic use of <code>pipes</code>, but I provide it for
simple testing purposes. Idiomatic <code>pipes</code> style consumes the elements
immediately as they are generated instead of loading all elements into
memory.</p></div></div><div class="top"><p class="src"><a id="v:toListM-39-" class="def">toListM'</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> m ([a], r) <a href="src/Pipes-Prelude.html#toListM%27" class="link">Source</a> <a href="#v:toListM-39-" class="selflink">#</a></p><div class="doc"><p>Convert an effectful <code><a href="Pipes-Core.html#t:Producer">Producer</a></code> into a list alongside the return value</p><p>Note: <code><a href="Pipes-Prelude.html#v:toListM-39-">toListM'</a></code> is not an idiomatic use of <code>pipes</code>, but I provide it for
simple testing purposes. Idiomatic <code>pipes</code> style consumes the elements
immediately as they are generated instead of loading all elements into
memory.</p></div></div><h1 id="g:6">Zips</h1><div class="top"><p class="src"><a id="v:zip" class="def">zip</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> <a href="Pipes-Core.html#t:Producer">Producer</a> b m r -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> (a, b) m r <a href="src/Pipes-Prelude.html#zip" class="link">Source</a> <a href="#v:zip" class="selflink">#</a></p><div class="doc"><p>Zip two <code><a href="Pipes-Core.html#t:Producer">Producer</a></code>s</p></div></div><div class="top"><p class="src"><a id="v:zipWith" class="def">zipWith</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => (a -> b -> c) -> <a href="Pipes-Core.html#t:Producer">Producer</a> a m r -> <a href="Pipes-Core.html#t:Producer">Producer</a> b m r -> <a href="Pipes-Core.html#t:Producer-39-">Producer'</a> c m r <a href="src/Pipes-Prelude.html#zipWith" class="link">Source</a> <a href="#v:zipWith" class="selflink">#</a></p><div class="doc"><p>Zip two <code><a href="Pipes-Core.html#t:Producer">Producer</a></code>s using the provided combining function</p></div></div><h1 id="g:7">Utilities</h1><div class="top"><p class="src"><a id="v:tee" class="def">tee</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Consumer">Consumer</a> a m r -> <a href="Pipes-Core.html#t:Pipe">Pipe</a> a a m r <a href="src/Pipes-Prelude.html#tee" class="link">Source</a> <a href="#v:tee" class="selflink">#</a></p><div class="doc"><p>Transform a <code><a href="Pipes-Core.html#t:Consumer">Consumer</a></code> to a <code><a href="Pipes-Core.html#t:Pipe">Pipe</a></code> that reforwards all values further
downstream</p></div></div><div class="top"><p class="src"><a id="v:generalize" class="def">generalize</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.9.1.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Pipes-Core.html#t:Pipe">Pipe</a> a b m r -> x -> <a href="Pipes-Internal.html#t:Proxy">Proxy</a> x a x b m r <a href="src/Pipes-Prelude.html#generalize" class="link">Source</a> <a href="#v:generalize" class="selflink">#</a></p><div class="doc"><p>Transform a unidirectional <code><a href="Pipes-Core.html#t:Pipe">Pipe</a></code> to a bidirectional <code><a href="Pipes-Internal.html#t:Proxy">Proxy</a></code></p><pre>generalize (f >-> g) = generalize f >+> generalize g
generalize cat = pull</pre></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.17.3</p></div></body></html>
|