Elm Exactly

Figureappendix-standard-ml-types

Figure 57, Standard ML and Elm: Types, in Section F.2 Differences by Construct.

FeatureStandard MLElm (this definition)Where defined here
OverloadingA side mechanism (Appendix E of that definition): overloaded identifiers such as + and <, and overloaded special constants, resolved by context, with int as default.Part of the type system: type variables constrained to the classes number\knum, comparable\kcomp, appendable\kapp and compappend\kcapp, generalised and instantiated like others. A number\knum variable that the principal derivation leaves undetermined is taken to be Float before evaluation.Sec. 4.4; Sec. 4.10; Sec. 6.2
RecordsRecord types are closed. The selector #lab\lab and the record pattern wildcard ... require the record type to be determined by the context. No record update.Record types may be extensible, by a row variable ({ r | x : Int }). Field selection, the field accessor .lab\lab and record patterns apply to every record with the fields named. Record update { r | x = e } keeps the type of the record. A pattern row lab\lab stands for lab = var\lab\ \kw{=}\ \var, as in SML.Sec. 4.2; Sec. 4.9; App. A
TuplesA tuple is a record with labels 1, …, nn (n≥2n \geq 2); the unit is the empty record.Tuples of two and three components have type names of their own, and are not records; the unit is a type of its own.Fig. 5; Sec. 4.2
Datatypesdatatype with withtype, datatype replication, abstype; datatypes may be declared locally.Custom types are declared only at the top level of a module. All custom types of a module form one group, and they and the type aliases of the module may mention one another; there is no withtype, replication or abstype. A record alias also declares a constructor.Fig. 10; Sec. A.2; Sec. 5.5
Figure 57: Standard ML and Elm: Types
Read it in its chapter·Permanent address: /standard/figures/appendix-standard-ml-types

Referred to from

Tests (0)

No test of the suite checks this figure yet.

Discussions

Discuss this figure·Search the discussions on GitHub

Discussions are on GitHub; one about this figure has [fig:appendix-standard-ml-types] 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.