Restrictionmodules-constructors-distinct
No may declare the same twice. This counts the of each constructor binding of every , and the of each record alias, that is, each whose is, apart from enclosing parentheses, a record type without an extension variable; a record alias also declares a constructor of that name (Chapter 5).
Tests (2)
- elm / TopLevelConstructorTwiceTestTwo custom types may not declare the same constructor.
- elm / TopLevelRecordAliasConstructorClashTestA record alias declares a constructor, which may not clash with a custom type's.
In Lean
This restriction is decided on the syntax tree, as the book states it, by Src.ConstructorsDistinct (StandardElmMech/Src/Restrictions.lean, line 277), whose decider the kernel runs; each written test program has a theorem that it meets the restrictions, or that it breaks this one. Broken by: TopLevelConstructorTwiceTest, TopLevelRecordAliasConstructorClashTest.
Discussions
Discuss this restriction·Search the discussions on GitHub
Discussions are on GitHub; one about this restriction has [res:modules-constructors-distinct] in its title.
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.