[Haskell] Per-type function namespaces (was: Data.Set whishes)

Keith Wansbrough Keith.Wansbrough at cl.cam.ac.uk
Thu Feb 26 16:47:30 EST 2004


> I've had an idea stewing in my head to do with per-type function 
> namespaces, that the current module namespace discussion reminded me 
> about.  The problem is that there is a limited namespace for functions, 
> so that if you define a new data type, it is unwise to call functions 
> which work on that data type a very generic name such as 'add'.
[..]
> The idea that I've been throwing around is to be able to define a 
> separate namespace for each type; a function can either belong in a 
> "global" (default) namespace, or belong in a particular type's 
> namespace.

This feature would seem to be in competition with type classes; could
you elaborate on the relative advantages and disadvantages?  The type
class story has the advantage of being well understood and quite
effective, but there are certainly some limitations too.

--KW 8-)



More information about the Haskell mailing list