Elm Exactly
A Standard Definition of Elm?Draft version 0.4 / Appendix C

CThe Initial Static Basis

In this appendix and the next we define a minimal initial basis: the type names, modules, types and values that the definition itself mentions, together with all of the module Basics. Libraries may provide richer bases, extending the module environment with further modules and the interfaces below with further values; such libraries are not described here. Components of the initial basis are indicated by the subscript 0. The initial static basis is

B0=T0,ME0,PE0,where PE0={}, B_0 = T_0, \ME_0, \PE_0, \qquad\text{where}\ \PE_0 = \emptymap,

T0T_0 is given in Section C.1 and ME0\ME_0 in Sections C.2 to C.5. The basis declares no port.

In the type schemes of this appendix a type variable is written as the type variable of the syntax that names it (Section 4.1), so that its spelling gives its class: number\mv{number} has class number\knum, comparable\mv{comparable} has class comparable\kcomp, appendable\mv{appendable} has class appendable\kapp, and every other variable written here (a\mv{a}, b\mv{b}, c\mv{c}, d\mv{d}, e\mv{e}, r\mv{r}, x\mv{x}, y\mv{y}, msg\mv{msg}, flags\mv{flags}, model\mv{model}) has class any\kany. No variable of class compappend\kcapp occurs in the initial basis. A type is written as in Chapter 4, with type names after their arguments: the type that a program writes Maybe a is a Maybe\mv{a}\,\tMaybe, and Task x a is (x,a)Task(\mv{x}, \mv{a})\sbtTask.

C.1Type Names

The set of type names of the initial basis is

