On Mon, Feb 16, 2009 at 2:30 AM, wren ng thornton <w...@freegeek.org> wrote:
> Louis Wasserman wrote:
>>
>> I follow.  The primary issue, I'm sort of wildly inferring, is that use of
>> STT -- despite being pretty much a State monad on the inside -- allows
>> access to things like mutable references?
>
> That's exactly the problem. The essential reason for ST's existence are
> STRefs which allow mutability.
>
I'd like to point out one other thing that ST provides, which is often
forgotten. It provides *polymorphic* references. That is, we can
create new references of any type.

So ST is a really magical beast. Not only does it provide mutation, it
also provides mutable references. And these are two different
features. Now, everyone agrees that mutation is not something that you
can implement in a functional language, so ST cannot be implemented in
Haskell for that reason. It has to be given as a primitive. But what
about polymorphic references? Can they be implemented in Haskell? The
Claessen conjecture (after Koen Claessen) is that they cannot be
implemented in Haskell. See the following email for more details:
http://www.haskell.org/pipermail/haskell/2001-September/007922.html

One could try and separate mutation and polymorphic references and
give them as two different primitives and implement ST on top of that.
But I haven't seen anyone actually trying that (or needing it for that
matter).

Cheers,

Josef
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to