InfixMixedAssocComposeTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:restriction core-operator-chainfigure core-fixities
Not translated into Lean for the mechanisation of the book: see why.
`f << g >> h` is not a phrase: `<<` and `>>` have equal precedence and associate in opposite ways. A Standard Definition of Elm?, restriction core-operator-chain: two operators of equal precedence with no operator of lower precedence between them must both associate to the left or both to the right; otherwise the chain is not a phrase of the language. <https://elm-test-suite.netlify.app/standard/restrictions/core-operator-chain> The book's example. `identity << identity >> identity` would type grouped either way.
Results
elm-0.19.1
passOutput
Compiling ...-- INFIX PROBLEM ---------------------------- src/InfixMixedAssocComposeTest.elm
You cannot mix (<<) and (>>) without parentheses.
24| Debug.log "composed" ((identity << identity >> identity) 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- INFIX PROBLEM ---------------------------- src/InfixMixedAssocComposeTest.elm
You cannot mix (<<) and (>>) without parentheses.
24| Debug.log "composed" ((identity << identity >> identity) 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- INFIX PROBLEM ---------------------------- src/InfixMixedAssocComposeTest.elm
You cannot mix (<<) and (>>) without parentheses.
24| Debug.log "composed" ((identity << identity >> identity) 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- INFIX PROBLEM ---------------------------- src/InfixMixedAssocComposeTest.elm
You cannot mix (<<) and (>>) without parentheses.
24| Debug.log "composed" ((identity << identity >> identity) 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/InfixMixedAssocComposeTest] in its title.
Source
The -- CHECK: lines give the expected output.
module InfixMixedAssocComposeTest exposing (main)
{-| `f << g >> h` is not a phrase: `<<` and `>>` have equal precedence and associate in opposite ways.
A Standard Definition of Elm?, restriction core-operator-chain: two operators of equal
precedence with no operator of lower precedence between them must both associate to the left
or both to the right; otherwise the chain is not a phrase of the language. <https://elm-test-suite.netlify.app/standard/restrictions/core-operator-chain>
The book's example. `identity << identity >> identity` would type grouped either way.
-}
-- TAGS: elm-spec, core-operator-chain, fig:core-fixities
-- COMPILE-ERROR: a left and a right associative operator of equal precedence
-- CHECK: {{-- [A-Z ]+ -}}
-- CHECK-NOT: TYPE MISMATCH
import Html
main =
let
_ =
Debug.log "composed" ((identity << identity >> identity) 1)
in
Html.text "done"
Lean translation
No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Static semantics: expected to be rejected, and the translator's front end refuses it: it breaks a restriction on characters, tokens and layout, which Lean does not model. See the Lean mechanisation for which tests are in Lean, and why.