On Fri, Oct 06, 2000 at 02:15:17AM -0700, Simon Peyton-Jones wrote:
: Your example below isn't very compelling (i.e. I wouldn't mind
: losing the expressive power you exploit).  And something in me
: dislikes the idea of exposing RealWorld as a type to the programmer.

I guess my example isn't compelling because you have already added mutable
variables to the IO monad.  And would you feel less queasy if it were
called something like MainStore?  After all, it refers to a region of
the heap, rather than the full IO environment.  With a primitive

> stToIO :: ST MainStore a -> IO a

we could define

> type IORef = STRef MainStore
> newIORef v = stToIO (newSTRef v)
> readIORef r = stToIO (readSTRef r)
> writeIORef r v = stToIO (writeSTRef r v)
> eqIORef = eqSTRef

and so on.  This is pretty much what the GHC libraries do, but I think
that exposing it would present a simpler picture, as well as making it
possible to use ST code directly on IORef's.

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to