[Haskell-cafe] ANNOUNCE: pipes-core 0.0.1

Chris Smith cdsmith at gmail.com
Sun Mar 11 18:36:39 CET 2012

On Sun, Mar 11, 2012 at 11:22 AM, Mario Blažević <blamario at acanac.net> wrote:
>    No, idP does terminate once it consumes its input. Your idP >> p first
> reproduces the complete input, and then runs p with empty input.

This is just not true.  idP consumes input forever, and (idP >> p) =
idP, for all pipes p.

If it is composed with another pipe that terminates, then yes, the
*composite* pipe can terminate, so for example ((q >+> idP) >> p) may
actually do something with p.  But to get that effect, you need to
compose before the monadic bind... so for example (q >+> (idP >> p)) =
(q >+> idP) = q.  Yes, q can be exhausted, but when it is, idP will
await input, which will immediately terminate the (idP >> p) pipe,
producing the result from q, and ignoring p entirely.

Chris Smith

More information about the Haskell-Cafe mailing list