Rule 123dm-expitem-open
Exposing Items
(123)
Comments
By elaboration, names a custom type that exposes, so is defined; an item for an alias is rejected (Chapters 3 and 5). In a header, is the module’s own interface, which holds every constructor of . In an import, holds the constructors that the imported module exposes, and is the empty map when it exposes closed: with module A exposing (T), type T = T Int and import A exposing (T(..)), the import makes no constructor available.
Referred to from
- The comment on rule
dm-expitem-type(Chapter 7)
TeX source
\defnrule[r:dm-expitem-open]
{(\dmCE\of I)(\tycon)=\VE}
{\jdg{I}{\tycon\,\kw{(..)}}{(\emptyset,\{\tycon\mapsto\VE\},\VE)}}Tests (3)
- elm / ImportClosedTypeOpenItemTest`import M exposing (T(..))` of a type that `M` exposes closed imports the type and no constructors.
- elm / ImportExposingItemsTestAn import's exposing list brings exactly its items into scope, with what the imported module's header exposes.
- elm / MinimalExposingOpenTestA module that exposes a custom type with its constructors.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:dm-expitem-open] 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.