
| 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. Simon

"Simon Peyton-Jones"
| 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

On Wednesday 22 February 2006 15:53, Malcolm Wallace wrote:
"Simon Peyton-Jones"
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

On 2006-02-22 at 17:31+0100 Georg Martius wrote:
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.
Why not? Surely redundancy is a good thing, provided that it is checked by the compiler? It's certainly not going to be /required/ to put it in both places. I can't think of why off-hand, but it seems conceivable that one might want to use a function polymorphically within a module but export a monomorphic version. -- Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk

On Wed, Feb 22, 2006 at 04:38:57PM +0000, Jon Fairbairn wrote:
I can't think of why off-hand, but it seems conceivable that one might want to use a function polymorphically within a module but export a monomorphic version.
This would be tricky, functions have different representations depending on their type, they would effectivly be different entities with the same name which would cause a whole host of complications. (for instance does Self.foo refer to the polymorphic or monomorphic version). I would think that if multiple type signatures were allowed, they would need to be identical. (modulo beta blah) John -- John Meacham - ⑆repetae.net⑆john⑈

Dear all, Malcolm wrote:
As far as I can see, there is very little to change. Here is a concrete proposal. [...] Anyone see any difficulties?
Georg asked:
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.
I'd in principle welcome the possibility to write type signatures in export lists. (I often write them there anyway, but as comments). But I admit I have not thought about what the caveats might be. If type signatures in export lists are allowed, I would hope it would be possible to put a type signature next to the actual definition as well, though, unless that would be terribly complicated for some reason (in which case I'd personally stick with the unannotated export list). /Henrik -- Henrik Nilsson School of Computer Science and Information Technology The University of Nottingham nhn@cs.nott.ac.uk This message has been checked for viruses but the contents of an attachment may still contain software viruses, which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
participants (6)
-
Georg Martius
-
Henrik Nilsson
-
John Meacham
-
Jon Fairbairn
-
Malcolm Wallace
-
Simon Peyton-Jones