Elm Exactly
Results / elm /

TypeParameterTwiceTest

Tags:elm-spec

Checks, in A Standard Definition of Elm?:restriction modules-tyvarseq-distinct

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 type's parameter list may not name the same type variable twice.

A Standard Definition of Elm?, restriction modules-tyvarseq-distinct: no type-variable sequence
contains the same variable twice. <https://elm-test-suite.netlify.app/standard/restrictions/modules-tyvarseq-distinct>

Results

elm-0.19.1

pass
Output
Compiling ...-- NAME CLASH ----------------------------------- src/TypeParameterTwiceTest.elm

The `Pair` type has multiple `a` type variables.

17| type Pair a a
              ^ ^
How can I know which one you want? Rename one of them!

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- NAME CLASH ----------------------------------- src/TypeParameterTwiceTest.elm

The `Pair` type has multiple `a` type variables.

16| type Pair a a
                ^^
How can I know which one you want? Rename one of them!

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- NAME CLASH ----------------------------------- src/TypeParameterTwiceTest.elm

The `Pair` type has multiple `a` type variables.

16| type Pair a a
                ^^
How can I know which one you want? Rename one of them!

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- NAME CLASH ----------------------------------- src/TypeParameterTwiceTest.elm

The `Pair` type has multiple `a` type variables.

16| type Pair a a
              ^ ^
How can I know which one you want? Rename one of them!

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module TypeParameterTwiceTest exposing (main)
{-| A type's parameter list may not name the same type variable twice.
A Standard Definition of Elm?, restriction modules-tyvarseq-distinct: no type-variable sequence
contains the same variable twice. <https://elm-test-suite.netlify.app/standard/restrictions/modules-tyvarseq-distinct>
-}
-- TAGS: elm-spec, modules-tyvarseq-distinct
-- COMPILE-ERROR: a type parameter list with a repeated variable
-- CHECK: {{-- [A-Z ]+ -}}
import Html
type Pair a a
= Pair a a
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_TypeParameterTwiceTest, in StandardElmMech/Certs/). The program breaks a syntactic restriction, which the kernel checks on its syntax tree; no type inference is involved (Stat.not_legal_of_syn): res:modules-tyvarseq-distinct. It holds for every derivation, with no hypothesis about principality.