Rule 113dm-module
Comments
Here is the environment of Appendix D that binds the list constructor names [] and ::; every module starts from it, as its elaboration starts from (rule (46)). The top-level declarations are evaluated in modified by the environment that the imports give, so a name that a module declares replaces, within it, an imported name spelt alike (rule (129)). The basis holds only what the header exposes; the value environment of all the module’s own values is the second result, as in the static semantics, because Chapter 9 takes the value of main from it, and main need not be exposed. A module is evaluated once, after the modules it imports, and its top-level values are evaluated then (Chapter 9).
Referred to from
- The comment on rule
p-dyn-main(Chapter 9)
TeX source
\defnrule[r:dm-module]
{\jdg{B}{\imports}{E}\premsep\jdg{E_0+E}{\topdec}{I}\premsep
\jdg{I}{\header}{(\modid,I')}}
{\jdg{B}{\header\ \imports\ \topdec}{\{\modid\mapsto I'\},\ \VE\of I}}Tests (3)
- elm / ImportExposingItemsTestAn import's exposing list brings exactly its items into scope, with what the imported module's header exposes.
- elm / MinimalImportValueTestA value exposed by one module and used in another.
- elm / TopLevelNameReplacesImportTestA name a module declares replaces, within it, an imported name spelt alike.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:dm-module] in its title.
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.