Elm Exactly

Rule 33s-atpat-scon

Atomic PatternsC⊢atpat⇒(VE,τ)\jdg{C}{\atpat}{(\VE, \tau)}
type(scon)≻ττ∈{Int,Char,String}C⊢scon⇒({},τ)\frac{\begin{array}{c}\typeof(\scon) \succ \tau \premsep \tau \in \{\tInt, \tChar, \tString\}\end{array}}{\begin{array}{c}\jdg{C}{\scon}{(\emptymap, \tau)}\end{array}}
(33)
Read it in its chapter·Permanent address: /standard/rules/s-atpat-scon

Comments

The side conditions give an integer constant the type Int\tInt in a pattern, never Float\tFloat or a type variable of class number\knum; a character or string constant has its own type. Thus case 1.5 of 1 -> 0 ; _ -> 1 does not elaborate. Floating point constants are not patterns, by the grammar.

TeX source
\defnrule[r:s-atpat-scon]
  {\typeof(\scon) \succ \tau \premsep \tau \in \{\tInt, \tChar, \tString\}}
  {\jdg{C}{\scon}{(\emptymap, \tau)}}

Tests (8)

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:s-atpat-scon] 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.