Elm Exactly

Rule 99d-atpat-con-fail

Atomic PatternsE,v⊢atpat⇒VE/FAIL\jdgv{E}{v}{\atpat}{\VE/\FAIL}
E(longcon)=conv≠conE,v⊢longcon⇒FAIL\frac{\begin{array}{c}E(\longcon)=\con\premsep v\neq\con\end{array}}{\begin{array}{c}\jdgv{E}{v}{\longcon}{\FAIL}\end{array}}
(99)
Read it in its chapter·Permanent address: /standard/rules/d-atpat-con-fail

Referred to from

TeX source
\defnrule[r:d-atpat-con-fail]
  {E(\longcon)=\con\premsep v\neq\con}
  {\jdgv{E}{v}{\longcon}{\FAIL}}

Tests (21)

  • elm / BoolAndTest
    The `&&` operator gives `True` only when both operands are `True`, checked over all four combinations.
  • elm / BoolOrTest
    The `||` operator gives `False` only when both operands are `False`, checked over all four combinations.
  • elm / CaseBoolTest
    A case expression on a Bool with `True` and `False` branches selects the matching branch.
  • elm / CaseCustomType4Test
    A case on a custom type with four constructors and no arguments, with one branch per constructor, selects the right branch for each.
  • elm / CaseCustomType4WildcardTest
    A case on a four-constructor custom type with two explicit branches and a wildcard sends the other two constructors to the wildcard.
  • elm / CaseGuardLikeTest
    Checks that nested `case` expressions on `Bool` comparisons, used in place of guards, pick the right branch at each threshold.
  • elm / CaseNestedRecordAccessTest
    Checks 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 / CaseOrderTest
    Checks 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 / CaseSingleCtorBoolMultiTypeTest
    A 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 / CaseSingleCtorBoolTest
    A case expression matches `True` and `False` literal patterns inside a single-constructor custom type wrapping a `Bool`.
  • elm / MinimalConstructorPatternFailTest
    A constructor pattern without arguments fails on another constructor.
  • elm / SingleCtorPairBoolCharTest
    Pattern matching works on two single-constructor types in one module, one wrapping a `Bool` and one wrapping a `Char`.
  • elm / SingleCtorPairBoolFloatTest
    Pattern matching works on two single-constructor types in one module, one wrapping a `Bool` and one wrapping a `Float`.
  • elm / SingleCtorPairBoolIntBidiTest
    Pattern matching and value extraction both work on two single-constructor types in one module, one wrapping a `Bool` and one wrapping an `Int`.
  • elm / SingleCtorPairFloatBoolTest
    Pattern matching works on two single-constructor types in one module, one wrapping a `Float` and one wrapping a `Bool`.
  • elm / SingleCtorPairStringBoolTest
    Pattern matching works on two single-constructor types in one module, one wrapping a `String` and one wrapping a `Bool`.
  • elm / UserBoolNamedCtorTest
    A 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 / EqualityBoolCaseTest
    The result of `==` on `Bool` operands drives a `case` on `True` and `False` correctly.
  • elm-core / EqualityBoolIfTest
    The result of `==` and `/=` on `Bool` operands drives an `if` expression correctly.
  • elm-core / NotEqualBoolCaseTest
    The result of `/=` on two `Bool` literals is matched by a `case` with `True` and `False` branches, for all four combinations of operands.
  • elm-core / NotEqualBoolIfTest
    The 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.