concurrency (was Re: important news: refocusing discussion)

Malcolm Wallace Malcolm.Wallace at
Tue Mar 28 05:05:03 EST 2006

"Simon Marlow" <simonmar at> wrote:

> >> The portable interface could be Control.Concurrent.MVar, perhaps.
> I don't really understand the problem, maybe I'm missing something.  I
> thought the idea would be that a thread-safe library would simply use
> MVar instead of IORef.

I was misled by several people's hand-waving assertion that, provided
you used MVars "correctly", there would be no synchronisation problems.
But no-one had yet defined what "correct" meant.  I kind of assumed they
meant you could write concurrent threaded code (with only some minor
restrictions) and have it work in a single-threaded implementation
without change.  This seemed like a pretty strong (and dubious) claim to

But now I see you are actually saying something quite different.  (And I
recall some discussion on these points from a few months ago.)

  * IORef is inherently thread-unsafe, and so we should eliminate IORefs
    from the language.

  * One can write single-threaded code using MVars instead of IORefs,
    and it will be safe on a multi-threaded implementation.

The latter point is quite the opposite of what I thought was being


More information about the Haskell-prime mailing list