Lifting a pipe to work on tuples

98 views Asked by At

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?

1

There are 1 answers

3
Daniel Wagner On BEST ANSWER

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?