Elm Exactly

Rule 88d-mrule-match

Match RulesE,v⊢mrule⇒v′/FAIL\jdgv{E}{v}{\mrule}{v'/\FAIL}
E,v⊢pat⇒VEE+VE⊢exp⇒v′E,v⊢pat -> exp⇒v′\frac{\begin{array}{c}\jdgv{E}{v}{\pat}{\VE}\premsep\jdg{E+\VE}{\expm}{v'}\end{array}}{\begin{array}{c}\jdgv{E}{v}{\pat\ \kw{->}\ \expm}{v'}\end{array}}
(88)
Read it in its chapter·Permanent address: /standard/rules/d-mrule-match
TeX source
\defnrule[r:d-mrule-match]
  {\jdgv{E}{v}{\pat}{\VE}\premsep\jdg{E+\VE}{\expm}{v'}}
  {\jdgv{E}{v}{\pat\ \kw{->}\ \expm}{v'}}

Tests (7)

  • 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 / CaseBranchSelectionTest
    A `case` tries its branches in order: a branch whose pattern fails passes the value on, and the first that matches is evaluated with its pattern's bindings.
  • 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 / MinimalCaseTest
    A case expression with one rule whose pattern is a variable.
  • elm-core / EqualityBoolIfTest
    The result of `==` and `/=` on `Bool` operands drives an `if` expression correctly.
  • 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-mrule-match] 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.