1
votes

Reading John Hughes's Generalising monads to arrows, I understand that arrows can be used to represent and combine stream processors with a single input and a single output. It is also possible to represent multiple inputs and outputs using pairs, or using ArrowChoice.

However, using a pair means the input is a stream of pairs, which isn't enough to express processing streams that arrive at difference rates. ArrowChoice is able express that, but it "multiplexes" the two streams in a single one.

I'm looking for a way to combine streams with multiple inputs and multiple outputs, while still being able to distinguish between the case where the streams are multiplexed and the case of separate streams.

Is that possible?

1

1 Answers

0
votes

Maybe you could use the These type (from here) which is defined as :

data These a b = This a | That b | These a b

This way you could express that you are receiving one stream, or the other, or both.