Rule 122dm-expitem-type
Exposing Items
(122)
Comments
A custom type exposed without (..) exposes no value, even when one of its constructors is spelt as the type: in a module with type Id = Id Int and header exposing (Id), the constructor Id is not exposed. The type is still exposed, closed: the constructor environment maps it to the empty map, so that an import of Id(..) has a meaning (rule (123)). An alias of a type other than a closed record is in neither nor , and exposes nothing.
Referred to from
- The comment on rule
dm-expitem-alias(Chapter 7)
TeX source
\defnrule[r:dm-expitem-type]
{\tycon\notin\dmRA\of I\premsep
\dmCE=\{\tycon\mapsto\emptymap\,;\,\tycon\in\Dom(\dmCE\of I)\}}
{\jdg{I}{\tycon}{(\emptyset,\dmCE,\emptymap)}}Tests (2)
- elm / ImportClosedTypeConstructorTestA custom type exposed without `(..)` exposes no constructor, even one spelt as the type.
- elm / ImportExposingItemsTestAn import's exposing list brings exactly its items into scope, with what the imported module's header exposes.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:dm-expitem-type] 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.