public/private module sections

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Mon Feb 27 19:07:22 EST 2006


"Claus Reinke" <claus.reinke at talk21.com> writes:

> you mean as in "public static void main(String[] args) { ..}"
> instead of "main args = .."?-) there are such languages, and
> I'm happy to say Haskell isn't one of them!

In my language Kogut the default everywhere (modules, objects) is
public. I don't care what information hiding extremists would say.
It's not painful if the default is public :-)

There are definitions to override this:
   private {definitions}
   public {definitions}
   private => definitions
   public => definitions
patterns:
   private pattern
   public pattern
names:
   private name
   public name
or alternatively Haskell-style module headers.

There is also 'use' (Haskell's 'import') and 'reexport' (Haskell's
'import' but imported names are made public).

I found myself using primarily 'private' on individual names,
or module headers if the module export list is very short,
or rarely 'private' over a region of definitions.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Haskell-prime mailing list