Rule 16s-exp-case
Expressions
(16)
TeX source
\defnrule[r:s-exp-case]
{\jdg{C}{\expm}{\tau} \premsep \jdg{C}{\match}{\tau \rightarrow \tau'}}
{\jdg{C}{\kw{case}\ \expm\ \kw{of}\ \match}{\tau'}}Tests (11)
- elm / MinimalCaseTestA case expression with one rule whose pattern is a variable.
- elm / TypeMismatchBoolPatternTestA `True` pattern in a `case` on a number is rejected with a TYPE MISMATCH.
- elm / TypeMismatchCaseAsAnArgumentTestA `case` expression passed as the argument to `not` is rejected with a TYPE MISMATCH, because its branch yields a number and `not` takes a `Bool`.
- elm / TypeMismatchConstructorPatternTestA `case` on the number `1` with a `Just a` branch is rejected with a TYPE MISMATCH, because the pattern is a `Maybe` and the value is a number.
- elm / TypeMismatchIfConditionIntTestThe compiler rejects an `if` whose condition is the number `1` rather than a `Bool`, with a TYPE MISMATCH error.
- elm / TypeMismatchListPatternTestMatching a number against a list pattern is rejected with a TYPE MISMATCH.
- elm / TypeMismatchNumberLeftOfAndTestA number as the left operand of `&&` (`1 && True`) is rejected with a TYPE MISMATCH error, because `&&` takes two `Bool`s.
- elm / TypeMismatchNumberLeftOfOrTestA number as the left operand of `||` (`1 || True`) is rejected with a TYPE MISMATCH error, because `||` takes two `Bool`s.
- elm / TypeMismatchNumberRightOfAndTestA number as the right operand of `&&` (`True && 1`) is rejected with a TYPE MISMATCH error, because `&&` takes two `Bool`s.
- elm / TypeMismatchNumberRightOfOrTestA number as the right operand of `||` (`True || 1`) is rejected with a TYPE MISMATCH error, because `||` takes two `Bool`s.
- elm / TypeMismatchTupleComponentPatternTestA tuple pattern whose first component is a `String` literal, matched against a tuple of numbers, is rejected with a TYPE MISMATCH.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:s-exp-case] 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.