| Start |
|---|
| Defining Your Own Module If we have a file called A deeper hierarchy is of course possible; see the Hierarchical module names (opens new window) example. |
| Exporting Constructors To export the type and all its constructors, one must use the following syntax: So, for the following top-level definitions in a file called This module declaration at the top: would only export If the export list following the module keyword is omitted, all of the names bound at the top level of the module would be exported: would export |
| Importing Specific Members of a Module Haskell supports importing a subset of items from a module. would only import otherwise the compiler will try to use |
| Hiding Imports Prelude often defines functions whose names are used elsewhere. Not hiding such imports (or using qualified imports where clashes occur) will cause compilation errors.
In reality, it would require too much code to hide Prelude clashes like this, so you would in fact use a |
| Qualifying Imports When multiple modules define the same functions by name, the compiler will complain. In such cases (or to improve readability), we can use a Now we can prevent ambiguity compiler errors when we use It is also possible to import a module with only the clashing names being qualified via |
| Hierarchical module names The names of modules follow the filesystem's hierarchical structure. With the following file layout: the module headers would look like this: Note that:
SyntaxRemarksHaskell has support for modules: On the consumer end of a module, one can: haskell.org (opens new window) has a great chapter on module definition. |
Read Article
https://develop.horje.com/learn/1434/reference