Elm Exactly

Restrictionmodules-value-recursion

Stated in Section 3.7 Syntactic Restrictions.

An occurrence of a variable in an expression exp\expm is delayed if it lies within a lambda expression in exp\expm, and direct otherwise. For a value declaration valbind\valbind of a topdec\topdec, say that var→var′\var \to \var' if valbind\valbind contains a binding var ⟨: ty⟩ = exp\var\ \opt{\kw{:}\ \ty}\ \kw{=}\ \expm and var′\var' is bound by valbind\valbind and has a direct occurrence in exp\expm. No value declaration of a topdec\topdec may have a cycle var1→⋯→varn→var1\var_1 \to \cdots \to \var_n \to \var_1 (n≥1)(n \geq 1). This takes the place, for the value declarations of a topdec\topdec, of the restriction on recursive groups of Section 2.10. Since a binding with parameters is a derived form whose equivalent form is a lambda expression (Appendix A), every occurrence in its body is delayed, and a rejected cycle passes only through values without parameters. A delayed occurrence used during the evaluation of the very value it refers to passes this restriction; no evaluation rule applies to it (Chapter 7).

Read it in its chapter·Permanent address: /standard/restrictions/modules-value-recursion

Tests (5)

In Lean

This restriction is decided on the syntax tree, as the book states it, by Src.ValueRecursion (StandardElmMech/Src/Restrictions.lean, line 316), whose decider the kernel runs; each written test program has a theorem that it meets the restrictions, or that it breaks this one. Broken by: CyclicDefinitionATopLevelValueDefinedByItselfTest, QualifiedTypeNotExposedTest.

Discussions

Discuss this restriction·Search the discussions on GitHub

Discussions are on GitHub; one about this restriction has [res:modules-value-recursion] 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.