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

On Friday 24 February 2006 16:38, Bulat Ziganshin wrote:
i personally prefer to have public/private modifiers on each function and gather interface documentation by tools like haddock
Me too. Ben

On 2/24/06, Benjamin Franksen
On Friday 24 February 2006 16:38, Bulat Ziganshin wrote:
i personally prefer to have public/private modifiers on each function and gather interface documentation by tools like haddock
Me too.
Maybe if you only had to specify which functions where public (whereas private is implied -- or maybe not even allowing it to save a keyword). But having to type one of "public" or "private" at each function site would get really tedious... /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862

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

Hello Claus, Friday, February 24, 2006, 7:53:09 PM, you wrote: CR> public class C a CR> where CR> public m1 :: a CR> private m2 :: a -> String please don't stop on this! public map (private f) (public (private x:public xs)) = private (public f (private x)) `public :` private map (public f) (private xs) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

And this
public foldr :: (a -> b -> b) -> b -> [a] -> b
public foldr f z [] = z
public foldr f z (x:xs) = f x (foldr f z xs)
or is it
public foldr :: (a -> b -> b) -> b -> [a] -> b
foldr f z [] = z
foldr f z (x:xs) = f x (foldr f z xs)
and now things aren't lined up.
Jared.
On 2/24/06, Bulat Ziganshin
Hello Claus,
Friday, February 24, 2006, 7:53:09 PM, you wrote:
CR> public class C a CR> where CR> public m1 :: a CR> private m2 :: a -> String
please don't stop on this!
public map (private f) (public (private x:public xs)) = private (public f (private x)) `public :` private map (public f) (private xs)
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
-- http://www.updike.org/~jared/ reverse ")-:"

In Cayenne it's: public foldr :: (a -> b -> b) -> b -> [a] -> b foldr f z [] = z foldr f z (x:xs) = f x (foldr f z xs) And I quite like it. :) -- Lennart Jared Updike wrote:
And this
public foldr :: (a -> b -> b) -> b -> [a] -> b public foldr f z [] = z public foldr f z (x:xs) = f x (foldr f z xs)
or is it
public foldr :: (a -> b -> b) -> b -> [a] -> b foldr f z [] = z foldr f z (x:xs) = f x (foldr f z xs)
and now things aren't lined up.
Jared.
On 2/24/06, Bulat Ziganshin
wrote: Hello Claus,
Friday, February 24, 2006, 7:53:09 PM, you wrote:
CR> public class C a CR> where CR> public m1 :: a CR> private m2 :: a -> String
please don't stop on this!
public map (private f) (public (private x:public xs)) = private (public f (private x)) `public :` private map (public f) (private xs)
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime
-- http://www.updike.org/~jared/ reverse ")-:" _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime

"Claus Reinke"
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@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/
participants (7)
-
Benjamin Franksen
-
Bulat Ziganshin
-
Claus Reinke
-
Jared Updike
-
Lennart Augustsson
-
Marcin 'Qrczak' Kowalczyk
-
Sebastian Sylvan