I'll attempt an answer so Gabriel can test our comprehension together ...
but I think the preferred definition would be
execU ma = for cat (\a -> lift ma >> yield a)
or, since `Pipes.Prelude.mapM` is defined in terms of `for cat` , just
execU ma = P.mapM (<$ ma)
the idea being that with rewrite rules `>-> for cat blah` can be fused with
the previous pipe. (I take it the point is to avoid a second pile of
recursion as with `forever`)
Near the top, the docs for Pipes.Prelude
http://hackage.haskell.org/package/pipes-4.1.0/docs/Pipes-Prelude.html say
Use for loops to iterate over Producers whenever you want to
perform the same action for every element:
...
runEffect $ for P.stdinLn (lift . putStrLn)
`execU` wasn't supposed act directly on a Producer, but to make a Pipe;
but I think you can get away with this by using `for cat ...` given the
many rewrite rules devoted to this point.
There's some discussion of it
here https://groups.google.com/d/msg/haskell-pipes/hyaUTNRXD9A/WJwybxJOyMwJ
but I think it came up a few times on this list.
--
You received this message because you are subscribed to the Google Groups
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].