Rule 87d-match-next
Matches
(87)
TeX source
\defnrule[r:d-match-next]
{\jdgv{E}{v}{\mrule}{\FAIL}\premsep\jdgv{E}{v}{\match}{v'/\FAIL}}
{\jdgv{E}{v}{\mrule\ \kw{;}\ \match}{v'/\FAIL}}Tests (17)
- elm / BoolAndTestThe `&&` operator gives `True` only when both operands are `True`, checked over all four combinations.
- elm / BoolOrTestThe `||` operator gives `False` only when both operands are `False`, checked over all four combinations.
- 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 / 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 / EmbeddedNilRecursiveTestA recursive function that returns `[]` for an empty list builds the doubled positive elements of its input, skipping the rest.
- 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 / HigherOrderFilterLikeFunctionTestA let-bound function that takes a predicate and a list, and keeps the list's head when the predicate holds, gives `[1]` for a predicate that always returns `True`.
- 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 / LargeDispatchCaseTestChecks a `case` on a list of custom-type values whose branches contain a nested `case` on a String.
- elm / MaybePatternMatchTestA `case` on a `Maybe` takes the `Just` branch to extract the value and the `Nothing` branch otherwise.
- elm / MinimalCaseNextRuleTestA value the first rule of a case does not match goes to the next rule.
- elm / NestedCaseReturnTestA `case` on a custom type whose branches return the result of another `case` on a String, either inline or through a helper, returns the right string.
- elm / StringCasePatternCommaTestTwo `case` expressions on Strings, one of whose patterns contains a comma, each match against their own patterns.
- elm / TailRecBoolCarryTestA self tail-recursive function that carries a `Bool` argument from one call to the next, and sets it from a branch inside a `case`, returns the right result.
- elm / WrapperUnionFieldTestA single-constructor custom type can wrap a record whose field is itself a custom type, and a nested `case` reads the payload of that field.
- elm-core / EqualityBoolIfTestThe result of `==` and `/=` on `Bool` operands drives an `if` expression correctly.
- elm-core / NotEqualBoolIfTestThe result of `/=` on two `Bool` literals is used as the condition of an `if`, for all four combinations of operands; each logs `"yes"` exactly when the operands differ.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:d-match-next] 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.