As others commented, channel merging has a lot of semantics.
I know that in pipes-core (the fork of the Paolo Capriotti library of Gabriel González pipes , which is another implementation of iterations like conduit ), there is a very common code for monoidal and multiplicative categories.
http://hackage.haskell.org/packages/archive/pipes-core/0.1.0/doc/html/Control-Pipe-Category.html#t:PipeC
For example, using PipeC , a new type that moves type variables around to make PipeC mr valid category, we can multiplex sets of independent signals like Either s.
You also have something like sequence that applies to a Monad instance.
sequence :: [ma] -> m [a]
which will alternate different pipes "vertically" (one starts then the next), allowing us to write something like (using Control.Pipe.Pipe from the Gonzalez pipes package)
takeNPipe :: Int -> Pipe abm [a] takeNPipe n = sequence (replicate n await)
The type you request implies both of these types of "merge" at the same time. This (I believe) is impossible, since you want to use both parallel (multiplexed) and serial (vertical) composition at the same time.
source share