I need to think a little more about the semantic stuff, but regarding syntax I
have two strong opinions.
Re: Allow a type and a class to have the same name
I agree with Ralf on this, and just as strongly. Maybe it is bad style to
name a class the same as a type, but should the language enforce such a
style? Of course not. It's always possible to write obscure programs. And
besides, it is slightly bizarre for types and classes to be the only
namespaces in the set of Haskell namespaces that are forced to be disjoint by
mandate, rather than lexical distinctions (uppercase vs. lowercase).
Re: Remove concept of "special identifier"
I think all these ideas are silly: 1) to create a whole new syntactic category
for "hiding" and "qualified"; 2) to swipe the identifier "hiding" from the
namespace, when it is so rare to hide an imported identifier; 3) to make it
easier to import an unqualified identifier than it is to import a qualified
identifier, when it is the wrong thing to do 90% of the time.
The convention should be reversed: by default, a module import is qualified.
That eliminates the need for both "qualified" and "hiding". You can rename
your identifiers explicitly, as God intended.
import T = MyModule
f = T.f
g = T.g
If MyModule has a lot of identifiers that I want to use in an unqualified way,
then I have to write a lot of equations. And so be it, because... (drum roll
please)... the more identifiers a module exports, the more reasons you have to
qualify it!
Note that this is a huge simplification, there is no loss in expressiveness,
it promotes good style without bullying the user, and it encourages program
scalability.
As for the Prelude, well, if you ask me, it should be imported explicitly too,
but imagining a hundred or so invisible equations at the top of every module
is not much harder than imagining one invisible "import Prelude" there.
(Maybe the thought of that is frightening enough to shock someone into
muzzling that beast.) The only problem is how to hide a prelude identifier...
BTW, while I'm on the soapbox, I might as well mention something else that has
always bothered me (and has no hope of making it into Haskell 98), the
"module" syntax. It looks like a function between namespaces, but it works in
just the opposite fashion. module M(A,B,C) looks like A, B and C are
arguments, but they're more like return values. Isn't this syntax more
sensible?:
module M (...imports...) = (...exports...)
where
...
for example:
module Hash (module List, module T = MyModule)
= (data Tbl, make, add, remove, lookup)
where
data Tbl = ...
or even:
Hash (module List, module T @ MyModule)
= module (data Tbl, make, add, remove, lookup)
where
data Tbl = ...
OK, the @ is probably taking the analogy too far but I couldn't resist... :)
--
Frank A. Christoph
[EMAIL PROTECTED]