T0 = {Int,Float,Char,String,(),List,Tuple2,Tuple3,  {Bool,Order,Never,Maybe,Result,Array,Bytes,Value,  {Cmd,Sub,Task,ProcessId,Program,Node}. \begin{array}{rcl} T_0 {\ }& = {\ }& \{\tInt, \tFloat, \tChar, \tString, \tunit, \tList, \tTuple{2}, \tTuple{3},\\ {\ }& {\ }& \phantom{\{}\tBool, \sbtOrder, \sbtNever, \tMaybe, \sbtResult, \tArray, \tBytes, \tValue,\\ {\ }& {\ }& \phantom{\{}\sbtCmd, \sbtSub, \sbtTask, \sbtProcessId, \sbtProgram, \sbtNode\}. \end{array}

The members of T0T_0 are type names, not type constructors; we have spelt each as a type constructor bound to it in ME0\ME_0, or, for ()\tunit and Tuplek\tTuple{k}, after the syntax of the types that denote them. Their arities, and the type constructors bound to them, are shown in Figure 36. The first eight are the type names of Figure 13, which the rules of Chapter 4 mention directly. The type names ()\tunit, Tuple2\tTuple{2} and Tuple3\tTuple{3} are bound to no type constructor: the type expressions () and ( ty1, ty2⟨, ty3⟩ \,\ty_1\kw{,}\,\ty_2\opt{\kw{,}\,\ty_3}\,) denote them. Which of the type names are admissible for each class is given by Figure 15: a type built from any type name of T0T_0 other than Int\tInt, Float\tFloat, Char\tChar, String\tString, List\tList, Tuple2\tTuple{2} and Tuple3\tTuple{3} is admissible for no class but any\kany.

ttaritybound to\text{bound to}
Int\tInt0Basics.Int\kw{Basics.Int}
Float\tFloat0Basics.Float\kw{Basics.Float}
Char\tChar0Char.Char\kw{Char.Char}
String\tString0String.String\kw{String.String}
()\tunit0(none)\text{(none)}
List\tList1List (Section C.2)\kw{List}\ \text{(Section~C.2)}
Tuple2\tTuple{2}2(none)\text{(none)}
Tuple3\tTuple{3}3(none)\text{(none)}
Bool\tBool0Basics.Bool\kw{Basics.Bool}
Order\sbtOrder0Basics.Order\kw{Basics.Order}
Never\sbtNever0Basics.Never\kw{Basics.Never}
Maybe\tMaybe1Maybe.Maybe\kw{Maybe.Maybe}
Result\sbtResult2Result.Result\kw{Result.Result}
Array\tArray1Array.Array\kw{Array.Array}
Bytes\tBytes0Bytes.Bytes\kw{Bytes.Bytes}
Value\tValue0Json.Encode.Value, Json.Decode.Value\kw{Json.Encode.Value},\ \kw{Json.Decode.Value}
Cmd\sbtCmd1Platform.Cmd.Cmd\kw{Platform.Cmd.Cmd}
Sub\sbtSub1Platform.Sub.Sub\kw{Platform.Sub.Sub}
Task\sbtTask2Platform.Task, Task.Task\kw{Platform.Task},\ \kw{Task.Task}
ProcessId\sbtProcessId0Platform.ProcessId, Process.Id\kw{Platform.ProcessId},\ \kw{Process.Id}
Program\sbtProgram3Platform.Program\kw{Platform.Program}
Node\sbtNode1VirtualDom.Node, Html.Html\kw{VirtualDom.Node},\ \kw{Html.Html}
Figure 36: Type Names of the Initial Basis, T0T_0

The type names Bool\tBool, Order\sbtOrder, Maybe\tMaybe and Result\sbtResult are those of custom types whose constructors ME0\ME_0 exposes; Never\sbtNever is that of a custom type that Basics exposes closed (Section 5.1): its one constructor JustOneMore is in its type structure but not in the value environment of the interface, so that no phrase of a program has a value of type Never\sbtNever. The others are abstract: ME0\ME_0 binds them with no constructors, and their values are given by the dynamic basis (Appendix D) and Chapter 8.

C.2The Module Environment

The module environment ME0\ME_0 has the domain

{Basics,List,Maybe,Result,String,Char,Tuple,Array,Bytes,Debug,{Platform,Platform.Cmd,Platform.Sub,Task,Process,{Json.Encode,Json.Decode,VirtualDom,Html}. \begin{array}{l} \{\kw{Basics}, \kw{List}, \kw{Maybe}, \kw{Result}, \kw{String}, \kw{Char}, \kw{Tuple}, \kw{Array}, \kw{Bytes}, \kw{Debug},\\ \phantom{\{}\kw{Platform}, \kw{Platform.Cmd}, \kw{Platform.Sub}, \kw{Task}, \kw{Process},\\ \phantom{\{}\kw{Json.Encode}, \kw{Json.Decode}, \kw{VirtualDom}, \kw{Html}\}. \end{array}

The interface ME0(modid)\ME_0(\modid) of each module is an environment ({},TE,VE)(\emptymap, \TE, \VE) whose qualified environment is empty; its type environment and value environment are shown in Figures 37 to 44. In Figures 41 to 44 the entries of each interface are headed by the name of its module; the bindings of the type environment come first and, below a rule, those of the value environment. An interface with no binding shown in a component has the empty map there; the interfaces of List and Tuple are ({},{},{})(\emptymap, \emptymap, \emptymap). As in Chapter 4, every variable has status v\isv and every constructor status c\isc, and a constructor of a custom type is bound in the value environment of the type’s structure and, unless the type is closed, in the value environment of the interface. The type names occurring in ME0\ME_0 are those of T0T_0:

tynames ME0⊆T0. \tynames \ME_0 \subseteq T_0 .

Every module of ME0\ME_0 belongs to the library elm/core, except five: Bytes belongs to elm/bytes, Json.Encode and Json.Decode to elm/json, VirtualDom to elm/virtual-dom, and Html to elm/html. These five are in ME0\ME_0 only for their types, which the definition of ports (Section 5.4) and of the type of main (Chapter 9) mention. Before any import is read, every module has in scope, unqualified, the type constructor List and the two list constructor names [] and :: of Section 4.2, which no identifier spells. They form the environment

E0=({},TE0,VE0),TE0={List↦(List,VE0)}, E_0 = (\emptymap, \TE_0, \VE_0), \qquad \TE_0 = \{\htmlId{b-List}{\href{/standard/basis/List}{\kw{List}}} \mapsto (\tList, \VE_0)\},

where

VE0={[]↦(∀a. a List,c), ::↦(∀a. a→a List→a List,c)}. \VE_0 = \{\href{/standard/basis/List}{\kw{[]}} \mapsto (\forall\mv{a}.\,\mv{a}\,\tList, \isc),\ \href{/standard/basis/List}{\kw{::}} \mapsto (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a}\,\tList \rightarrow \mv{a}\,\tList, \isc)\}.

The module List declares neither the type constructor List nor any constructor, so that List.List is not a long type constructor of the initial basis.

The imports of every module begin with the default imports of Figure 11, which are elaborated (Chapter 5) against ME0\ME_0. Every module they name is in Dom ME0\Dom\ME_0, and every type and value they expose is in that module’s interface; an operator they expose is one that the module declares, and binds nothing. Thus the default imports put in scope, unqualified, every type, constructor and value of Basics; the types Maybe, Result, String, Char, Program, Cmd and Sub; and the constructors of Maybe and Result. They make every value of Debug, Platform, Maybe and Result available qualified, and those of Platform.Cmd and Platform.Sub under the qualifiers Cmd and Sub. The modules Array, Bytes, Task, Process, Json.Encode, Json.Decode, VirtualDom and Html are in scope only where a module imports them.

Operators. No program declares an operator, so the operators are those of the initial basis, the same in every program; their fixities are those of Figure 3. Each is declared, by Basics or List, to stand for an identifier. The static operator table

OTSTAT:Op→finTypeScheme×IdStatus \OTstat : \cls{Op} \finmap \TypeScheme \times \IdStatus

maps each operator of Figure 3 to the type scheme and status of the identifier it stands for, and is given in Figure 40. The meaning of an operator is OTSTAT(op)\OTstat(\opv), whatever the context (Section 4.3): it is looked up in no environment and reached through no interface, so a program’s own top-level add does not capture +. The operators of library modules outside the initial basis are outside the definition. The operator :: stands for the list constructor :: of VE0\VE_0, with status c\isc, and is declared by List; every other operator is declared by Basics, as the figure records, so that the set of operators that List declares is {::}\{\kw{::}\} and that of Basics is Dom OTSTAT∖{::}\Dom\OTstat\setminus\{\kw{::}\} (no other module of ME0\ME_0 declares an operator). Every operator other than :: stands for a variable of Basics (add, eq, apR and the others of the figure) that Basics declares but does not expose. These variables are hidden: they are bound in no interface of ME0\ME_0, so that no program can write Basics.add or add for (+).

Hidden identifiers. Besides the variables that the operators stand for, the modules of ME0\ME_0 declare the following identifiers, which no interface binds and no program can name: the constructor JustOneMore of the closed type Never of Basics; and, in Task, the function command and the constructor Perform of the custom type MyCmd, which Task does not expose. In elm/core 1.0.5 that type is declared as type MyCmd msg = Perform (Task Never msg), so the task that Perform carries cannot fail. These hidden identifiers are mentioned only by the texts of values of the basis written in Elm, and their values are given in Section D.3. Library functions. The modules of ME0\ME_0 declare, in their libraries, many values that are absent from the figures, among them every function of List, String, Tuple, Array, Maybe and Result, every function of Char but toCode and fromCode, the functions of Bytes, and the encoders, decoders and views of elm/json and elm/html. Like the modules not in Dom ME0\Dom\ME_0 (Dict, Set, Bitwise, Bytes.Encode, Bytes.Decode and the rest), they are library, not language, and lie outside the definition. The module Tuple is in ME0\ME_0 only because a default import names it; its interface is empty. The type Router and the values sendToApp and sendToSelf of Platform, which serve managers, are omitted with them, effect modules being kernel-only.

C.3Basics

The interface ME0(Basics)\ME_0(\kw{Basics}) contains every type and value that Basics exposes. Its type environment is shown in Figure 37, and its value environment in Figures 38 and 39. The equality operators have a type scheme whose variable has class any\kany, so that equality elaborates at every type.

tycon ↦ (θ, {con1↦(σ1,is1),⋯ ,conn↦(σn,isn)})(n≥0)Int ↦ (Int, {})Float ↦ (Float, {})Bool ↦ (Bool, {True↦(Bool,c), False↦(Bool,c)})Order ↦ (Order, {LT↦(Order,c), EQ↦(Order,c),  (Order, {GT↦(Order,c)})Never ↦ (Never, {JustOneMore↦(Never→Never,c)}) \begin{array}{|rcl|} \hline \tycon {\ }& \mapsto {\ }& (\theta,\ \{\con_1 \mapsto (\sigma_1, \is_1), \cdots, \con_n \mapsto (\sigma_n, \is_n)\})\quad (n \ge 0)\\ \hline \htmlId{b-Basics-Int}{\href{/standard/basis/Basics/Int}{\kw{Int}}} {\ }& \mapsto {\ }& (\tInt,\ \emptymap)\\ \htmlId{b-Basics-Float}{\href{/standard/basis/Basics/Float}{\kw{Float}}} {\ }& \mapsto {\ }& (\tFloat,\ \emptymap)\\ \htmlId{b-Basics-Bool}{\href{/standard/basis/Basics/Bool}{\kw{Bool}}} {\ }& \mapsto {\ }& (\tBool,\ \{\kw{True} \mapsto (\tBool, \isc),\ \kw{False} \mapsto (\tBool, \isc)\})\\ \htmlId{b-Basics-Order}{\href{/standard/basis/Basics/Order}{\kw{Order}}} {\ }& \mapsto {\ }& (\sbtOrder,\ \{\kw{LT} \mapsto (\sbtOrder, \isc),\ \kw{EQ} \mapsto (\sbtOrder, \isc),\\ {\ }& {\ }& \phantom{(\sbtOrder,\ \{}\kw{GT} \mapsto (\sbtOrder, \isc)\})\\ \htmlId{b-Basics-Never}{\href{/standard/basis/Basics/Never}{\kw{Never}}} {\ }& \mapsto {\ }& (\sbtNever,\ \{\kw{JustOneMore} \mapsto (\sbtNever \rightarrow \sbtNever, \isc)\})\\ \hline \end{array}
Figure 37: Static TE\TE of ME0(Basics)\ME_0(\kw{Basics})
var or con ↦ (σ,is)True, False ↦ (Bool,c)LT, EQ, GT ↦ (Order,c)toFloat ↦ (Int→Float,v)round, floor ↦ (Float→Int,v)ceiling, truncate ↦ (Float→Int,v)max, min ↦ (∀comparable. comparable→comparable  (∀comparable. →comparable,v)compare ↦ (∀comparable. comparable→comparable→Order,v)not ↦ (Bool→Bool,v)xor ↦ (Bool→Bool→Bool,v)modBy, remainderBy ↦ (Int→Int→Int,v)negate, abs ↦ (∀number. number→number,v)clamp ↦ (∀number. number→number→number  (∀number. →number,v) \begin{array}{|rcl|} \hline \var\ \text{or}\ \con {\ }& \mapsto {\ }& (\sigma, \is)\\ \hline \href{/standard/basis/Basics/Bool}{\kw{True}},\ \href{/standard/basis/Basics/Bool}{\kw{False}} {\ }& \mapsto {\ }& (\tBool, \isc)\\ \href{/standard/basis/Basics/Order}{\kw{LT}},\ \href{/standard/basis/Basics/Order}{\kw{EQ}},\ \href{/standard/basis/Basics/Order}{\kw{GT}} {\ }& \mapsto {\ }& (\sbtOrder, \isc)\\ \hline \htmlId{b-Basics-toFloat}{\href{/standard/basis/Basics/toFloat}{\kw{toFloat}}} {\ }& \mapsto {\ }& (\tInt \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-round}{\href{/standard/basis/Basics/round}{\kw{round}}},\ \htmlId{b-Basics-floor}{\href{/standard/basis/Basics/floor}{\kw{floor}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tInt, \isv)\\ \htmlId{b-Basics-ceiling}{\href{/standard/basis/Basics/ceiling}{\kw{ceiling}}},\ \htmlId{b-Basics-truncate}{\href{/standard/basis/Basics/truncate}{\kw{truncate}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tInt, \isv)\\ \hline \htmlId{b-Basics-max}{\href{/standard/basis/Basics/max}{\kw{max}}},\ \htmlId{b-Basics-min}{\href{/standard/basis/Basics/min}{\kw{min}}} {\ }& \mapsto {\ }& (\forall\mv{comparable}.\,\mv{comparable} \rightarrow \mv{comparable}\\ {\ }& {\ }& \phantom{(\forall\mv{comparable}.\,}{} \rightarrow \mv{comparable}, \isv)\\ \htmlId{b-Basics-compare}{\href{/standard/basis/Basics/compare}{\kw{compare}}} {\ }& \mapsto {\ }& (\forall\mv{comparable}.\,\mv{comparable} \rightarrow \mv{comparable} \rightarrow \sbtOrder, \isv)\\ \hline \htmlId{b-Basics-not}{\href{/standard/basis/Basics/not}{\kw{not}}} {\ }& \mapsto {\ }& (\tBool \rightarrow \tBool, \isv)\\ \htmlId{b-Basics-xor}{\href{/standard/basis/Basics/xor}{\kw{xor}}} {\ }& \mapsto {\ }& (\tBool \rightarrow \tBool \rightarrow \tBool, \isv)\\ \hline \htmlId{b-Basics-modBy}{\href{/standard/basis/Basics/modBy}{\kw{modBy}}},\ \htmlId{b-Basics-remainderBy}{\href{/standard/basis/Basics/remainderBy}{\kw{remainderBy}}} {\ }& \mapsto {\ }& (\tInt \rightarrow \tInt \rightarrow \tInt, \isv)\\ \htmlId{b-Basics-negate}{\href{/standard/basis/Basics/negate}{\kw{negate}}},\ \htmlId{b-Basics-abs}{\href{/standard/basis/Basics/abs}{\kw{abs}}} {\ }& \mapsto {\ }& (\forall\mv{number}.\,\mv{number} \rightarrow \mv{number}, \isv)\\ \htmlId{b-Basics-clamp}{\href{/standard/basis/Basics/clamp}{\kw{clamp}}} {\ }& \mapsto {\ }& (\forall\mv{number}.\,\mv{number} \rightarrow \mv{number} \rightarrow \mv{number}\\ {\ }& {\ }& \phantom{(\forall\mv{number}.\,}{} \rightarrow \mv{number}, \isv)\\ \hline \end{array}
Figure 38: Static VE\VE of ME0(Basics)\ME_0(\kw{Basics}): Constructors, Conversions, Comparison, Booleans and Integer Functions
var ↦ (σ,is)sqrt ↦ (Float→Float,v)logBase ↦ (Float→Float→Float,v)e, pi ↦ (Float,v)degrees, radians ↦ (Float→Float,v)turns ↦ (Float→Float,v)cos, sin, tan ↦ (Float→Float,v)acos, asin, atan ↦ (Float→Float,v)atan2 ↦ (Float→Float→Float,v)toPolar ↦ ((Float,Float)Tuple2→(Float,Float)Tuple2,v)fromPolar ↦ ((Float,Float)Tuple2→(Float,Float)Tuple2,v)isNaN, isInfinite ↦ (Float→Bool,v)identity ↦ (∀a. a→a,v)always ↦ (∀a b. a→b→a,v)never ↦ (∀a. Never→a,v) \begin{array}{|rcl|} \hline \var {\ }& \mapsto {\ }& (\sigma, \is)\\ \hline \htmlId{b-Basics-sqrt}{\href{/standard/basis/Basics/sqrt}{\kw{sqrt}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-logBase}{\href{/standard/basis/Basics/logBase}{\kw{logBase}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-e}{\href{/standard/basis/Basics/e}{\kw{e}}},\ \htmlId{b-Basics-pi}{\href{/standard/basis/Basics/pi}{\kw{pi}}} {\ }& \mapsto {\ }& (\tFloat, \isv)\\ \htmlId{b-Basics-degrees}{\href{/standard/basis/Basics/degrees}{\kw{degrees}}},\ \htmlId{b-Basics-radians}{\href{/standard/basis/Basics/radians}{\kw{radians}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-turns}{\href{/standard/basis/Basics/turns}{\kw{turns}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-cos}{\href{/standard/basis/Basics/cos}{\kw{cos}}},\ \htmlId{b-Basics-sin}{\href{/standard/basis/Basics/sin}{\kw{sin}}},\ \htmlId{b-Basics-tan}{\href{/standard/basis/Basics/tan}{\kw{tan}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-acos}{\href{/standard/basis/Basics/acos}{\kw{acos}}},\ \htmlId{b-Basics-asin}{\href{/standard/basis/Basics/asin}{\kw{asin}}},\ \htmlId{b-Basics-atan}{\href{/standard/basis/Basics/atan}{\kw{atan}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-atan2}{\href{/standard/basis/Basics/atan2}{\kw{atan2}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat \rightarrow \tFloat, \isv)\\ \htmlId{b-Basics-toPolar}{\href{/standard/basis/Basics/toPolar}{\kw{toPolar}}} {\ }& \mapsto {\ }& ((\tFloat, \tFloat)\tTuple{2} \rightarrow (\tFloat, \tFloat)\tTuple{2}, \isv)\\ \htmlId{b-Basics-fromPolar}{\href{/standard/basis/Basics/fromPolar}{\kw{fromPolar}}} {\ }& \mapsto {\ }& ((\tFloat, \tFloat)\tTuple{2} \rightarrow (\tFloat, \tFloat)\tTuple{2}, \isv)\\ \htmlId{b-Basics-isNaN}{\href{/standard/basis/Basics/isNaN}{\kw{isNaN}}},\ \htmlId{b-Basics-isInfinite}{\href{/standard/basis/Basics/isInfinite}{\kw{isInfinite}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tBool, \isv)\\ \hline \htmlId{b-Basics-identity}{\href{/standard/basis/Basics/identity}{\kw{identity}}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a}, \isv)\\ \htmlId{b-Basics-always}{\href{/standard/basis/Basics/always}{\kw{always}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{b}.\,\mv{a} \rightarrow \mv{b} \rightarrow \mv{a}, \isv)\\ \htmlId{b-Basics-never}{\href{/standard/basis/Basics/never}{\kw{never}}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\sbtNever \rightarrow \mv{a}, \isv)\\ \hline \end{array}
Figure 39: Static VE\VE of ME0(Basics)\ME_0(\kw{Basics}): Floating-point Functions and Function Helpers
op stands for ↦ OTSTAT(op)<< composeL ↦ (∀a b c. (b→c)→(a→b)→a→c,v)>> composeR ↦ (∀a b c. (a→b)→(b→c)→a→c,v)^ pow ↦ (∀number. number→number→number,v)* mul ↦ (∀number. number→number→number,v)/ fdiv ↦ (Float→Float→Float,v)// idiv ↦ (Int→Int→Int,v)+, - add, sub ↦ (∀number. number→number→number,v)++ append ↦ (∀appendable. appendable→appendable   (∀appendable. →appendable,v)::∗ :: ↦ (∀a. a→a List→a List,c)==, /= eq, neq ↦ (∀a. a→a→Bool,v)<, > lt, gt ↦ (∀comparable. comparable→comparable→Bool,v)<=, >= le, ge ↦ (∀comparable. comparable→comparable→Bool,v)&&, || and, or ↦ (Bool→Bool→Bool,v)|> apR ↦ (∀a b. a→(a→b)→b,v)<| apL ↦ (∀a b. (a→b)→a→b,v) \begin{array}{|clcl|} \hline \opv {\ }& \text{stands for} {\ }& \mapsto {\ }& \OTstat(\opv)\\ \hline \kw{<{}<} {\ }& \htmlId{b-Basics-composeL}{\href{/standard/basis/Basics/composeL}{\kw{composeL}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{b}\,\mv{c}.\,(\mv{b} \rightarrow \mv{c}) \rightarrow (\mv{a} \rightarrow \mv{b}) \rightarrow \mv{a} \rightarrow \mv{c}, \isv)\\ \kw{>{}>} {\ }& \htmlId{b-Basics-composeR}{\href{/standard/basis/Basics/composeR}{\kw{composeR}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{b}\,\mv{c}.\,(\mv{a} \rightarrow \mv{b}) \rightarrow (\mv{b} \rightarrow \mv{c}) \rightarrow \mv{a} \rightarrow \mv{c}, \isv)\\ \kw{\textasciicircum} {\ }& \htmlId{b-Basics-pow}{\href{/standard/basis/Basics/pow}{\kw{pow}}} {\ }& \mapsto {\ }& (\forall\mv{number}.\,\mv{number} \rightarrow \mv{number} \rightarrow \mv{number}, \isv)\\ \kw{*} {\ }& \htmlId{b-Basics-mul}{\href{/standard/basis/Basics/mul}{\kw{mul}}} {\ }& \mapsto {\ }& (\forall\mv{number}.\,\mv{number} \rightarrow \mv{number} \rightarrow \mv{number}, \isv)\\ \kw{/} {\ }& \htmlId{b-Basics-fdiv}{\href{/standard/basis/Basics/fdiv}{\kw{fdiv}}} {\ }& \mapsto {\ }& (\tFloat \rightarrow \tFloat \rightarrow \tFloat, \isv)\\ \kw{//} {\ }& \htmlId{b-Basics-idiv}{\href{/standard/basis/Basics/idiv}{\kw{idiv}}} {\ }& \mapsto {\ }& (\tInt \rightarrow \tInt \rightarrow \tInt, \isv)\\ \kw{+},\ \kw{-} {\ }& \htmlId{b-Basics-add}{\href{/standard/basis/Basics/add}{\kw{add}}},\ \htmlId{b-Basics-sub}{\href{/standard/basis/Basics/sub}{\kw{sub}}} {\ }& \mapsto {\ }& (\forall\mv{number}.\,\mv{number} \rightarrow \mv{number} \rightarrow \mv{number}, \isv)\\ \kw{++} {\ }& \htmlId{b-Basics-append}{\href{/standard/basis/Basics/append}{\kw{append}}} {\ }& \mapsto {\ }& (\forall\mv{appendable}.\,\mv{appendable} \rightarrow \mv{appendable}\\ {\ }& {\ }& {\ }& \phantom{(\forall\mv{appendable}.\,}{} \rightarrow \mv{appendable}, \isv)\\ \kw{::}^{*} {\ }& \href{/standard/basis/List}{\kw{::}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a}\,\tList \rightarrow \mv{a}\,\tList, \isc)\\ \kw{==},\ \kw{/=} {\ }& \htmlId{b-Basics-eq}{\href{/standard/basis/Basics/eq}{\kw{eq}}},\ \htmlId{b-Basics-neq}{\href{/standard/basis/Basics/neq}{\kw{neq}}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a} \rightarrow \tBool, \isv)\\ \kw{<},\ \kw{>} {\ }& \htmlId{b-Basics-lt}{\href{/standard/basis/Basics/lt}{\kw{lt}}},\ \htmlId{b-Basics-gt}{\href{/standard/basis/Basics/gt}{\kw{gt}}} {\ }& \mapsto {\ }& (\forall\mv{comparable}.\,\mv{comparable} \rightarrow \mv{comparable} \rightarrow \tBool, \isv)\\ \kw{<=},\ \kw{>=} {\ }& \htmlId{b-Basics-le}{\href{/standard/basis/Basics/le}{\kw{le}}},\ \htmlId{b-Basics-ge}{\href{/standard/basis/Basics/ge}{\kw{ge}}} {\ }& \mapsto {\ }& (\forall\mv{comparable}.\,\mv{comparable} \rightarrow \mv{comparable} \rightarrow \tBool, \isv)\\ \kw{\&\&},\ \kw{||} {\ }& \htmlId{b-Basics-and}{\href{/standard/basis/Basics/and}{\kw{and}}},\ \htmlId{b-Basics-or}{\href{/standard/basis/Basics/or}{\kw{or}}} {\ }& \mapsto {\ }& (\tBool \rightarrow \tBool \rightarrow \tBool, \isv)\\ \kw{|>} {\ }& \htmlId{b-Basics-apR}{\href{/standard/basis/Basics/apR}{\kw{apR}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{b}.\,\mv{a} \rightarrow (\mv{a} \rightarrow \mv{b}) \rightarrow \mv{b}, \isv)\\ \kw{<|} {\ }& \htmlId{b-Basics-apL}{\href{/standard/basis/Basics/apL}{\kw{apL}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{b}.\,(\mv{a} \rightarrow \mv{b}) \rightarrow \mv{a} \rightarrow \mv{b}, \isv)\\ \hline \end{array}

∗{}^{*} Declared by List to stand for the list constructor :: of VE0\VE_0. Every other operator is declared by Basics to stand for the hidden variable shown.

Figure 40: The Static Operator Table, OTSTAT\OTstat

The operators of Figure 40 are listed in decreasing order of precedence. The infixed forms of && and || are derived forms (Appendix A), which elaborate as conditional expressions; the type schemes of and and or are those of the operator values (&&) and (||).

C.4Further Data Types

The interfaces of Maybe, Result, String, Char, Array and Bytes are shown in Figure 41. The interfaces of List and Tuple bind no type constructor and no value; the list type and the list constructors are those of E0E_0 (Section C.2), and the meaning of the operator :: that List declares is OTSTAT(::)\OTstat(\kw{::}) (Figure 40).

MaybeMaybe ↦ (Maybe, {Just↦(∀a. a→a Maybe,c),  (Maybe, {Nothing↦(∀a. a Maybe,c)})Just ↦ (∀a. a→a Maybe,c)Nothing ↦ (∀a. a Maybe,c)ResultResult ↦ (Result, {Ok↦(∀x a. a→(x,a)Result,c),  (Result, {Err↦(∀x a. x→(x,a)Result,c)})Ok ↦ (∀x a. a→(x,a)Result,c)Err ↦ (∀x a. x→(x,a)Result,c)StringString ↦ (String, {})CharChar ↦ (Char, {})toCode ↦ (Char→Int,v)fromCode ↦ (Int→Char,v)ArrayArray ↦ (Array, {})BytesBytes ↦ (Bytes, {}) \begin{array}{|rcl|} \hline \kw{Maybe}&&\\ \hline \htmlId{b-Maybe-Maybe}{\href{/standard/basis/Maybe/Maybe}{\kw{Maybe}}} {\ }& \mapsto {\ }& (\tMaybe,\ \{\kw{Just} \mapsto (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a}\,\tMaybe, \isc),\\ {\ }& {\ }& \phantom{(\tMaybe,\ \{}\kw{Nothing} \mapsto (\forall\mv{a}.\,\mv{a}\,\tMaybe, \isc)\})\\ \hline \href{/standard/basis/Maybe/Maybe}{\kw{Just}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a} \rightarrow \mv{a}\,\tMaybe, \isc)\\ \href{/standard/basis/Maybe/Maybe}{\kw{Nothing}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a}\,\tMaybe, \isc)\\ \hline \kw{Result}&&\\ \hline \htmlId{b-Result-Result}{\href{/standard/basis/Result/Result}{\kw{Result}}} {\ }& \mapsto {\ }& (\sbtResult,\ \{\kw{Ok} \mapsto (\forall\mv{x}\,\mv{a}.\,\mv{a} \rightarrow (\mv{x}, \mv{a})\sbtResult, \isc),\\ {\ }& {\ }& \phantom{(\sbtResult,\ \{}\kw{Err} \mapsto (\forall\mv{x}\,\mv{a}.\,\mv{x} \rightarrow (\mv{x}, \mv{a})\sbtResult, \isc)\})\\ \hline \href{/standard/basis/Result/Result}{\kw{Ok}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}.\,\mv{a} \rightarrow (\mv{x}, \mv{a})\sbtResult, \isc)\\ \href{/standard/basis/Result/Result}{\kw{Err}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}.\,\mv{x} \rightarrow (\mv{x}, \mv{a})\sbtResult, \isc)\\ \hline \kw{String}&&\\ \hline \htmlId{b-String-String}{\href{/standard/basis/String/String}{\kw{String}}} {\ }& \mapsto {\ }& (\tString,\ \emptymap)\\ \hline \kw{Char}&&\\ \hline \htmlId{b-Char-Char}{\href{/standard/basis/Char/Char}{\kw{Char}}} {\ }& \mapsto {\ }& (\tChar,\ \emptymap)\\ \hline \htmlId{b-Char-toCode}{\href{/standard/basis/Char/toCode}{\kw{toCode}}} {\ }& \mapsto {\ }& (\tChar \rightarrow \tInt, \isv)\\ \htmlId{b-Char-fromCode}{\href{/standard/basis/Char/fromCode}{\kw{fromCode}}} {\ }& \mapsto {\ }& (\tInt \rightarrow \tChar, \isv)\\ \hline \kw{Array}&&\\ \hline \htmlId{b-Array-Array}{\href{/standard/basis/Array/Array}{\kw{Array}}} {\ }& \mapsto {\ }& (\tArray,\ \emptymap)\\ \hline \kw{Bytes}&&\\ \hline \htmlId{b-Bytes-Bytes}{\href{/standard/basis/Bytes/Bytes}{\kw{Bytes}}} {\ }& \mapsto {\ }& (\tBytes,\ \emptymap)\\ \hline \end{array}
Figure 41: Static Interfaces of Maybe, Result, String, Char, Array and Bytes

C.5Debugging, Programs and Effects

The interfaces of the remaining modules are shown in Figures 42, 43 and 44. The meanings of the values of Debug are given in Appendix D. Since the result type of Debug.todo is a bound variable of its type scheme, an application of Debug.todo elaborates to every type. Chapter 8 builds task, command and subscription values from the values of Platform.Cmd, Platform.Sub, Task and Process, and Platform.worker makes a program (Chapter 9). The function command of Task and the constructor Perform of its custom type MyCmd are hidden (Section C.2): they are absent from the interface of Task, and are reached only through the texts of perform and attempt, whose environment (Section D.3) binds them. The values of ports are not in ME0\ME_0: a port is declared by a module of a program (Section 5.4). The type constructors Task.Task and Process.Id are type aliases in their libraries; the type functions they are bound to are the type names Task\sbtTask and ProcessId\sbtProcessId themselves (Section 4.5), and likewise Json.Decode.Value is bound to Value\tValue and Html.Html to Node\sbtNode.

Debuglog ↦ (∀a. String→a→a,v)todo ↦ (∀a. String→a,v)toString ↦ (∀a. a→String,v)PlatformProgram ↦ (Program, {})Task ↦ (Task, {})ProcessId ↦ (ProcessId, {})worker ↦ (∀flags model msg.  {init↦flags→(model,msg Cmd)Tuple2,  {update↦msg→model→(model,msg Cmd)Tuple2,  {subscriptions↦model→msg Sub}  →(flags,model,msg)Program, v)Platform.CmdCmd ↦ (Cmd, {})none ↦ (∀msg. msg Cmd,v)batch ↦ (∀msg. (msg Cmd)List→msg Cmd,v)map ↦ (∀a msg. (a→msg)→a Cmd→msg Cmd,v)Platform.SubSub ↦ (Sub, {})none ↦ (∀msg. msg Sub,v)batch ↦ (∀msg. (msg Sub)List→msg Sub,v)map ↦ (∀a msg. (a→msg)→a Sub→msg Sub,v) \begin{array}{|rcl|} \hline \kw{Debug}&&\\ \hline \htmlId{b-Debug-log}{\href{/standard/basis/Debug/log}{\kw{log}}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\tString \rightarrow \mv{a} \rightarrow \mv{a}, \isv)\\ \htmlId{b-Debug-todo}{\href{/standard/basis/Debug/todo}{\kw{todo}}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\tString \rightarrow \mv{a}, \isv)\\ \htmlId{b-Debug-toString}{\href{/standard/basis/Debug/toString}{\kw{toString}}} {\ }& \mapsto {\ }& (\forall\mv{a}.\,\mv{a} \rightarrow \tString, \isv)\\ \hline \kw{Platform}&&\\ \hline \htmlId{b-Platform-Program}{\href{/standard/basis/Platform/Program}{\kw{Program}}} {\ }& \mapsto {\ }& (\sbtProgram,\ \emptymap)\\ \htmlId{b-Platform-Task}{\href{/standard/basis/Platform/Task}{\kw{Task}}} {\ }& \mapsto {\ }& (\sbtTask,\ \emptymap)\\ \htmlId{b-Platform-ProcessId}{\href{/standard/basis/Platform/ProcessId}{\kw{ProcessId}}} {\ }& \mapsto {\ }& (\sbtProcessId,\ \emptymap)\\ \hline \htmlId{b-Platform-worker}{\href{/standard/basis/Platform/worker}{\kw{worker}}} {\ }& \mapsto {\ }& (\forall\mv{flags}\,\mv{model}\,\mv{msg}.\\ {\ }& {\ }& \quad\{\kw{init} \mapsto \mv{flags} \rightarrow (\mv{model}, \mv{msg}\,\sbtCmd)\tTuple{2},\\ {\ }& {\ }& \quad\phantom{\{}\kw{update} \mapsto \mv{msg} \rightarrow \mv{model} \rightarrow (\mv{model}, \mv{msg}\,\sbtCmd)\tTuple{2},\\ {\ }& {\ }& \quad\phantom{\{}\kw{subscriptions} \mapsto \mv{model} \rightarrow \mv{msg}\,\sbtSub\}\\ {\ }& {\ }& \quad{} \rightarrow (\mv{flags}, \mv{model}, \mv{msg})\sbtProgram,\ \isv)\\ \hline \kw{Platform.Cmd}&&\\ \hline \htmlId{b-Platform-Cmd-Cmd}{\href{/standard/basis/Platform/Cmd/Cmd}{\kw{Cmd}}} {\ }& \mapsto {\ }& (\sbtCmd,\ \emptymap)\\ \hline \htmlId{b-Platform-Cmd-none}{\href{/standard/basis/Platform/Cmd/none}{\kw{none}}} {\ }& \mapsto {\ }& (\forall\mv{msg}.\,\mv{msg}\,\sbtCmd, \isv)\\ \htmlId{b-Platform-Cmd-batch}{\href{/standard/basis/Platform/Cmd/batch}{\kw{batch}}} {\ }& \mapsto {\ }& (\forall\mv{msg}.\,(\mv{msg}\,\sbtCmd)\tList \rightarrow \mv{msg}\,\sbtCmd, \isv)\\ \htmlId{b-Platform-Cmd-map}{\href{/standard/basis/Platform/Cmd/map}{\kw{map}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{msg}.\,(\mv{a} \rightarrow \mv{msg}) \rightarrow \mv{a}\,\sbtCmd \rightarrow \mv{msg}\,\sbtCmd, \isv)\\ \hline \kw{Platform.Sub}&&\\ \hline \htmlId{b-Platform-Sub-Sub}{\href{/standard/basis/Platform/Sub/Sub}{\kw{Sub}}} {\ }& \mapsto {\ }& (\sbtSub,\ \emptymap)\\ \hline \htmlId{b-Platform-Sub-none}{\href{/standard/basis/Platform/Sub/none}{\kw{none}}} {\ }& \mapsto {\ }& (\forall\mv{msg}.\,\mv{msg}\,\sbtSub, \isv)\\ \htmlId{b-Platform-Sub-batch}{\href{/standard/basis/Platform/Sub/batch}{\kw{batch}}} {\ }& \mapsto {\ }& (\forall\mv{msg}.\,(\mv{msg}\,\sbtSub)\tList \rightarrow \mv{msg}\,\sbtSub, \isv)\\ \htmlId{b-Platform-Sub-map}{\href{/standard/basis/Platform/Sub/map}{\kw{map}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{msg}.\,(\mv{a} \rightarrow \mv{msg}) \rightarrow \mv{a}\,\sbtSub \rightarrow \mv{msg}\,\sbtSub, \isv)\\ \hline \end{array}
Figure 42: Static Interfaces of Debug and the Platform Modules
TaskTask ↦ (Task, {})succeed ↦ (∀x a. a→(x,a)Task,v)fail ↦ (∀x a. x→(x,a)Task,v)map ↦ (∀x a b. (a→b)→(x,a)Task→(x,b)Task,v)map2 ↦ (∀x a b r. (a→b→r)→(x,a)Task→(x,b)Task  (∀x a b r. →(x,r)Task,v)map3 ↦ (∀x a b c r. (a→b→c→r)→(x,a)Task→(x,b)Task  (∀x a b c r. →(x,c)Task→(x,r)Task,v)map4 ↦ (∀x a b c d r. (a→b→c→d→r)→(x,a)Task  (∀x a b c d r. →(x,b)Task→(x,c)Task→(x,d)Task  (∀x a b c d r. →(x,r)Task,v)map5 ↦ (∀x a b c d e r. (a→b→c→d→e→r)→(x,a)Task  (∀x a b c d e r. →(x,b)Task→(x,c)Task→(x,d)Task  (∀x a b c d e r. →(x,e)Task→(x,r)Task,v)sequence ↦ (∀x a. ((x,a)Task)List→(x,a List)Task,v)andThen ↦ (∀x a b. (a→(x,b)Task)→(x,a)Task  (∀x a b. →(x,b)Task,v)onError ↦ (∀x y a. (x→(y,a)Task)→(x,a)Task  (∀x y a. →(y,a)Task,v)mapError ↦ (∀x y a. (x→y)→(x,a)Task→(y,a)Task,v)perform ↦ (∀a msg. (a→msg)→(Never,a)Task→msg Cmd,v)attempt ↦ (∀x a msg. ((x,a)Result→msg)→(x,a)Task  (∀x a msg. →msg Cmd,v) \begin{array}{|rcl|} \hline \kw{Task}&&\\ \hline \htmlId{b-Task-Task}{\href{/standard/basis/Task/Task}{\kw{Task}}} {\ }& \mapsto {\ }& (\sbtTask,\ \emptymap)\\ \hline \htmlId{b-Task-succeed}{\href{/standard/basis/Task/succeed}{\kw{succeed}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}.\,\mv{a} \rightarrow (\mv{x}, \mv{a})\sbtTask, \isv)\\ \htmlId{b-Task-fail}{\href{/standard/basis/Task/fail}{\kw{fail}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}.\,\mv{x} \rightarrow (\mv{x}, \mv{a})\sbtTask, \isv)\\ \htmlId{b-Task-map}{\href{/standard/basis/Task/map}{\kw{map}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}\,\mv{b}.\,(\mv{a} \rightarrow \mv{b}) \rightarrow (\mv{x}, \mv{a})\sbtTask \rightarrow (\mv{x}, \mv{b})\sbtTask, \isv)\\ \htmlId{b-Task-map2}{\href{/standard/basis/Task/map2}{\kw{map2}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{r}.\,(\mv{a} \rightarrow \mv{b} \rightarrow \mv{r}) \rightarrow (\mv{x}, \mv{a})\sbtTask \rightarrow (\mv{x}, \mv{b})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{r}.\,}{} \rightarrow (\mv{x}, \mv{r})\sbtTask, \isv)\\ \htmlId{b-Task-map3}{\href{/standard/basis/Task/map3}{\kw{map3}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{r}.\,(\mv{a} \rightarrow \mv{b} \rightarrow \mv{c} \rightarrow \mv{r}) \rightarrow (\mv{x}, \mv{a})\sbtTask \rightarrow (\mv{x}, \mv{b})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{r}.\,}{} \rightarrow (\mv{x}, \mv{c})\sbtTask \rightarrow (\mv{x}, \mv{r})\sbtTask, \isv)\\ \htmlId{b-Task-map4}{\href{/standard/basis/Task/map4}{\kw{map4}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{d}\,\mv{r}.\,(\mv{a} \rightarrow \mv{b} \rightarrow \mv{c} \rightarrow \mv{d} \rightarrow \mv{r}) \rightarrow (\mv{x}, \mv{a})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{d}\,\mv{r}.\,}{} \rightarrow (\mv{x}, \mv{b})\sbtTask \rightarrow (\mv{x}, \mv{c})\sbtTask \rightarrow (\mv{x}, \mv{d})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{d}\,\mv{r}.\,}{} \rightarrow (\mv{x}, \mv{r})\sbtTask, \isv)\\ \htmlId{b-Task-map5}{\href{/standard/basis/Task/map5}{\kw{map5}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{d}\,\mv{e}\,\mv{r}.\,(\mv{a} \rightarrow \mv{b} \rightarrow \mv{c} \rightarrow \mv{d} \rightarrow \mv{e} \rightarrow \mv{r}) \rightarrow (\mv{x}, \mv{a})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{d}\,\mv{e}\,\mv{r}.\,}{} \rightarrow (\mv{x}, \mv{b})\sbtTask \rightarrow (\mv{x}, \mv{c})\sbtTask \rightarrow (\mv{x}, \mv{d})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{b}\,\mv{c}\,\mv{d}\,\mv{e}\,\mv{r}.\,}{} \rightarrow (\mv{x}, \mv{e})\sbtTask \rightarrow (\mv{x}, \mv{r})\sbtTask, \isv)\\ \htmlId{b-Task-sequence}{\href{/standard/basis/Task/sequence}{\kw{sequence}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}.\,((\mv{x}, \mv{a})\sbtTask)\tList \rightarrow (\mv{x}, \mv{a}\,\tList)\sbtTask, \isv)\\ \htmlId{b-Task-andThen}{\href{/standard/basis/Task/andThen}{\kw{andThen}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}\,\mv{b}.\,(\mv{a} \rightarrow (\mv{x}, \mv{b})\sbtTask) \rightarrow (\mv{x}, \mv{a})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{b}.\,}{} \rightarrow (\mv{x}, \mv{b})\sbtTask, \isv)\\ \htmlId{b-Task-onError}{\href{/standard/basis/Task/onError}{\kw{onError}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{y}\,\mv{a}.\,(\mv{x} \rightarrow (\mv{y}, \mv{a})\sbtTask) \rightarrow (\mv{x}, \mv{a})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{y}\,\mv{a}.\,}{} \rightarrow (\mv{y}, \mv{a})\sbtTask, \isv)\\ \htmlId{b-Task-mapError}{\href{/standard/basis/Task/mapError}{\kw{mapError}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{y}\,\mv{a}.\,(\mv{x} \rightarrow \mv{y}) \rightarrow (\mv{x}, \mv{a})\sbtTask \rightarrow (\mv{y}, \mv{a})\sbtTask, \isv)\\ \htmlId{b-Task-perform}{\href{/standard/basis/Task/perform}{\kw{perform}}} {\ }& \mapsto {\ }& (\forall\mv{a}\,\mv{msg}.\,(\mv{a} \rightarrow \mv{msg}) \rightarrow (\sbtNever, \mv{a})\sbtTask \rightarrow \mv{msg}\,\sbtCmd, \isv)\\ \htmlId{b-Task-attempt}{\href{/standard/basis/Task/attempt}{\kw{attempt}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{a}\,\mv{msg}.\,((\mv{x}, \mv{a})\sbtResult \rightarrow \mv{msg}) \rightarrow (\mv{x}, \mv{a})\sbtTask\\ {\ }& {\ }& \phantom{(\forall\mv{x}\,\mv{a}\,\mv{msg}.\,}{} \rightarrow \mv{msg}\,\sbtCmd, \isv)\\ \hline \end{array}
Figure 43: Static Interface of Task
ProcessId ↦ (ProcessId, {})spawn ↦ (∀x y a. (x,a)Task→(y,ProcessId)Task,v)sleep ↦ (∀x. Float→(x,())Task,v)kill ↦ (∀x. ProcessId→(x,())Task,v)Json.Encode and Json.DecodeValue ↦ (Value, {})VirtualDomNode ↦ (Node, {})HtmlHtml ↦ (Node, {}) \begin{array}{|rcl|} \hline \kw{Process}&&\\ \hline \htmlId{b-Process-Id}{\href{/standard/basis/Process/Id}{\kw{Id}}} {\ }& \mapsto {\ }& (\sbtProcessId,\ \emptymap)\\ \hline \htmlId{b-Process-spawn}{\href{/standard/basis/Process/spawn}{\kw{spawn}}} {\ }& \mapsto {\ }& (\forall\mv{x}\,\mv{y}\,\mv{a}.\,(\mv{x}, \mv{a})\sbtTask \rightarrow (\mv{y}, \sbtProcessId)\sbtTask, \isv)\\ \htmlId{b-Process-sleep}{\href{/standard/basis/Process/sleep}{\kw{sleep}}} {\ }& \mapsto {\ }& (\forall\mv{x}.\,\tFloat \rightarrow (\mv{x}, \tunit)\sbtTask, \isv)\\ \htmlId{b-Process-kill}{\href{/standard/basis/Process/kill}{\kw{kill}}} {\ }& \mapsto {\ }& (\forall\mv{x}.\,\sbtProcessId \rightarrow (\mv{x}, \tunit)\sbtTask, \isv)\\ \hline \kw{Json.Encode}\ \text{and}\ \kw{Json.Decode}&&\\ \hline \htmlId{b-Json-Decode-Value}{\htmlId{b-Json-Encode-Value}{\href{/standard/basis/Json/Encode/Value}{\kw{Value}}}} {\ }& \mapsto {\ }& (\tValue,\ \emptymap)\\ \hline \kw{VirtualDom}&&\\ \hline \htmlId{b-VirtualDom-Node}{\href{/standard/basis/VirtualDom/Node}{\kw{Node}}} {\ }& \mapsto {\ }& (\sbtNode,\ \emptymap)\\ \hline \kw{Html}&&\\ \hline \htmlId{b-Html-Html}{\href{/standard/basis/Html/Html}{\kw{Html}}} {\ }& \mapsto {\ }& (\sbtNode,\ \emptymap)\\ \hline \end{array}
Figure 44: Static Interfaces of Process, Json and View Modules

Discussions

Discuss this chapter·Search the discussions on GitHub

Discussions are on GitHub; one about this chapter has [ch:appendix-static-basis] 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.