Rule 97d-atpat-var
Atomic Patterns
(97)
Comments
A variable pattern always binds: constructors and variables are spelt differently (Chapter 2), so no identifier status is consulted.
TeX source
\defnrule[r:d-atpat-var]
{}
{\jdgv{E}{v}{\var}{\{\var\mapsto v\}}}Tests (6)
- elm / MinimalCaseTestA case expression with one rule whose pattern is a variable.
- elm / SingleCtorPairCharFloatTestValues are extracted correctly from two single-constructor types in one module, one wrapping a `Char` and one wrapping a `Float`.
- elm / SingleCtorPairCharIntTestValues are extracted correctly from two single-constructor types in one module, one wrapping a `Char` and one wrapping an `Int`.
- elm / SingleCtorPairIntFloatTestValues are extracted correctly from two single-constructor types in one module, one wrapping an `Int` and one wrapping a `Float`.
- elm / SingleCtorPairStringIntTestValues are extracted correctly from two single-constructor types in one module, one wrapping a `String` and one wrapping an `Int`.
- elm / SingleCtorPairUnitIntTestPattern matching works on two single-constructor types in one module, one wrapping the unit value `()` and one wrapping an `Int`.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:d-atpat-var] 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.