TypeConstructorTooFewArgsTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:rule s-ty-con
Not translated into Lean for the mechanisation of the book: see why.
A type constructor given fewer arguments than it takes is not a type: `List -> List` is rejected. A Standard Definition of Elm?, rule s-ty-con: a type construction `T t1 ... tk` elaborates only when `T` takes exactly k arguments, and `List` takes one. <https://elm-test-suite.netlify.app/standard/rules/s-ty-con>
Results
elm-0.19.1
passOutput
Compiling ...-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
-- TOO FEW ARGS -------------------------- src/TypeConstructorTooFewArgsTest.elm
The `List` type needs 1 argument, but I see 0 instead:
18| foo : List -> List
^^^^
What is missing? Are some parentheses misplaced?
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/TypeConstructorTooFewArgsTest] in its title.
Source
The -- CHECK: lines give the expected output.
module TypeConstructorTooFewArgsTest exposing (main)
{-| A type constructor given fewer arguments than it takes is not a type: `List -> List` is
rejected.
A Standard Definition of Elm?, rule s-ty-con: a type construction `T t1 ... tk` elaborates only
when `T` takes exactly k arguments, and `List` takes one. <https://elm-test-suite.netlify.app/standard/rules/s-ty-con>
-}
-- TAGS: elm-spec, s-ty-con
-- COMPILE-ERROR: List without its argument
-- CHECK: {{-- [A-Z ]+ -}}
import Html
foo : List -> List
foo xs =
xs
main =
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. 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_TypeConstructorTooFewArgsTest, in StandardElmMech/Certs/). Some type expression of the program (an alias, a constructor's argument, an annotation, a port) elaborates in no derivation (Stat.not_legal_of_typesFailB). It holds for every derivation, with no hypothesis about principality.