Rule 115dm-imports-import
Comments
is defined, since a module is evaluated only after every module it imports (Chapter 9). The qualifier gives access to every value that the imported module exposes, its constructors included; the exposing list makes a part of them available unqualified. The environment of later imports stands on the right of , so a name exposed by a later import replaces the same name exposed by an earlier one, and in particular a written import replaces a default import. Where elaboration has found an unqualified name ambiguous, the name is not used, so which binding is kept is immaterial.
TeX source
\defnrule[r:dm-imports-import]
{B(\modid)=I\premsep\opt{\jdg{I}{\explist}{I'}}\premsep
\jdg{B}{\imports}{E}}
{B\vdash\kw{import}\ \modid\ \kw{as}\ \modid'\
\opt{\kw{exposing}\ \explist}\ \imports\\
\Rightarrow(\{\modid'\mapsto(\emptymap,\VE\of I)\},\ \emptymap\opt{+\,\VE\of I'})\dmmerge E}Tests (1)
- elm / CovForeignTypesTestChecks the use of two values from another module of the same project: `secretValue`, whose annotation names a type alias that its module does not expose, and a field of `config`, read through the module name as `CovForeignTypesHelper.config.x`. Their sum, 42, is logged.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:dm-imports-import] 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.