Rule 131dm-conbind
Constructor Bindings
(131)
Comments
The constructor value awaits all of its arguments; a constructor of arity 0 is thus a complete value. Constructors spelt alike in different modules give equal constructor values, which never meet in one rule, since they have different types (Section 6.3).
TeX source
\defnrule[r:dm-conbind]
{\opt{\jdg{}{\conbind}{\VE}}}
{\jdg{}{\con\ \opt{\kw{|}\ \conbind}}{\{\con\mapsto\con\}\opt{+\,\VE}}}Tests (4)
- elm / MinimalCustomTypeTestA custom type with one constructor.
- elm / UserBoolNamedCtorTestA custom type may name its own constructors `True` and `False`, and they behave as ordinary constructors, distinct from each other and from `Unknown`.
- elm / WideCtorField24TestA custom type constructor with 27 fields, 25 `Int`s followed by a `Float` and a `Char`, keeps every field, and pattern matching reads back the later ones.
- elm / WideCtorMixedTestA custom type constructor with 60 fields, cycling through `Int`, `Float`, `Char`, `String` and `Bool`, supports pattern matching, equality and printing.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:dm-conbind] 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.