Elm Exactly

Rule 39s-atpat-record

Atomic PatternsC⊢atpat⇒(VE,τ)\jdg{C}{\atpat}{(\VE, \tau)}
⟨C⊢patrow⇒(VE,ϱ)⟩τ∈RecType{}⟨+ϱ⟩⊆(ϱofτ)C⊢{ ⟨patrow⟩ }⇒({}⟨+VE⟩, τ)\frac{\begin{array}{c}\opt{\jdg{C}{\patrow}{(\VE, \varrho)}} \premsep \tau \in \RecType \premsep \emptymap\opt{{}+\varrho} \subseteq (\varrho \of \tau)\end{array}}{\begin{array}{c}\jdg{C}{\kw{\kwlb}\,\opt{\patrow}\,\kw{\kwrb}}{(\emptymap\opt{{}+\VE},\ \tau)}\end{array}}
(39)
Read it in its chapter·Permanent address: /standard/rules/s-atpat-record

Comments

The record type τ\tau may have fields besides those the pattern names, and it may be open: a record pattern matches every record with the fields it names.

TeX source
\defnrule[r:s-atpat-record]
  {\opt{\jdg{C}{\patrow}{(\VE, \varrho)}} \premsep \tau \in \RecType \premsep \emptymap\opt{{}+\varrho} \subseteq (\varrho \of \tau)}
  {\jdg{C}{\kw{\kwlb}\,\opt{\patrow}\,\kw{\kwrb}}{(\emptymap\opt{{}+\VE},\ \tau)}}

Tests (43)

Discussions

Discuss this rule·Search the discussions on GitHub

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