Haskell modules group related definitions and control which names other modules can see. An export list follows the module name and names the definitions made available to importers. section 2.1.3
Use imports and exports to connect modules without exposing every definition:
- Write an export list such as `(someFunc)` after the module name to expose selected definitions. section 2.1.3
- Use `import Lib` to bring in definitions listed by `Lib`; without an export list, the module imports everything. section 2.1.3
- Resolve clashing names by qualifying them with the module name, as in `ModuleName.x`. section 2.1.3
- Use module re-exports to present several related modules through one import. section 7.4.2
Expose a function from Lib
Define `someFunc` in `Lib` and export it with `module Lib (someFunc) where`. Then write `import Lib` in `Main` and call `someFunc` from `main`. The export list makes the function available to the importing module.
Listing 7.15 A re-export of modules
module Csv
( module Csv.Conversion, #1
module Csv.Types,
)
where
import Csv.Conversion #2
import Csv.Types
A top-level `Csv` module re-exports `Csv.Conversion` and `Csv.Types`, allowing clients to import one module for related CSV definitions. section 7.4.2




