[Haskell] Re: ST/STRef vs. IO/IORef
Till Mossakowski
till at informatik.uni-bremen.de
Fri Aug 5 05:55:52 EDT 2005
Remi Turk wrote:
> Ah, I think I understand what we're disagreeing about exactly
> now. We're understanding "primitive" to mean different things :)
>
> You're seeing runST, newSTRef, writeSTRef etc as primitives, is
> that correct? I see them as the public interface to something
> which is implemented in something else.
The advantage of seeing runST, newSTRef, writeSTRef etc as primitives
is that there is a denotational semantics for them (see Laucnbury/
Peyton Jones: "State in Haskell"), which coincides with the operational
semantics. This is not the case for unsafePerformIO. unsafePerformIO
is a purely operational primitive, although some uses of unsafePerformIO
can a posteriori (and usually with a lot of handwaving) shown to
behave in a good (denotational) way. The ghc file you cite should be
regarded as operational detail, not as a language definition of
runST, newSTRef, and writeSTRef.
> Remi "We're probably agreeing 99.9% anyway" Turk
Yes, of course.
Till
--
Till Mossakowski Phone +49-421-218-4683
Dept. of Computer Science Fax +49-421-218-3054
University of Bremen till at tzi.de
P.O.Box 330440, D-28334 Bremen http://www.tzi.de/~till
More information about the Haskell
mailing list