I have a sum type which looks like this:
data Signal e c p = SigEvent e | SigCommand c | SigPacket p
I would like the user to be able to provide functions:
type Handler p p' m = Pipe p p' m ()
> data Mode p p' e c m = Mode
> { handlePacket :: Handler p p' m
> , handleEvent :: Handler e p' m
> , handleCommand :: Handler c p' m }
and have my single input pipe (dispatcher :: Pipe (Signal e c p) p' m ())
fork between the three handlers, while preserving the state of each. ie,
one handling commands may use `await` but the next packet could be an
event, so it would stay in await until a command arrives. One handler pipe
quitting/finishing should result in all quitting.
I would not like intermediate containers or forking threads to be part of
the solution, since it will be a tight loop.
Ideally, I need something like `next` which can be called in the other
direction. Ideas?
--
You received this message because you are subscribed to the Google Groups
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].