Rule 99d-atpat-con-fail
Atomic Patterns
(99)
Referred to from
- The comment on rule
d-pat-con-fail(Chapter 6)
TeX source
\defnrule[r:d-atpat-con-fail]
{E(\longcon)=\con\premsep v\neq\con}
{\jdgv{E}{v}{\longcon}{\FAIL}}Tests (21)
- 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 / CaseBoolTestA case expression on a Bool with `True` and `False` branches selects the matching branch.
- elm / CaseCustomType4TestA case on a custom type with four constructors and no arguments, with one branch per constructor, selects the right branch for each.
- elm / CaseCustomType4WildcardTestA case on a four-constructor custom type with two explicit branches and a wildcard sends the other two constructors to the wildcard.
- elm / CaseGuardLikeTestChecks that nested `case` expressions on `Bool` comparisons, used in place of guards, pick the right branch at each threshold.
- elm / CaseNestedRecordAccessTestChecks a function that destructures a constructor in its argument and then cases on a looked-up value, calling another function that also destructures a constructor argument and cases on a record field.
- elm / CaseOrderTestChecks that a `case` on an `Order` maps each of `LT`, `EQ` and `GT` to its own string, using the results of `compare` on `Int` values.
- elm / CaseSingleCtorBoolMultiTypeTestA case expression matches `True` and `False` literal patterns inside a single-constructor custom type wrapping a `Bool`, while another single-constructor type, wrapping an `Int`, is defined in the same module.
- elm / CaseSingleCtorBoolTestA case expression matches `True` and `False` literal patterns inside a single-constructor custom type wrapping a `Bool`.
- elm / MinimalConstructorPatternFailTestA constructor pattern without arguments fails on another constructor.
- elm / SingleCtorPairBoolCharTestPattern matching works on two single-constructor types in one module, one wrapping a `Bool` and one wrapping a `Char`.
- elm / SingleCtorPairBoolFloatTestPattern matching works on two single-constructor types in one module, one wrapping a `Bool` and one wrapping a `Float`.
- elm / SingleCtorPairBoolIntBidiTestPattern matching and value extraction both work on two single-constructor types in one module, one wrapping a `Bool` and one wrapping an `Int`.
- elm / SingleCtorPairFloatBoolTestPattern matching works on two single-constructor types in one module, one wrapping a `Float` and one wrapping a `Bool`.
- elm / SingleCtorPairStringBoolTestPattern matching works on two single-constructor types in one module, one wrapping a `String` and one wrapping a `Bool`.
- elm / UserBoolNamedCtorTestA custom type may name its own constructors `True` and `False`, and they behave as ordinary constructors, distinct from each other and from `Unknown`.
- elm-core / EqualityBoolCaseTestThe result of `==` on `Bool` operands drives a `case` on `True` and `False` correctly.
- elm-core / EqualityBoolIfTestThe result of `==` and `/=` on `Bool` operands drives an `if` expression correctly.
- elm-core / NotEqualBoolCaseTestThe result of `/=` on two `Bool` literals is matched by a `case` with `True` and `False` branches, for all four combinations of operands.
- 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-atpat-con-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.