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

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Feb 24 09:23:54 EST 2006


Hello Claus,

Friday, February 24, 2006, 2:46:40 PM, you wrote:

CR> yes, this would add one constraint on where to place definitions. but
CR> grouping logically related definitions together is not quite what one 
CR> might think anyway: aren't the definitions making up the interface
CR> most strongly related, with the others just changeable auxiliaries?

so:

-- |iterate function over list
map :: (a->b) -> [a] -> [b]

-- |find length of list
length :: [a] -> Int

private:

map f (x:xs) = f x : map f xs
map f []     = []

length xs = length# xs 0#

length# (x:xs) n# = length# xs (n# +# 1)
length# []     n# = n#


and in order to see map's type or comment when i implement it, i
should see to other part of file. i personally prefer to have
public/private modifiers on each function and gather interface
documentation by tools like haddock


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-prime mailing list