Elm Exactly

Rule 78d-exp-app

ExpressionsE⊢exp⇒v\jdg{E}{\expm}{v}
E⊢exp⇒v1E⊢atexp⇒v2⊢v1 v2⇒vE⊢exp atexp⇒v\frac{\begin{array}{c}\jdg{E}{\expm}{v_1}\premsep\jdg{E}{\atexp}{v_2}\premsep\japp{v_1}{v_2}{v}\end{array}}{\begin{array}{c}\jdg{E}{\expm\ \atexp}{v}\end{array}}
(78)
Read it in its chapter·Permanent address: /standard/rules/d-exp-app

Comments

The argument is evaluated whether or not the function uses it: (\_ -> 1) (Debug.todo "x") has no value.

TeX source
\defnrule[r:d-exp-app]
  {\jdg{E}{\expm}{v_1}\premsep\jdg{E}{\atexp}{v_2}\premsep\japp{v_1}{v_2}{v}}
  {\jdg{E}{\expm\ \atexp}{v}}

Tests (9)

  • elm / CapturedStagedFuncCallTest
    A function parameter captured by a local helper and applied to two arguments works when the function passed in takes one argument and returns a function.
  • elm / InfixPrecApplicationFirstTest
    Application binds more tightly than any operator.
  • elm / StandardA56PrefixAndOrTest
    `(&&)` and `(||)` used as functions evaluate both arguments, like every other function.
  • elm / StandardApplicationStrictTest
    A function's argument is evaluated before the function is applied, even when the function does not use it: `(\_ -> 1) (Debug.todo "x")` has no value, so the program stops there.
  • elm-core / EqualityBoolIfTest
    The result of `==` and `/=` on `Bool` operands drives an `if` expression correctly.
  • elm-core / FloatNegativeZeroTest
    Negative zero (`-0.0`) equals 0.0, and dividing 1.0 by it gives -Infinity while dividing by 0.0 gives Infinity.
  • elm-core / FloatSubTest
    Float subtraction gives the expected value, including when the right operand is a negative literal.
  • elm-core / IntSubTest
    Checks integer subtraction `-`, including subtracting a negative literal.
  • 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-exp-app] 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.