Export lists in modules

Georg Martius mai99dgf at studserv.uni-leipzig.de
Wed Feb 22 11:31:40 EST 2006


On Wednesday 22 February 2006 15:53, Malcolm Wallace wrote:
> "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?
No, but one question: If the type signature is given in the export lists, is 
it then necessary (or even allowed) later on?
I would vote for _not_ having it twice in the file.

Cheers,
	Georg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell-prime/attachments/20060222/a0e49a04/attachment.bin


More information about the Haskell-prime mailing list