[Haskell-cafe] ANNOUNCE: pqueue-mtl, stateful-mtl
josef.svenningsson at gmail.com
Mon Feb 16 08:44:21 EST 2009
On Mon, Feb 16, 2009 at 2:30 AM, wren ng thornton <wren at 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:
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
More information about the Haskell-Cafe