Export lists in modules

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Feb 22 09:53:31 EST 2006


"Simon Peyton-Jones" <simonpj at microsoft.com> wrote:

> | I don't seriously propose for haskell-prime that signatures should
> | be required on exports.  Just permitting them would be a large and
> | useful step up already. 
> 
> If this is to be a serious proposal, someone had better think what to
> do about classes, data types, instances and so on.

As far as I can see, there is very little to change.  Here is a concrete
proposal.  A qvar in an export list may optionally have a type
signature.  A qtycon or qtycls in an export list may optionally have an
annotation saying whether it is a type, newtype, data, or class.
Instances cannot be mentioned in export lists, and this does not change.

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

becomes

    export  -> qvar [ :: type ]
            |  [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

As far as import entity lists are concerned, we permit an optional
annotation for type synonyms, newtypes, datatypes, and classes:

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

becomes
 
    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)

Anyone see any difficulties?

Regards,
    Malcolm


More information about the Haskell-prime mailing list