
On 31 January 2006 03:42, John Meacham wrote:
What do people think about seperating the class and type namespaces? one can always tell the difference syntactically which is meant, the only thing keeping them in the same space in jhc is an artificial check to ensure you don't create some of the same name.
the only issue is in export/import lists if you wanted to allow import/export of the type independently of the class. however the proposed explicit namespace change to the import/export syntax would solve this too and it is unlikely to actually be a problem in practice.
I've always liked the idea of saying 'class C' or 'type T' in import/export lists. It could be made backwards compatible: we allow types and classes to be named the same, but in this case the export list has to use the new syntax to disambiguate. The idea would be to transition to the new syntax eventually. There's a choice about whether a newtype should be exported with 'newtype T' or 'data T', or either. Cheers, Simon

"Simon Marlow"
I've always liked the idea of saying 'class C' or 'type T' in import/export lists.
Type signatures too should be allowed in export lists. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/

Marcin 'Qrczak' Kowalczyk
I've always liked the idea of saying 'class C' or 'type T' in import/export lists.
Type signatures too should be allowed in export lists.
Both ideas already noted at http://haskell.galois.com/trac/haskell-prime/wiki/ModuleSystem Regards, Malcolm

Marcin 'Qrczak' Kowalczyk
writes: Type signatures too should be allowed in export lists.
I'm all for type signatures, but I am slightly worried in that this leads to duplication of information (giving the signature both in the export list and at the place of definition). What about having "private/public" access modifiers at the points of definition instead, and removing export lists altogether? If we know beforehand what functions of what names and types a module *must* export (by design), in other words, if the intention is that the compiler checks whether the implementation matches the exported specification, then we should write an interface (i. e. unary type class) and declare an instance. Then the module should export nothing but the instance. The problem with this is that an interface says something about a type while a Haskell module might export many things (functions, types) at the same time. So there is in fact no formal "interface" concept for modules, leading to mis-use of qualified imports for that (import qualified My_Bar as Bar, when I know that My_Bar behaves "as a Bar"). So a Haskell module is more like a Java package than a Java class. On the other hand, it is recommended practice to define only one data type per module, isn't it? Respectfully submitted, -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- ---- http://www.imn.htwk-leipzig.de/~waldmann/ -------

On 2006-01-31, Johannes Waldmann
Marcin 'Qrczak' Kowalczyk
writes: Type signatures too should be allowed in export lists.
I'm all for type signatures, but I am slightly worried in that this leads to duplication of information (giving the signature both in the export list and at the place of definition). What about having "private/public" access modifiers at the points of definition instead, and removing export lists altogether?
Reexporting from sub-modules. -- Aaron Denney -><-

On the other hand, it is recommended practice to define only one data type per module, isn't it?
Only by very few people as far as I know. I know that Henning Thielemann advocates this, but it seems like a rather arbitrary restriction to me. I find it quite common to define several data types in a single module, so long as they're sufficiently related. Depending on how they are used, I may or may not export any one of them. Have a look at Basics.lhs in Haskore, then imagine separating that such that every one of those data types was in its own module. You'd end up with a lot of modules which only had one data type in them and nothing else. I think it's just better to use your own picture of how the project fits together to decide where to put things. Unless you're explicitly using modules for hiding data constructors, it doesn't seem necessary to structure your modules around your types. - Cale

Am Dienstag, 31. Januar 2006 13:40 schrieb Marcin 'Qrczak' Kowalczyk:
"Simon Marlow"
writes: I've always liked the idea of saying 'class C' or 'type T' in import/export lists.
Type signatures too should be allowed in export lists.
Shouldn't we also allow fixity declarations in export lists then? Best wishes, Wolfgang

On Tue, Jan 31, 2006 at 09:52:22AM -0000, Simon Marlow wrote:
There's a choice about whether a newtype should be exported with 'newtype T' or 'data T', or either.
I would think it would be 'type T' since the category should identify the namespace of what you are trying to export rather than what it is. you certainly don't want to have to change import (data T) to import (newtype T) when the implementation changes :) the namespaces I can think of are class,type,value,kind,method,field though, probably class,type,value and kind will be the only useful ones. and 'value' could be the default if nothing is specified. I like the idea of doing this too because it also gives a place to attach other extensions to, like 'closed class Foo' if we decide we like closed classes. John -- John Meacham - ⑆repetae.net⑆john⑈
participants (8)
-
Aaron Denney
-
Cale Gibbard
-
Johannes Waldmann
-
John Meacham
-
Malcolm Wallace
-
Marcin 'Qrczak' Kowalczyk
-
Simon Marlow
-
Wolfgang Jeltsch