Elm Exactly
Results / elm /

BadMainTypeTypeVariableMainTest

Tags:elm19-compile-errorelm-spec

Checks, in A Standard Definition of Elm?:rule p-stat-main-programrule p-stat-main-view

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
An unannotated `main` whose inferred type contains a type variable is rejected with a BAD MAIN TYPE error.

`main = []` has type `List a`.

Results

elm-0.19.1

pass
Output
Compiling ...-- BAD MAIN TYPE ----------------------- src/BadMainTypeTypeVariableMainTest.elm

I cannot handle this type of `main` value:

14| main = []
    ^^^^
The type of `main` value I am seeing is:

    List a

I only know how to handle Html, Svg, and Programs though. Modify `main` to be
one of those types of values!

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- BAD MAIN TYPE ----------------------- src/BadMainTypeTypeVariableMainTest.elm

I cannot handle this type of `main` value:

14| main = []
    ^^^^
The type of `main` value I am seeing is:

    List a

I only know how to handle Html, Svg, and Programs though. Modify `main` to be
one of those types of values!

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- BAD MAIN TYPE ----------------------- src/BadMainTypeTypeVariableMainTest.elm

I cannot handle this type of `main` value:

14| main = []
    ^^^^
The type of `main` value I am seeing is:

    List a

I only know how to handle Html, Svg, and Programs though. Modify `main` to be
one of those types of values!

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- BAD MAIN TYPE ----------------------- src/BadMainTypeTypeVariableMainTest.elm

I cannot handle this type of `main` value:

14| main = []
    ^^^^
The type of `main` value I am seeing is:

    List a

I only know how to handle Html, Svg, and Programs though. Modify `main` to be
one of those types of values!

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module BadMainTypeTypeVariableMainTest exposing (..)
{-| An unannotated `main` whose inferred type contains a type variable is rejected with a BAD MAIN TYPE error.
`main = []` has type `List a`.
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, p-stat-main-program, p-stat-main-view
-- COMPILE-ERROR: BAD MAIN TYPE, type variable main
-- CHECK: -- BAD MAIN TYPE -
main = []

Lean translation

No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Lean has the program as written, in source syntax, and proves what the static semantics says of it (below). See the Lean mechanisation for which tests are in Lean, and why.

Static semantics: Lean proves that the program as written is not legal, so a compiler must reject it (refuse_elm_BadMainTypeTypeVariableMainTest, in StandardElmMech/Certs/). Every derivation gives main a type Chapter 9 does not allow (Stat.not_legal_of_mainFailB). It holds for every derivation, with no hypothesis about principality.