Elm Exactly
Results / elm /

InfixNoSectionRightTest

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 ...-- UNFINISHED OPERATOR FUNCTION ---------------- src/InfixNoSectionRightTest.elm

I was expecting a closing parenthesis here:

22|             Debug.log "section" ((+ 1) 2)
                                       ^
Try adding a ) to see if that helps!

Note: I think I am parsing an operator function right now, so I am expecting to
see something like (+) or (&&) where an operator is surrounded by parentheses
with no extra spaces.

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- UNFINISHED OPERATOR FUNCTION ---------------- src/InfixNoSectionRightTest.elm

I was expecting a closing parenthesis here:

22|             Debug.log "section" ((+ 1) 2)
                                       ^
Try adding a ) to see if that helps!

Note: I think I am parsing an operator function right now, so I am expecting to
see something like (+) or (&&) where an operator is surrounded by parentheses
with no extra spaces.

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- UNFINISHED OPERATOR FUNCTION ---------------- src/InfixNoSectionRightTest.elm

I was expecting a closing parenthesis here:

22|             Debug.log "section" ((+ 1) 2)
                                       ^
Try adding a ) to see if that helps!

Note: I think I am parsing an operator function right now, so I am expecting to
see something like (+) or (&&) where an operator is surrounded by parentheses
with no extra spaces.

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- UNFINISHED OPERATOR FUNCTION ---------------- src/InfixNoSectionRightTest.elm

I was expecting a closing parenthesis here:

22|             Debug.log "section" ((+ 1) 2)
                                       ^
Try adding a ) to see if that helps!

Note: I think I am parsing an operator function right now, so I am expecting to
see something like (+) or (&&) where an operator is surrounded by parentheses
with no extra spaces.

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module InfixNoSectionRightTest 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 right 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.