Elm Exactly

Rule 90d-dec-nonrec

DeclarationsE⊢dec⇒VE\jdg{E}{\dec}{\VE}
E⊢valbind⇒VEDom VE∩FV(valbind)=∅E⊢valbind⇒VE\frac{\begin{array}{c}\jdg{E}{\valbind}{\VE}\premsep\Dom\VE\cap\dcoreFV(\valbind)=\emptyset\end{array}}{\begin{array}{c}\jdg{E}{\valbind}{\VE}\end{array}}
(90)
Read it in its chapter·Permanent address: /standard/rules/d-dec-nonrec

Comments

Rules (90) and (91) cover the one production, distinguished by whether the declaration is recursive (Section 6.6). The right-hand sides are evaluated in EE, without the variables the declaration binds; in a recursive declaration every right-hand side is a lambda, and Rec \Rec gives each of its closures the bindings of the whole declaration. Rec \Rec is not applied to a declaration that is not recursive, since a closure it binds may have been made elsewhere, in an environment where a variable spelt as one that the declaration binds denotes something else. A let declaration needs only Rec \Rec because every binding of a recursive let declaration is a function (Section 2.10); top-level declarations, whose recursive members need not be functions, are treated in Chapter 7.

Referred to from

TeX source
\defnrule[r:d-dec-nonrec]
  {\jdg{E}{\valbind}{\VE}\premsep\Dom\VE\cap\dcoreFV(\valbind)=\emptyset}
  {\jdg{E}{\valbind}{\VE}}

Tests (3)

  • elm / LetBasicTest
    Two groups of `let` bindings, where later bindings use earlier ones: `x + y` on two Int literals gives 5, and `"hello" ++ " " ++ "world"` gives `"hello world"`.
  • elm / LetMultipleTest
    Five Int bindings in one `let` combined by two later bindings: their sum (15) and their product (120).
  • elm / MinimalLetTest
    A let expression with one definition.

Discussions

Discuss this rule·Search the discussions on GitHub

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