cafe,

Data Constructors and Type Constructors don't share the same
namespace. You see code like the following all the time:

> data MyRecord = MyRecord {...}

This is possible because Data Constructors are used in different parts
of the code than Type Constructors so there's never any ambiguity.

Type Classes, on the other hand, share the same namespace as Type
Constructors. You can't define this:

>class String s where
>    ...
>
>instance String String where
>    ...
>instance String ByteString where
>   ...
>instance String Text where
>   ...

Not that I'm running out of valid haskell identifiers or anything :P,
I'm just wondering: what's the rationale behind keeping Type Classes
and Type Constructors in the same namespace? I can't think of any
ambiguity there would be if they each had their own namespace. And In
some cases it would be convenient to be able to define both a concrete
representation and an abstract one with the same name as in the String
class example above.

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

Reply via email to