[Haskell-cafe] Unexported functions are evil

Ketil Malde ketil+haskell at ii.uib.no
Sun May 15 06:42:55 EDT 2005


Peter Simons <simons at cryp.to> writes:

> The only reason I could think of is that a function is
> considered to be "internal", meaning: You don't want users
> of the module to rely on the function still being there (or
> still working the same way) in any of the next revisions.

Right.

(I guess you could sometimes have name clashes as well?)

You could also view if from the opposite angle: when I work on a
module, it is nice to check the export list to see what parts I need
to maintain consistently, and what parts I am at liberty to change.

> On those occasions, however, why not put the function into a
> module, say "Foo.Bar.Private" and import it into "Foo.Bar"
> from there?

So you don't want to automatically re-export imports, I take it? :-) 

> Then those people who enjoy playing with fire
> _can_ use it, and everybody else will not.

> Is there something I missed?

An opportunity to ignore export restrictions would be very useful for
testing. It is nice to put tests into a separate module, but sometimes
you really need access to "internals" as well.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants



More information about the Haskell-Cafe mailing list