public/private module sections (was: Haskell-prime Digest, Vol 2, Issue 58)

Claus Reinke claus.reinke at talk21.com
Fri Feb 24 11:53:09 EST 2006


> > > i personally prefer to have
> > > public/private modifiers on each function and gather interface
> > > documentation by tools like haddock
> > Me too.

>having to type one of "public" or "private" at each
>function site would get really tedious...

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! 

also remember that you'd need to add "public" and "private"
to more than just function definitions:

public class C a 
    where
        public m1 :: a
        private m2 :: a -> String

public infixl :@
private infixl :@@ -- internal applications

public data Expr a = public Var a
                              | Expr a (public :@)  Expr a
                              | Expr a (private :@@) Expr a
                             deriving (private Show, public Eq)

private data Rec a = public Rec{ private distance :: a
                                                , public x :: a
                                                , public y :: a}
                                deriving (public Show)

private -- please, no!!!!!-)        

the nice thing about Haskell syntax is that is is fairly "quiet",
there isn't much that doesn't have to be there or could distract
from the essentials of the code. please, let's keep it that way.

cheers,
claus



More information about the Haskell-prime mailing list