Rule 78d-exp-app
Expressions
(78)
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 / CapturedStagedFuncCallTestA 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 / InfixPrecApplicationFirstTestApplication binds more tightly than any operator.
- elm / StandardA56PrefixAndOrTest`(&&)` and `(||)` used as functions evaluate both arguments, like every other function.
- elm / StandardApplicationStrictTestA 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 / EqualityBoolIfTestThe result of `==` and `/=` on `Bool` operands drives an `if` expression correctly.
- elm-core / FloatNegativeZeroTestNegative zero (`-0.0`) equals 0.0, and dividing 1.0 by it gives -Infinity while dividing by 0.0 gives Infinity.
- elm-core / FloatSubTestFloat subtraction gives the expected value, including when the right operand is a negative literal.
- elm-core / IntSubTestChecks integer subtraction `-`, including subtracting a negative literal.
- 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-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.