STArray and Lazy ST

Alastair Reid alastair@reid-consulting-uk.ltd.uk
Fri, 9 May 2003 11:24:26 +0100


On Friday 09 May 2003 10:23 am, Simon Marlow wrote:
> Perhaps the real source of the problem is that the lazy ST monad is
> called ST?  Ok, so that's just blaming the library again, but the fact
> that two different types have the same name is bound to lead to
> confusion.

I think we gave them the same name so that it would be easy to switch back and 
forth between the lazy and strict monads.  Almost the same effect can be 
achieved using type synonyms though it's not clear that being able to switch 
back and forth is as useful as we originally thought it would be.

The other factor here is that when the library was designed, qualified names 
were a new feature and, based on experience from other languages, we thought 
that one of two things would happen:

1) Qualified names would be used routinely rather than being reluctantly used 
only to resolve ambiguity.  I guess we ignored the premium that Haskell 
programmers place on concision.

2) Haskell programmers happily accept that an expression like "1+2" can't be 
understood without knowing additional contextual information (i.e., the type 
the expression is used at).  It seemed plausible that they'd use unqualified 
names in the same spirit.  I think this didn't happen because the 'ambiguity' 
intrioduced by type classes brings you additional flexibility but Haskell's 
module system doesn't add much extra flexibility (because we have nothing 
corresponding to ML-style functors).

Which is a long way of saying that, in the absence of a more flexible module 
system, renaming the lazy st monad seems sensible.

--
Alastair Reid