Elm Exactly
Results / elm /

InfixNoSectionLeftTest

Tags:elm-spec

Checks, in A Standard Definition of Elm?:figure core-grammar-expressions

Not translated into Lean for the mechanisation of the book: see why.

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`(1 +)` is not an expression: Elm has no operator sections.

A Standard Definition of Elm?, Section 2.7: an operator value `(op)` is the only way to use an
operator other than in a chain; there are no sections. The grammar of expressions has no
phrase for one. <https://elm-test-suite.netlify.app/standard/figures/core-grammar-expressions>

Results

elm-0.19.1

pass
Output
Compiling ...-- MISSING EXPRESSION --------------------------- src/InfixNoSectionLeftTest.elm

I just saw a + sign, so I am getting stuck here:

22|             Debug.log "section" ((1 +) 2)
                                         ^
I was expecting to see an expression next. Something like 42 or 1000 that makes
sense with a + sign.

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- MISSING EXPRESSION --------------------------- src/InfixNoSectionLeftTest.elm

I just saw a + sign, so I am getting stuck here:

22|             Debug.log "section" ((1 +) 2)
                                         ^
I was expecting to see an expression next. Something like 42 or 1000 that makes
sense with a + sign.

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- MISSING EXPRESSION --------------------------- src/InfixNoSectionLeftTest.elm

I just saw a + sign, so I am getting stuck here:

22|             Debug.log "section" ((1 +) 2)
                                         ^
I was expecting to see an expression next. Something like 42 or 1000 that makes
sense with a + sign.

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- MISSING EXPRESSION --------------------------- src/InfixNoSectionLeftTest.elm

I just saw a + sign, so I am getting stuck here:

22|             Debug.log "section" ((1 +) 2)
                                         ^
I was expecting to see an expression next. Something like 42 or 1000 that makes
sense with a + sign.

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm/InfixNoSectionLeftTest] in its title.

Source

The -- CHECK: lines give the expected output.

module InfixNoSectionLeftTest exposing (main)
{-| `(1 +)` is not an expression: Elm has no operator sections.
A Standard Definition of Elm?, Section 2.7: an operator value `(op)` is the only way to use an
operator other than in a chain; there are no sections. The grammar of expressions has no
phrase for one. <https://elm-test-suite.netlify.app/standard/figures/core-grammar-expressions>
-}
-- TAGS: elm-spec, fig:core-grammar-expressions
-- COMPILE-ERROR: an operator section with its left operand
-- CHECK: {{-- [A-Z ]+ -}}
-- CHECK-NOT: TYPE MISMATCH
import Html
main =
let
_ =
Debug.log "section" ((1 +) 2)
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 eco's parser rejects it too. See the Lean mechanisation for which tests are in Lean, and why.