Simon Peyton-Jones simonpj at
Thu Sep 18 09:56:40 EDT 2003

| > I could be a bit out of date but I think Hugs uses different
| > because IO has concurrency and exceptions and ST doesn't.  Apart
from effort
| > required, I don't know if there is any cost in switching.
| I think IORef and STRef have both been MUTVAR as far back as I can
| The IO and (strict) ST monads used to be very different, and no longer
| are (so they both use the same state primitives now), but I don't
| this affects the IORef = STRef IOState question.

I'm a bit confused here.

Is the proposal that the library design exposes to the programmer the
following type synonyms:

	type IO a = ST IORegion a
	type IORef a = STRef IORegion a

I think it is sound to do so.  The advantage would be that newIORef and
newSTRef would be the same (newRef, perhaps); ditto readRef, writeRef

I think this would be fine for GHC.  It might not be fine for Hugs
because they implement IO and ST differently I think.  No idea about

Or, alternatively, is the question something to do with the internals of
the library, of interest to implementers but not to users of the
library?  Or is it just to do with the type of stToIO, which should be

	stToIO :: ST IORegion a -> IO a


More information about the Libraries mailing list