List of exports of a module - are there alternatives?

Hi, When we want to list which declarations are exported by a module we do: module Mod ( list of exports ) where ... Are there propositions to alternatives to that (I could not find one)? Like, say, add a "do export" or "do not export" tag to declarations we want to (not) export? (I think something like that could be nice when we have modules with 200 declarations and just a few are (not) going to be exported.) Thanks, Maurício

I think that it's not nice to export 200 declarations from a single module. On 12 May 2009, at 18:05, Maurício wrote:
Hi,
When we want to list which declarations are exported by a module we do:
module Mod ( list of exports ) where ...
Are there propositions to alternatives to that (I could not find one)? Like, say, add a "do export" or "do not export" tag to declarations we want to (not) export?
(I think something like that could be nice when we have modules with 200 declarations and just a few are (not) going to be exported.)
Thanks, Maurício
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Tue, May 12, 2009 at 10:05 AM, Maurício
(I think something like that could be nice when we have modules with 200 declarations and just a few are (not) going to be exported.)
Thanks, Maurício
Uh, show me such a module, and I'll show you a module that's quite bloated and desperately needs to be refactored.

"Andrew" == Andrew Wagner
writes:
Andrew> Uh, show me such a module, and I'll show you a module Andrew> that's quite bloated and desperately needs to be Andrew> refactored. How about a module that provides the official Unicode names for each character? -- Colin Adams Preston Lancashire

I would like to see this too. Maybe just a private keyword that would
make everything after it invisible to the outside (or until a public
keyword appeared)?
On Tue, May 12, 2009 at 10:05 AM, Maurício
Hi,
When we want to list which declarations are exported by a module we do:
module Mod ( list of exports ) where ...
Are there propositions to alternatives to that (I could not find one)? Like, say, add a "do export" or "do not export" tag to declarations we want to (not) export?
(I think something like that could be nice when we have modules with 200 declarations and just a few are (not) going to be exported.)
Thanks, Maurício
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

I would like a keyword we could add to a single declaration, like: hidden a :: Int -> Int a = (...) The 200 names is not the best example. It's more a question of proportion: if you export 5 declarations in a module with 20, it's OK, but if you export 19 declarations in a module of 20 maintenance can be painfull to your eyes, going up and down into your file to check if the list is correct. Maurício
I would like to see this too. Maybe just a private keyword that would make everything after it invisible to the outside (or until a public keyword appeared)?
Are there propositions to alternatives to that (I could not find one)? Like, say, add a "do export" or "do not export" tag to declarations we want to (not) export?
(I think something like that could be nice when we have modules with 200 declarations and just a few are (not) going to be exported.)

Maurício wrote:
I would like a keyword we could add to a single declaration, like:
hidden a :: Int -> Int a = (...)
The 200 names is not the best example. It's more a question of proportion: if you export 5 declarations in a module with 20, it's OK, but if you export 19 declarations in a module of 20 maintenance can be painfull to your eyes, going up and down into your file to check if the list is correct.
It sounds like what you (may) want is a refactoring browser which can annotate definitions for whether they're exported or not. This would solve the maintenance issue without the need for a language change. I don't know whether Leksah[1] or Yi[2] can do this, but if not it should be easy to add and it's a reasonable feature to request. Everyone agrees that the module system in Haskell98+HierarchicalModules is the weakest thing we could get away with at the time, and also that it's in need of serious redesign now that we have large scale projects which are straining those boundaries. However, as with the other folks on this thread, I don't think that a new keyword is the proper path for extending the design. Too ad-hoc, too Java/C++ like, it just doesn't have the feel of a fluent, principled, modular, extensible design. [1] http://leksah.org/ [2] http://www.haskell.org/haskellwiki/Yi -- Live well, ~wren

Maurício wrote:
Hi,
When we want to list which declarations are exported by a module we do:
module Mod ( list of exports ) where ...
Are there propositions to alternatives to that (I could not find one)? Like, say, add a "do export" or "do not export" tag to declarations we want to (not) export?
Unfortunately, I don't think so. Which is a shame, as I do sometimes find myself wanting: module Mod hiding (someInternalHelperFunction) where which would seem to logically fit (we have explicit lists and hiding for import, why not both for export?). Leaving aside the arguments about 200 exports, even for 20 exports it would sometimes be cleaner to write the above to hide one, than to spell out the other 19 in an export list. Neil.

Neil Brown wrote on 13.05.2009 14:23:
Leaving aside the arguments about 200 exports, even for 20 exports it would sometimes be cleaner to write the above to hide one, than to spell out the other 19 in an export list.
Note that Haddock orders exports according to the export list, not to an order of definition. Also, you can have (sub)sections in documentation using an export list only. Therefore, it's still better to have an export list, even if you export 19 functions and hide one.

Miguel Mitrofanov schrieb:
Neil Brown wrote on 13.05.2009 14:23:
Leaving aside the arguments about 200 exports, even for 20 exports it would sometimes be cleaner to write the above to hide one, than to spell out the other 19 in an export list.
Note that Haddock orders exports according to the export list, not to an order of definition. Also, you can have (sub)sections in documentation using an export list only. Therefore, it's still better to have an export list, even if you export 19 functions and hide one.
You can move the few non-exported functions to a hidden module. (hope there are no dependencies on exported functions)
participants (8)
-
Andrew Wagner
-
Colin Paul Adams
-
Daniel Peebles
-
Henning Thielemann
-
Maurício
-
Miguel Mitrofanov
-
Neil Brown
-
wren ng thornton