Elm Exactly
Results / elm /

BadMainTypeThreeArgumentTypeMainTest

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
A `main` whose type is a custom type with three type parameters is rejected with a BAD MAIN TYPE error.

`main` is `T 1 2 3`, of type `T Int Int Int`.

Results

elm-0.19.1

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

I cannot handle this type of `main` value:

17| main = T 1 2 3
    ^^^^
The type of `main` value I am seeing is:

    T Int Int Int

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/BadMainTypeThreeArgumentTypeMainTest.elm

I cannot handle this type of `main` value:

17| main = T 1 2 3
    ^^^^
The type of `main` value I am seeing is:

    T Int Int Int

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/BadMainTypeThreeArgumentTypeMainTest.elm

I cannot handle this type of `main` value:

17| main = T 1 2 3
    ^^^^
The type of `main` value I am seeing is:

    T Int Int Int

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/BadMainTypeThreeArgumentTypeMainTest.elm

I cannot handle this type of `main` value:

17| main = T 1 2 3
    ^^^^
The type of `main` value I am seeing is:

    T Int Int Int

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/BadMainTypeThreeArgumentTypeMainTest] in its title.

Source

The -- CHECK: lines give the expected output.

module BadMainTypeThreeArgumentTypeMainTest exposing (..)
{-| A `main` whose type is a custom type with three type parameters is rejected with a BAD MAIN TYPE error.
`main` is `T 1 2 3`, of type `T Int Int Int`.
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, p-stat-main-program, p-stat-main-view
-- COMPILE-ERROR: BAD MAIN TYPE, three-argument type main
-- CHECK: -- BAD MAIN TYPE -
type T a b c = T a b c
main : T Int Int Int
main = T 1 2 3

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_BadMainTypeThreeArgumentTypeMainTest, 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.