Elm Exactly

Rule 100d-atpat-unit

Atomic PatternsE,v⊢atpat⇒VE/FAIL\jdgv{E}{v}{\atpat}{\VE/\FAIL}
E,()⊢()⇒{}\frac{\begin{array}{c}\end{array}}{\begin{array}{c}\jdgv{E}{()}{\kw{()}}{\emptymap}\end{array}}
(100)
Read it in its chapter·Permanent address: /standard/rules/d-atpat-unit

Comments

For rules (100), (101) and (104): in a program that elaborates the value matched has the form the pattern requires, so no rule for these patterns gives FAIL on its own account; a tuple fails only when a component pattern fails. A record pattern matches a record with any further fields.

TeX source
\defnrule[r:d-atpat-unit]
  {}
  {\jdgv{E}{()}{\kw{()}}{\emptymap}}

Tests (3)

  • elm / EmbeddedUnitCaptureTest
    A local function returns a tuple containing a unit value bound in the enclosing `let`, and the tuple is destructured by a pattern.
  • elm / MinimalUnitPatternTest
    The unit pattern matches the unit value.
  • elm / StandardCoreEvaluationExamplesTest
    Small programs for rules of the dynamic semantics of the Core that other tests reach only in passing, and examples from the Comments of A Standard Definition of Elm?, Chapter 6.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:d-atpat-unit] 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.