Elm Exactly

Rule 41s-patrow

Pattern RowsC⊢patrow⇒(VE,ϱ)\jdg{C}{\patrow}{(\VE, \varrho)}
⟨C⊢patrow⇒(VE,ϱ)⟩C⊢lab = var ⟨, patrow⟩⇒({var↦(τ,v)}⟨+VE⟩, {lab↦τ}⟨+ϱ⟩)\frac{\begin{array}{c}\opt{\jdg{C}{\patrow}{(\VE, \varrho)}}\end{array}}{\begin{array}{c}\jdg{C}{\lab\ \kw{=}\ \var\ \opt{\kw{,}\ \patrow}}{(\{\var \mapsto (\tau, \isv)\}\opt{{}+\VE},\ \{\lab \mapsto \tau\}\opt{{}+\varrho})}\end{array}}
(41)
Read it in its chapter·Permanent address: /standard/rules/s-patrow

Comments

A field of a record pattern binds the variable of its row to the type of the field. In a program the row is written as a label alone, whose equivalent form lab = var\lab\ \kw{=}\ \var has var=lab\var = \lab (Appendix A); a copy made by number specialisation gives var\var a new name and keeps lab\lab (Section 6.2). The syntactic restrictions ensure lab∉Dom ϱ\lab \notin \Dom\varrho. That var∉Dom VE\var \notin \Dom\VE follows, in a program, from the restriction that a binding site binds no variable twice, and in a copy from the distinct new names it gives.

TeX source
\defnrule[r:s-patrow]
  {\opt{\jdg{C}{\patrow}{(\VE, \varrho)}}}
  {\jdg{C}{\lab\ \kw{=}\ \var\ \opt{\kw{,}\ \patrow}}{(\{\var \mapsto (\tau, \isv)\}\opt{{}+\VE},\ \{\lab \mapsto \tau\}\opt{{}+\varrho})}}

Tests (13)

Discussions

Discuss this rule·Search the discussions on GitHub

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