
On 12-03-10 09:05 PM, Twan van Laarhoven wrote:
On 2012-03-11 00:09, Mario Blažević wrote:
On 12-03-10 05:19 PM, Twan van Laarhoven wrote:
-- | Pass some unconsumed input back upstream. -- The next @await@ will return this input without blocking. unawait :: Monad m => a -> Pipe a b m ()
The function may be called unawait, but there's nothing stopping you from inserting something into the stream that wasn't in the input to start with. I find that this approach breaks too many invariants.
Which invariants does it break exactly? I.e. what properties do you expect to hold that fail when you can push arbitrary values back up-stream?
Are you asking for a written-up set of Pipe laws? I'm not aware of any, and I'd love to see one. The Category law would be broken, though: unawait x >>> id == yield x !== unawait x I suppose the additional Arrow laws, if they were transcribed to the pseudo-Arrow operations that Pipe supports, would be broken as well.