Rule 7s-atexp-nil
Atomic Expressions
(7)
Comments
Note that does not occur in any premise; thus [ ] has type for every .
Referred to from
- The comment on rule
s-atpat-nil(Chapter 4)
TeX source
\defnrule[r:s-atexp-nil]
{}
{\jdg{C}{\kw{[}\ \kw{]}}{\tau\,\tList}}Tests (6)
- elm / EmbeddedNilCaptureTestA local function that refers to an empty list defined in the enclosing `let` matches it against the `[]` pattern.
- elm / EmbeddedNilInCustomTypeTestAn empty list stored in a custom type constructor and taken back out by a `case` is still empty, with length 0.
- elm / EmbeddedNothingPolymorphicTest`Nothing`, `[]` and `""` pass unchanged through the polymorphic `identity`, the first two then also through a function with a concrete type.
- elm / ErasedListSpecializationTestA polymorphic self-recursive `count : List a -> Int` gives the right length when called both on `List Int` values and on `[]`, whose element type nothing constrains.
- elm / MinimalEmptyListTestThe empty list is a value.
- elm / PolyChainFoldlLikeCalled8TimesOverTupleKeyedStructureTestTests a polymorphic fold-like function called eight times in a chain, each with a step function over `( List String, Global )` elements and the previous call's result as the initial value.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:s-atexp-nil] 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.