Hello.

I have next problem: I have a network client that connects to server, listens for messages and generate responces. So the control flow can be represended as:

server -- input -> {generate output} -> output

Output can be generated using default implementation or can overriden by user.

The main difficulty appeares when I need to add a user program on the top of this logic,
i.e. from user-side I want to have dsl:smth like

withClient $ do
   x <- send message
   waitFor x
   timeout 5000000
   forever $ sendRandomMessage

i.e. an ability to send messages, waiting for some event (message to come), waiting for
timeout.

The question is how to define such logic without a big overhead. I see a solution using conduit, it's possible to create 3 processes: listener, user, sender.

                         +----> user ----+
                         |                    |
-input -> listener +----------------->+---- sender ->

and use TQueue or TChan to send messages between them, however there can be another possible solutions, that uses less resources, or another design.


--
Alexander