STArray and Lazy ST

Simon Marlow simonmar@microsoft.com
Fri, 9 May 2003 10:23:35 +0100


=20
> I would say that the 'bug' is that Data.Array.ST does not export ST.
>=20
> GHC's policy is to report error messages in the same vocabulary as the
> user would use.  Even though you have imported=20
> Control.Monad.ST.Lazy and
> Data.Array.ST, you can still say "ST" unambiguously, because
> Control.Monad.ST.Lazy exports ST, but Data.Array.ST does not -- so
> there's only one ST in scope.
>=20
> If you imported only Data.Array.ST you wouldn't be able to=20
> mention "ST"
> at all.
>=20
> If Data.Array.ST exported ST, the error message would give a qualified
> name for the ST constructor -- qualified by one of its import modules,
> that is.
>=20
> I'll ask Simon M if we should export a bit more from=20
> Data.Array.ST, but
> actually I think the compiler is behaving right.  It'd be=20
> pain if every
> error message used fully-qualified names!

Exporting ST from Data.Array.ST looks like the wrong fix to me.  It's
fixing a tools problem by changing the library interface - we'd have to
do it each time this issue came up.

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.

Cheers,
	Simon