[Haskell-cafe] How to split (or not split) modules

Clinton Mead clintonmead at gmail.com
Thu Aug 24 02:00:18 UTC 2017


Given that one can write modules that just do reexports to control
namespaces, it seems to me you've got a lot of flexibility about how you
organise your actual code into modules. As long as mutually recursive
functions are in the same module and instances are not orphan, you can go
from the one extreme of placing all the code on one module to the other
extreme of placing each function in a separate module. I believe any
performance concerns regarding inlining can be addressed with explicit
inline annotations.

I can see the point of not having non exported functions in their own
module, because to do so would mean producing extra interface code which is
never directly used by clients.

But other than the concerns mentioned above, I can't really work out
whether to have all my code for a package in one module and split it with
re-export modules, or have it in lots of little modules and combine it with
re-export modules.

Any guidance with the pros/cons of both approaches would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170824/eaed6a36/attachment.html>


More information about the Haskell-Cafe mailing list