[Haskell-cafe] Are explicit exports and local imports desirable in a production application?

MarLinn monkleyon at gmail.com
Wed Sep 16 20:40:37 UTC 2020


> * That explicit exports are never necessary. Moreover, that explicit
> exports are harmful as they make checking of non-exported definitions
> impossible.


It's not just the internal API in the form of constructors that's worth 
hiding. What about helper functions? The ones that would be "private" in 
an OOP language? Should I rip my logical structure apart just because 
exports are tedious?

In fact the OOP separation is a decent framework to reference for 
perspective:

public → (explicitly) exported
private → not exported at all
package protected → exported from internal module
protected → not directly controlled by exports, but by types and 
available construction paths

All have an equivalent, all are necessary.

But I agree that explicit exports are flawed, because the vast majority 
of "stuff" is usually exported. A better way might be to export 
everything except explicitly hidden stuff. That's not possible right now 
(I think), but imagine syntax like this:

     module Foo (..) hiding ( bar, baz ) where

or

     module Foo (module Foo hiding ( bar, baz )) where



More information about the Haskell-Cafe mailing list