Choosing What to Export

By default, all of the top-level bindings that you define in a module are exported and available to any code that imports your module. This is convenient since it means that we can start writing modules without needing to think about what should or shouldn’t be visible to consumers of our module, but frequently we’d like to have more control over what we choose to export. For example, we might want to hide some functions we’ve written that shouldn’t be part of our public API. Export lists are a way to get fine-grained control over what is, and isn’t, exported from the modules that you define. In this section, you’ll learn how to use export lists to control what is visible to consumers of your module, and work through ...

Get Effective Haskell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.