Elm Exactly

Rule 76d-exprow-field

Expression RowsE⊢exprow⇒r\jdg{E}{\exprow}{r}
E⊢exp⇒v⟨E⊢exprow⇒r⟩E⊢lab = exp ⟨, exprow⟩⇒{lab↦v}⟨+ r⟩\frac{\begin{array}{c}\jdg{E}{\expm}{v}\premsep\opt{\jdg{E}{\exprow}{r}}\end{array}}{\begin{array}{c}\jdg{E}{\lab\ \kw{=}\ \expm\ \opt{\kw{,}\ \exprow}}{\{\lab\mapsto v\}\opt{+\,r}}\end{array}}
(76)
Read it in its chapter·Permanent address: /standard/rules/d-exprow-field

Comments

The fields are evaluated in no specified order, neither as written nor by label (Section 6.7).

TeX source
\defnrule[r:d-exprow-field]
  {\jdg{E}{\expm}{v}\premsep\opt{\jdg{E}{\exprow}{r}}}
  {\jdg{E}{\lab\ \kw{=}\ \expm\ \opt{\kw{,}\ \exprow}}{\{\lab\mapsto v\}\opt{+\,r}}}

Tests (6)

  • elm / DebugLogRecordTupleFieldTest
    A `Debug.log` call can be used directly as an `Int` or `Float` component of a tuple or field of a record, and the value it returns is stored there.
  • elm / EmbeddedMixedConstantsTest
    A record holding `Nothing`, `[]`, `True`, `""` and `()` returns each value unchanged when its field is read.
  • elm / MinimalRecordTest
    A record expression with one field.
  • elm / RecordCreateTest
    Record literals with `Int` and `String` fields print correctly through `Debug.log`.
  • elm / WideRecord33Test
    A record with 33 fields, cycling through `Int`, `Float`, `Char`, `String` and `Bool`, supports field access, record patterns, update, equality and printing.
  • elm / WideRecord40Test
    A record with 40 fields, cycling through `Int`, `Float`, `Char`, `String` and `Bool`, supports field access, record patterns, update, equality and printing.

Discussions

Discuss this rule·Search the discussions on GitHub

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