Elm Exactly

Restrictioncore-exhaustiveness

Stated in Section 4.11 Further Restrictions, under Exhaustiveness.

Exhaustiveness. In a match as above, every inhabitant of τ\tau must be covered by some pati\pat_i. Likewise, in a pattern binding atpat = exp\atpat\ \kw{=}\ \expm and in a lambda \ atpat -> exp\kw{\textbackslash}\ \atpat\ \kw{->}\ \expm, the pattern atpat\atpat must cover every inhabitant of its type. The restrictions are inherited by derived forms: in a function definition var atpat1⋯atpatn = exp\var\ \atpat_1 \cdots \atpat_n\ \kw{=}\ \expm, each atpati\atpat_i must be exhaustive by itself. In deciding exhaustiveness, no set of special constants covers every inhabitant of Int\tInt, Char\tChar or String\tString, whatever the range of Int\tInt (Appendix E).

Read it in its chapter·Permanent address: /standard/restrictions/core-exhaustiveness

Tests (9)

Discussions

Discuss this restriction·Search the discussions on GitHub

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