Rule 96d-atpat-scon-fail
Atomic Patterns
(96)
Referred to from
- The comment on rule
d-pat-con-fail(Chapter 6)
TeX source
\defnrule[r:d-atpat-scon-fail]
{v\neq\valof(\scon)}
{\jdgv{E}{v}{\scon}{\FAIL}}Tests (25)
- elm / AstralCharCasePatternTestA `case` on a `Char` matches a pattern above U+FFFF, `'\u{1F600}'`, against the same character written as an escape or as the character itself.
- elm / CaseCharManyBranchTestA case on Char with ten literal branches (`'0'` to `'9'`) and a wildcard maps digit characters to their values and anything else to -1.
- elm / CaseCharTestA case on Char with literal vowel branches and a wildcard picks the matching literal, falling back to the wildcard for other characters.
- elm / CaseDeepNestTestCase expressions on Int nested two and three levels deep, each with literal branches and a wildcard, reach the right innermost branch.
- elm / CaseDefaultTestA case on Int with one literal branch and a wildcard sends every other value to the wildcard.
- elm / CaseIntTestChecks that a `case` on an `Int` matches integer literal patterns and falls through to the wildcard for any other value.
- elm / CaseManyBranchesTestChecks that a `case` on an `Int` with seven literal branches and a wildcard selects the first, a middle and the last literal branch correctly.
- elm / CaseSharedBranchTestChecks a `case` on a custom type whose first branch holds a nested `case` on the constructor's `String` argument.
- elm / CaseStringEmptyPatternTestA case expression on a `String` matches the empty-string literal `""` alongside non-empty literal patterns and a wildcard.
- elm / CaseStringEscapeTestA case expression on a `String` matches literal patterns written with escape sequences: a newline, a tab and a double quote.
- elm / CaseStringManyBranchTestA case expression on a `String` with seven literal patterns (three-letter day abbreviations) and a wildcard selects the matching branch.
- elm / CaseStringTestA case expression on a `String` with two literal patterns and a wildcard returns the `Int` of the matching branch.
- elm / CaseTripleTestA case expression on a 3-tuple of `Int`s matches literal and wildcard patterns in order, taking the first branch that fits.
- elm / CaseTupleLiteralTestA case expression on a pair of `Int`s matches literal and wildcard patterns in order, so a pair that fits several patterns takes the first.
- elm / CaseTupleTestA case expression on a pair of `Int`s matches literal and wildcard patterns in order, taking the first branch that fits.
- elm / CaseUnicodeCharTestA case expression on a `Char` matches character literals outside ASCII: two Greek letters and a CJK ideograph.
- elm / CharCasePredicateTestA `case` on a `Char` with several character-literal branches, including the escaped literal `'\\'`, selects the branch matching the scrutinee.
- elm / DecisionTreeAdvancedDeepNestingWithFallbackTestA `case` on a pair of pairs whose first branch matches all-zero literals and whose second binds the first and last numbers falls through to the second branch.
- elm / EqualityStringChainCaseTestA `case` on a `( String, Bool )` tuple with string-literal patterns selects the right branch, and direct `==` on strings gives the right answer, in the same module.
- elm / InlineDupLetNamesTestA function whose body does a `case` on a tuple of its arguments gives the right result when one call to it is passed as an argument to another.
- elm / MinimalCaseNextRuleTestA value the first rule of a case does not match goes to the next rule.
- elm / StringCasePatternCommaTestTwo `case` expressions on Strings, one of whose patterns contains a comma, each match against their own patterns.
- elm / TailRecDecoderLoopTestA recursive function whose outer `case` is on a custom type and whose inner `case` is on a `String` returns the right result for each branch.
- elm / TailRecManyBranchStringTestA self-recursive function over a three-constructor custom type, with a tail call in one branch and a `case` in another that matches a `String` against literal patterns, returns the right string.
- elm / TailRecNestedStringCaseTestA self-recursive function whose non-recursive branch matches a `String` against literal patterns returns the matched value after unwrapping several layers.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:d-atpat-scon-fail] 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.