How to split (or not split) modules

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

How to split (or not split) modules

Clinton Mead
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.

Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.