TopLevelPatternBindingTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:restriction modules-no-top-pattern
Not translated into Lean for the mechanisation of the book: see why.
There is no pattern binding at the top level. A Standard Definition of Elm?, restriction modules-no-top-pattern: a top-level value declaration binds only a variable, `x = e`. `( a, b ) = ( 1, 2 )` is a pattern binding. <https://elm-test-suite.netlify.app/standard/restrictions/modules-no-top-pattern>
Results
elm-0.19.1
passOutput
Compiling ...-- UNEXPECTED SYMBOL ------------------------ src/TopLevelPatternBindingTest.elm
I am getting stuck because this line starts with the ( symbol:
18| ( a, b ) =
^
When a line has no spaces at the beginning, I expect it to be a declaration like
one of these:
greet : String -> String
greet name =
"Hello " ++ name ++ "!"
type User = Anonymous | LoggedIn String
If this is not supposed to be a declaration, try adding some spaces before it?
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- UNEXPECTED SYMBOL ------------------------ src/TopLevelPatternBindingTest.elm
I am getting stuck because this line starts with the ( symbol:
18| ( a, b ) =
^
When a line has no spaces at the beginning, I expect it to be a declaration like
one of these:
greet : String -> String
greet name =
"Hello " ++ name ++ "!"
type User = Anonymous | LoggedIn String
If this is not supposed to be a declaration, try adding some spaces before it?
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- UNEXPECTED SYMBOL ------------------------ src/TopLevelPatternBindingTest.elm
I am getting stuck because this line starts with the ( symbol:
18| ( a, b ) =
^
When a line has no spaces at the beginning, I expect it to be a declaration like
one of these:
greet : String -> String
greet name =
"Hello " ++ name ++ "!"
type User = Anonymous | LoggedIn String
If this is not supposed to be a declaration, try adding some spaces before it?
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- UNEXPECTED SYMBOL ------------------------ src/TopLevelPatternBindingTest.elm
I am getting stuck because this line starts with the ( symbol:
18| ( a, b ) =
^
When a line has no spaces at the beginning, I expect it to be a declaration like
one of these:
greet : String -> String
greet name =
"Hello " ++ name ++ "!"
type User = Anonymous | LoggedIn String
If this is not supposed to be a declaration, try adding some spaces before it?
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/TopLevelPatternBindingTest] in its title.
Source
The -- CHECK: lines give the expected output.
module TopLevelPatternBindingTest exposing (main)
{-| There is no pattern binding at the top level.
A Standard Definition of Elm?, restriction modules-no-top-pattern: a top-level value declaration
binds only a variable, `x = e`. `( a, b ) = ( 1, 2 )` is a pattern binding.
<https://elm-test-suite.netlify.app/standard/restrictions/modules-no-top-pattern>
-}
-- TAGS: elm-spec, modules-no-top-pattern
-- COMPILE-ERROR: a tuple pattern binding at the top level
-- CHECK: {{-- [A-Z ]+ -}}
import Html
( a, b ) =
( 1, 2 )
main =
let
_ =
Debug.log "a + b" (a + b)
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.