Multithreaded stateful software

Manuel M. T. Chakravarty
Tue, 29 May 2001 14:15:58 +1000

Mark Carroll <> wrote,

> One of the projects I have coming up is a multi-threaded server that
> manages many clients in performing a distributed computation using a
> number of computers. So, we care about state, and control flow has some
> concurrent threads and is partially event-driven.
> Some possibilities come to my mind:
> (a) This really isn't what Haskell was designed for, and if I try to write
> this in Haskell I'll never want to touch it again.
> (b) This project is quite feasible in Haskell but when it's done I'll feel
> I should have just used Java or something.
> (c) Haskell's monads, concurrency stuff and TCP/IP libraries are really
> quite powerful and useful, and I'll be happy I picked Haskell for the
> task.

In my experience features such as Haskell's type system and
the ease with which you can handle higher-order functions
are extremely useful in code that has to deal with state and

I guess, the main problem with using Haskell for these kinds
of applications is that relatively little has been written
about them yet.  SimonPJ's paper "Tackling the awkward
squad" and SimonM's Web server improved the situation, but,
for example, none of the Haskell textbooks covers these
features.  Nevertheless, there are quite a number of people
now who have used Haskell in ways similar to what you need.
So, don't hesitate to ask on this or other Haskell lists if
you have questions or need example code.