Elm Exactly

Rule 34s-atpat-var

Atomic PatternsC⊢atpat⇒(VE,τ)\jdg{C}{\atpat}{(\VE, \tau)}
C⊢var⇒({var↦(τ,v)},τ)\frac{\begin{array}{c}\end{array}}{\begin{array}{c}\jdg{C}{\var}{(\{\var \mapsto (\tau, \isv)\}, \tau)}\end{array}}
(34)
Read it in its chapter·Permanent address: /standard/rules/s-atpat-var

Comments

The variable receives a type, not a type scheme. Constructors and variables are spelt differently, so no status test is needed here.

TeX source
\defnrule[r:s-atpat-var]
  {}
  {\jdg{C}{\var}{(\{\var \mapsto (\tau, \isv)\}, \tau)}}

Tests (2)

  • elm / CaseBranchSelectionTest
    A `case` tries its branches in order: a branch whose pattern fails passes the value on, and the first that matches is evaluated with its pattern's bindings.
  • elm / MinimalCaseTest
    A case expression with one rule whose pattern is a variable.

Discussions

Discuss this rule·Search the discussions on GitHub

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