[Haskell-cafe] How to make asynchronous I/O composable and safe?

Daniel Waterworth da.waterworth at gmail.com
Sat Jan 14 14:33:48 CET 2012

Hi Peter,

streamproc is a very interesting package, I'll surely use it somewhere
in the future. However, I'm not convinced that this solves my
immediate problem, but perhaps this is due to my inexperience with
arrows. My problem is:

I have a number of network connections and I have a system that does
things. I want the network connections to interact with the system. I
also want the system to be able to interact with the network
connections by way of a pub/sub style message bus.

The only way I can see stream processors working in this scenario is
if all of the events of the system are handled in a single thread. The
events are then pushed into the stream processor and actions are
pulled out. This isn't acceptable because the amount of logic in the
stream processor will be fairly small for my problem in comparison
with the logic that is required to mux/demux events/actions onto
sockets. It's also a problem that there's a single threaded


On 14 January 2012 11:58, Peter Simons <simons at cryp.to> wrote:
> Hi Daniel,
>  > I've been trying to write networking code in Haskell too. I've also
>  > come to the conclusion that channels are the way to go.
> isn't a tuple of input/output channels essentially the same as a stream
> processor arrow? I found the example discussed in the "arrow paper" [1]
> very enlightening in that regard. There also is a Haskell module that
> extends the SP type to support monadic IO at [2].
> Take care,
> Peter
> [1] http://www.ittc.ku.edu/Projects/SLDG/filing_cabinet/Hughes_Generalizing_Monads_to_Arrows.pdf
> [2] http://hackage.haskell.org/package/streamproc
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list