Rule 45s-pat-as
Patterns
(45)
Comments
The syntactic restrictions ensure .
TeX source
\defnrule[r:s-pat-as]
{\jdg{C}{\pat}{(\VE, \tau)}}
{\jdg{C}{\pat\ \kw{as}\ \var}{(\VE + \{\var \mapsto (\tau, \isv)\},\ \tau)}}Tests (3)
- elm / CaseAsPatternTestAn as-pattern in a case branch, `((x :: _) as whole)`, binds both the list head and the whole list.
- elm / MinimalAsPatternTestA layered pattern binds the whole value to its variable.
- elm / StandardA99RecordPatternAsTestA record pattern under `as` in a `let` binding.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:s-pat-as] 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.