Search code examples
haskellhaskell-pipes

Lifting a pipe to work on tuples


I need a function with type Pipe a b m r -> Pipe (a, c) (b, c) m r.

But no matter how much I play with for, ~> or >~; I can not match the types properly.

Can you help me?


Solution

  • I don't think it's possible in general. Suppose we did manage to write it:

    hypotheticalLift :: Pipe a b m r -> Pipe (a, c) (b, c) m r
    

    What behavior should hypotheticalLift (yield b) have? Presumably it should be the same as yield (b, c) for some c -- but which c, and why?