Elm Exactly

Rule 64sm-typbind-record

Alias BindingsC⊢typbind⇒VE,TE\jdg{C}{\typbind}{\VE, \TE}
tyvarseq=ξ(k)C+{ξ1,⋯ ,ξk}⊢ty⇒τlabs(ty)=lab1⋯labnτ={ϱ}ϱ={lab1↦τ1,⋯ ,labn↦τn}con=tyconVE=ClosC{con↦(τ1→⋯→τn→τ,v)}C⊢tycon tyvarseq = ty⇒VE, {tycon↦(Λξ(k).τ,VE)}\frac{\begin{array}{c}\tyvarseq = \tyrowvar^{(k)} \premsep \jdg{C + \{\tyrowvar_1, \cdots, \tyrowvar_k\}}{\ty}{\tau} \\ \smlabs(\ty) = \lab_1 \cdots \lab_n \premsep \tau = \rec{\varrho} \premsep \varrho = \{\lab_1 \mapsto \tau_1, \cdots, \lab_n \mapsto \tau_n\} \\ \con = \tycon \premsep \VE = \Clos_C \{\con \mapsto (\tau_1 \rightarrow \cdots \rightarrow \tau_n \rightarrow \tau, \isv)\}\end{array}}{\begin{array}{c}\jdg{C}{\tycon\ \tyvarseq\ \kw{=}\ \ty}{\VE,\ \{\tycon \mapsto (\Lambda\tyrowvar^{(k)}.\tau, \VE)\}}\end{array}}
(64)
Read it in its chapter·Permanent address: /standard/rules/sm-typbind-record

Comments

A record alias also defines a constructor, spelt as the alias, whose arguments are the fields in the order written: after type alias P = { y : Int, x : Int }, the expression P 1 2 denotes the record { y = 1, x = 2 }. Its status is v\isv, so it may be applied but may not occur in a pattern (rule (43)). It is exposed and imported together with the alias (rule (54)).

Referred to from

TeX source
\defnrule[r:sm-typbind-record]
  {\tyvarseq = \tyrowvar^{(k)} \premsep \jdg{C + \{\tyrowvar_1, \cdots, \tyrowvar_k\}}{\ty}{\tau} \\ \smlabs(\ty) = \lab_1 \cdots \lab_n \premsep \tau = \rec{\varrho} \premsep \varrho = \{\lab_1 \mapsto \tau_1, \cdots, \lab_n \mapsto \tau_n\} \\ \con = \tycon \premsep \VE = \Clos_C \{\con \mapsto (\tau_1 \rightarrow \cdots \rightarrow \tau_n \rightarrow \tau, \isv)\}}
  {\jdg{C}{\tycon\ \tyvarseq\ \kw{=}\ \ty}{\VE,\ \{\tycon \mapsto (\Lambda\tyrowvar^{(k)}.\tau, \VE)\}}}

Tests (11)

Discussions

Discuss this rule·Search the discussions on GitHub

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