[Haskell-cafe] ANNOUNCE: pipes-core 0.0.1
cdsmith at gmail.com
Sun Mar 11 17:23:41 CET 2012
On Sun, Mar 11, 2012 at 7:09 AM, Paolo Capriotti <p.capriotti at gmail.com> wrote:
> Someone actually implemented a variation of Pipes with unawait:
> (it's called 'unuse' there).
> I actually agree that it might break associativity or identity, but I
> don't have a counterexample in mind yet.
Indeed, on further thought, it looks like you'd run into problems here:
unawait x >> await == return x
(idP >+> unawait x) >> await == ???
The monadic operation is crucial there: without it, there's no way to
observe which side of idP knows about the unawait, so you can keep it
local and everything is fine... but throw in the Monad instance, and
those pipes are no longer equivalent because they act differently in
vertical composition. There is no easy way to fix this with (idP ==
pipe id). You could kludge the identity pipes and make that law hold,
and I *think* you'd even keep associativity in the process so you
would technically have a category again. But this hints to me that
there is some *other* law you should expect to hold with regard to the
interaction of Category and Monad, and now that is being broken.
More information about the Haskell-Cafe