wiki:TagExportsWithNamespace

Version 1 (modified by malcolm.wallace@…, 8 years ago) (diff)

--

Tag exported entities with their namespace

In export and import lists, it is easy to distinguish functions from types/constructors/classes, because they are lexically different - vars begin with lower-case, the rest with upper-case. However, it is much more difficult to distinguish types, from constructors, from classes.

Proposal

Each type or class constructor in an import or export list can be (optionally) annotated with its namespace, e.g.

import Foo (class Foo (Foo,Bar), data Baz())

Grammar changes

The production for exported entities changes from

    export  -> qvar
            |  qtycon [ (..) | ( cname_1, ... , cname_n ) ]	(n>=0)
            |  qtycls [ (..) | ( var_1, ... , var_n ) ]		(n>=0)
            |  module modid

to

    export  -> qvar
            |  [type]    qtycon
            |  [newtype] qtycon [ (..) | ( cname_1, ... , cname_n )	(n>=0)
            |  [data]    qtycon [ (..) | ( cname_1, ... , cname_n )	(n>=0)
            |  [class]   qtycls [ (..) | ( var_1, ... , var_n )		(n>=0)
            |  module modid

and that for imported entities from

    import  -> var
            | tycon [ (..) | ( cname_1, ... , cname_n ) ]	(n>=0)
            | tycls [ (..) | ( var_1, ... , var_n ) ]		(n>=0)

to

    import  -> var
            | [type]    tycon
            | [newtype] tycon [ (..) | ( cname_1, ... , cname_n ) ]	(n>=0)
            | [data]    tycon [ (..) | ( cname_1, ... , cname_n ) ]	(n>=0)
            | [class]   tycls [ (..) | ( var_1, ... , var_n ) ]		(n>=0)