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
B 0 = T 0 , M E 0 , P E 0 , where P E 0 = { } ,
B_0 = T_0, \ME_0, \PE_0, \qquad\text{where}\ \PE_0 = \emptymap,
B 0 = T 0 , ME 0 , PE 0 , where PE 0 = { } , T 0 T_0 T 0 is given in Section C.1 and M E 0 \ME_0 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: n u m b e r \mv{number} number has class n u m b e r \knum number , c o m p a r a b l e \mv{comparable} comparable has class c o m p a r a b l e \kcomp comparable , a p p e n d a b l e \mv{appendable} appendable has class a p p e n d a b l e \kapp appendable , and every other variable written here (a \mv{a} a , b \mv{b} b , c \mv{c} c , d \mv{d} d , e \mv{e} e , r \mv{r} r , x \mv{x} x , y \mv{y} y , m s g \mv{msg} msg , f l a g s \mv{flags} flags , m o d e l \mv{model} model ) has class a n y \kany any . No variable of class c o m p a p p e n d \kcapp compappend 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 M a y b e \mv{a}\,\tMaybe a Maybe , and Task x
a is ( x , a ) T a s k (\mv{x}, \mv{a})\sbtTask ( x , a ) Task .
C.1 Type Names¶ The set of type names of the initial basis is
T 0 = { I n t , F l o a t , C h a r , S t r i n g , ( ) , L i s t , T u p l e 2 , T u p l e 3 , { B o o l , O r d e r , N e v e r , M a y b e , R e s u l t , A r r a y , B y t e s , V a l u e , { C m d , S u b , T a s k , P r o c e s s I d , P r o g r a m , N o d e } .
\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}
T 0 = { Int , Float , Char , String , ( ) , List , Tuple 2 , Tuple 3 , { Bool , Order , Never , Maybe , Result , Array , Bytes , Value , { Cmd , Sub , Task , ProcessId , Program , Node } . The members of T 0 T_0 T 0 are type names, not type constructors; we have spelt each as a type constructor bound to it in M E 0 \ME_0 ME 0 , or, for ( ) \tunit ( ) and T u p l e k \tTuple{k} Tuple 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 ( ) , T u p l e 2 \tTuple{2} Tuple 2 and T u p l e 3 \tTuple{3} Tuple 3 are bound to no type constructor: the type expressions () and ( t y 1 , t y 2 ⟨ , t y 3 ⟩ \,\ty_1\kw{,}\,\ty_2\opt{\kw{,}\,\ty_3}\, ty 1 , ty 2 ⟨ , 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 T 0 T_0 T 0 other than I n t \tInt Int , F l o a t \tFloat Float , C h a r \tChar Char , S t r i n g \tString String , L i s t \tList List , T u p l e 2 \tTuple{2} Tuple 2 and T u p l e 3 \tTuple{3} Tuple 3 is admissible for no class but a n y \kany any .
t t t arity bound to \text{bound to} bound to I n t \tInt Int 0 Basics.Int \kw{Basics.Int} Basics.Int F l o a t \tFloat Float 0 Basics.Float \kw{Basics.Float} Basics.Float C h a r \tChar Char 0 Char.Char \kw{Char.Char} Char.Char S t r i n g \tString String 0 String.String \kw{String.String} String.String ( ) \tunit ( ) 0 (none) \text{(none)} (none) L i s t \tList List 1 List (Section C.2) \kw{List}\ \text{(Section~C.2)} List (Section C.2) T u p l e 2 \tTuple{2} Tuple 2 2 (none) \text{(none)} (none) T u p l e 3 \tTuple{3} Tuple 3 3 (none) \text{(none)} (none) B o o l \tBool Bool 0 Basics.Bool \kw{Basics.Bool} Basics.Bool O r d e r \sbtOrder Order 0 Basics.Order \kw{Basics.Order} Basics.Order N e v e r \sbtNever Never 0 Basics.Never \kw{Basics.Never} Basics.Never M a y b e \tMaybe Maybe 1 Maybe.Maybe \kw{Maybe.Maybe} Maybe.Maybe R e s u l t \sbtResult Result 2 Result.Result \kw{Result.Result} Result.Result A r r a y \tArray Array 1 Array.Array \kw{Array.Array} Array.Array B y t e s \tBytes Bytes 0 Bytes.Bytes \kw{Bytes.Bytes} Bytes.Bytes V a l u e \tValue Value 0 Json.Encode.Value , Json.Decode.Value \kw{Json.Encode.Value},\ \kw{Json.Decode.Value} Json.Encode.Value , Json.Decode.Value C m d \sbtCmd Cmd 1 Platform.Cmd.Cmd \kw{Platform.Cmd.Cmd} Platform.Cmd.Cmd S u b \sbtSub Sub 1 Platform.Sub.Sub \kw{Platform.Sub.Sub} Platform.Sub.Sub T a s k \sbtTask Task 2 Platform.Task , Task.Task \kw{Platform.Task},\ \kw{Task.Task} Platform.Task , Task.Task P r o c e s s I d \sbtProcessId ProcessId 0 Platform.ProcessId , Process.Id \kw{Platform.ProcessId},\ \kw{Process.Id} Platform.ProcessId , Process.Id P r o g r a m \sbtProgram Program 3 Platform.Program \kw{Platform.Program} Platform.Program N o d e \sbtNode Node 1 VirtualDom.Node , Html.Html \kw{VirtualDom.Node},\ \kw{Html.Html} VirtualDom.Node , Html.Html
Figure 36 : Type Names of the Initial Basis, T 0 T_0 T 0 The type names B o o l \tBool Bool , O r d e r \sbtOrder Order , M a y b e \tMaybe Maybe and R e s u l t \sbtResult Result are those of custom types whose constructors M E 0 \ME_0 ME 0 exposes; N e v e r \sbtNever Never 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 N e v e r \sbtNever Never . The others are abstract : M E 0 \ME_0 ME 0 binds them with no constructors, and their values are given by the dynamic basis (Appendix D ) and Chapter 8 .
C.2 The Module Environment¶ The module environment M E 0 \ME_0 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}
{ Basics , List , Maybe , Result , String , Char , Tuple , Array , Bytes , Debug , { Platform , Platform.Cmd , Platform.Sub , Task , Process , { Json.Encode , Json.Decode , VirtualDom , Html } . The interface M E 0 ( m o d i d ) \ME_0(\modid) ME 0 ( modid ) of each module is an environment ( { } , T E , V E ) (\emptymap, \TE, \VE) ({ } , 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 v and every constructor status c \isc c , 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 M E 0 \ME_0 ME 0 are those of T 0 T_0 T 0 :
t y n a m e s M E 0 ⊆ T 0 .
\tynames \ME_0 \subseteq T_0 .
tynames ME 0 ⊆ T 0 . Every module of M E 0 \ME_0 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 M E 0 \ME_0 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
E 0 = ( { } , T E 0 , V E 0 ) , T E 0 = { List ↦ ( L i s t , V E 0 ) } ,
E_0 = (\emptymap, \TE_0, \VE_0), \qquad
\TE_0 = \{\htmlId{b-List}{\href{/standard/basis/List}{\kw{List}}} \mapsto (\tList, \VE_0)\},
E 0 = ({ } , TE 0 , VE 0 ) , TE 0 = { List ↦ ( List , VE 0 )} , where
V E 0 = { [] ↦ ( ∀ a . a L i s t , c ) , :: ↦ ( ∀ a . a → a L i s t → a L i s t , 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)\}.
VE 0 = { [] ↦ ( ∀ a . a List , c ) , :: ↦ ( ∀ a . a → a List → a List , c )} . 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 M E 0 \ME_0 ME 0 . Every module they name is in D o m M E 0 \Dom\ME_0 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
O T S T A T : O p → f i n T y p e S c h e m e × I d S t a t u s
\OTstat : \cls{Op} \finmap \TypeScheme \times \IdStatus
OT STAT : Op fin TypeScheme × 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 O T S T A T ( o p ) \OTstat(\opv) OT STAT ( op ) , 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 V E 0 \VE_0 VE 0 , with status c \isc c , 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 D o m O T S T A T ∖ { :: } \Dom\OTstat\setminus\{\kw{::}\} Dom OT STAT ∖ { :: } (no other module of M E 0 \ME_0 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 M E 0 \ME_0 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 M E 0 \ME_0 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 M E 0 \ME_0 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 D o m M E 0 \Dom\ME_0 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 M E 0 \ME_0 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.3 Basics¶ The interface M E 0 ( Basics ) \ME_0(\kw{Basics}) ME 0 ( 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 a n y \kany any , so that equality elaborates at every type.
t y c o n ↦ ( θ , { c o n 1 ↦ ( σ 1 , i s 1 ) , ⋯ , c o n n ↦ ( σ n , i s n ) } ) ( n ≥ 0 ) Int ↦ ( I n t , { } ) Float ↦ ( F l o a t , { } ) Bool ↦ ( B o o l , { True ↦ ( B o o l , c ) , False ↦ ( B o o l , c ) } ) Order ↦ ( O r d e r , { LT ↦ ( O r d e r , c ) , EQ ↦ ( O r d e r , c ) , ( O r d e r , { GT ↦ ( O r d e r , c ) } ) Never ↦ ( N e v e r , { JustOneMore ↦ ( N e v e r → N e v e r , 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}
tycon Int Float Bool Order Never ↦ ↦ ↦ ↦ ↦ ↦ ( θ , { con 1 ↦ ( σ 1 , is 1 ) , ⋯ , con n ↦ ( σ n , is n )}) ( n ≥ 0 ) ( Int , { }) ( Float , { }) ( Bool , { True ↦ ( Bool , c ) , False ↦ ( Bool , c )}) ( Order , { LT ↦ ( Order , c ) , EQ ↦ ( Order , c ) , ( Order , { GT ↦ ( Order , c )}) ( Never , { JustOneMore ↦ ( Never → Never , c )}) Figure 37 : Static T E \TE TE of M E 0 ( Basics ) \ME_0(\kw{Basics}) ME 0 ( Basics ) v a r or c o n ↦ ( σ , i s ) True , False ↦ ( B o o l , c ) LT , EQ , GT ↦ ( O r d e r , c ) toFloat ↦ ( I n t → F l o a t , v ) round , floor ↦ ( F l o a t → I n t , v ) ceiling , truncate ↦ ( F l o a t → I n t , v ) max , min ↦ ( ∀ c o m p a r a b l e . c o m p a r a b l e → c o m p a r a b l e ( ∀ c o m p a r a b l e . → c o m p a r a b l e , v ) compare ↦ ( ∀ c o m p a r a b l e . c o m p a r a b l e → c o m p a r a b l e → O r d e r , v ) not ↦ ( B o o l → B o o l , v ) xor ↦ ( B o o l → B o o l → B o o l , v ) modBy , remainderBy ↦ ( I n t → I n t → I n t , v ) negate , abs ↦ ( ∀ n u m b e r . n u m b e r → n u m b e r , v ) clamp ↦ ( ∀ n u m b e r . n u m b e r → n u m b e r → n u m b e r ( ∀ n u m b e r . → n u m b e r , 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}
var or con True , False LT , EQ , GT toFloat round , floor ceiling , truncate max , min compare not xor modBy , remainderBy negate , abs clamp ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ( σ , is ) ( Bool , c ) ( Order , c ) ( Int → Float , v ) ( Float → Int , v ) ( Float → Int , v ) ( ∀ comparable . comparable → comparable ( ∀ comparable . → comparable , v ) ( ∀ comparable . comparable → comparable → Order , v ) ( Bool → Bool , v ) ( Bool → Bool → Bool , v ) ( Int → Int → Int , v ) ( ∀ number . number → number , v ) ( ∀ number . number → number → number ( ∀ number . → number , v ) Figure 38 : Static V E \VE VE of M E 0 ( Basics ) \ME_0(\kw{Basics}) ME 0 ( Basics ) : Constructors, Conversions, Comparison, Booleans and Integer Functionsv a r ↦ ( σ , i s ) sqrt ↦ ( F l o a t → F l o a t , v ) logBase ↦ ( F l o a t → F l o a t → F l o a t , v ) e , pi ↦ ( F l o a t , v ) degrees , radians ↦ ( F l o a t → F l o a t , v ) turns ↦ ( F l o a t → F l o a t , v ) cos , sin , tan ↦ ( F l o a t → F l o a t , v ) acos , asin , atan ↦ ( F l o a t → F l o a t , v ) atan2 ↦ ( F l o a t → F l o a t → F l o a t , v ) toPolar ↦ ( ( F l o a t , F l o a t ) T u p l e 2 → ( F l o a t , F l o a t ) T u p l e 2 , v ) fromPolar ↦ ( ( F l o a t , F l o a t ) T u p l e 2 → ( F l o a t , F l o a t ) T u p l e 2 , v ) isNaN , isInfinite ↦ ( F l o a t → B o o l , v ) identity ↦ ( ∀ a . a → a , v ) always ↦ ( ∀ a b . a → b → a , v ) never ↦ ( ∀ a . N e v e r → 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}
var sqrt logBase e , pi degrees , radians turns cos , sin , tan acos , asin , atan atan2 toPolar fromPolar isNaN , isInfinite identity always never ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ( σ , is ) ( Float → Float , v ) ( Float → Float → Float , v ) ( Float , v ) ( Float → Float , v ) ( Float → Float , v ) ( Float → Float , v ) ( Float → Float , v ) ( Float → Float → Float , v ) (( Float , Float ) Tuple 2 → ( Float , Float ) Tuple 2 , v ) (( Float , Float ) Tuple 2 → ( Float , Float ) Tuple 2 , v ) ( Float → Bool , v ) ( ∀ a . a → a , v ) ( ∀ a b . a → b → a , v ) ( ∀ a . Never → a , v ) Figure 39 : Static V E \VE VE of M E 0 ( Basics ) \ME_0(\kw{Basics}) ME 0 ( Basics ) : Floating-point Functions and Function Helperso p stands for ↦ O T S T A T ( o p ) < < composeL ↦ ( ∀ a b c . ( b → c ) → ( a → b ) → a → c , v ) > > composeR ↦ ( ∀ a b c . ( a → b ) → ( b → c ) → a → c , v ) ^ pow ↦ ( ∀ n u m b e r . n u m b e r → n u m b e r → n u m b e r , v ) * mul ↦ ( ∀ n u m b e r . n u m b e r → n u m b e r → n u m b e r , v ) / fdiv ↦ ( F l o a t → F l o a t → F l o a t , v ) // idiv ↦ ( I n t → I n t → I n t , v ) + , - add , sub ↦ ( ∀ n u m b e r . n u m b e r → n u m b e r → n u m b e r , v ) ++ append ↦ ( ∀ a p p e n d a b l e . a p p e n d a b l e → a p p e n d a b l e ( ∀ a p p e n d a b l e . → a p p e n d a b l e , v ) :: ∗ :: ↦ ( ∀ a . a → a L i s t → a L i s t , c ) == , /= eq , neq ↦ ( ∀ a . a → a → B o o l , v ) < , > lt , gt ↦ ( ∀ c o m p a r a b l e . c o m p a r a b l e → c o m p a r a b l e → B o o l , v ) <= , >= le , ge ↦ ( ∀ c o m p a r a b l e . c o m p a r a b l e → c o m p a r a b l e → B o o l , v ) && , || and , or ↦ ( B o o l → B o o l → B o o l , 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}
op < < > > ^ * / // + , - ++ :: ∗ == , /= < , > <= , >= && , || |> <| stands for composeL composeR pow mul fdiv idiv add , sub append :: eq , neq lt , gt le , ge and , or apR apL ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ OT STAT ( op ) ( ∀ a b c . ( b → c ) → ( a → b ) → a → c , v ) ( ∀ a b c . ( a → b ) → ( b → c ) → a → c , v ) ( ∀ number . number → number → number , v ) ( ∀ number . number → number → number , v ) ( Float → Float → Float , v ) ( Int → Int → Int , v ) ( ∀ number . number → number → number , v ) ( ∀ appendable . appendable → appendable ( ∀ appendable . → appendable , v ) ( ∀ a . a → a List → a List , c ) ( ∀ a . a → a → Bool , v ) ( ∀ comparable . comparable → comparable → Bool , v ) ( ∀ comparable . comparable → comparable → Bool , v ) ( Bool → Bool → Bool , v ) ( ∀ a b . a → ( a → b ) → b , v ) ( ∀ a b . ( a → b ) → a → b , v ) ∗ {}^{*} ∗ Declared by List to stand for the list constructor :: of V E 0 \VE_0 VE 0 . Every other operator is declared by Basics to stand for the hidden variable shown.
Figure 40 : The Static Operator Table, O T S T A T \OTstat OT STAT 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.4 Further 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 E 0 E_0 E 0 (Section C.2 ), and the meaning of the operator :: that List declares is O T S T A T ( :: ) \OTstat(\kw{::}) OT STAT ( :: ) (Figure 40 ).
Maybe Maybe ↦ ( M a y b e , { Just ↦ ( ∀ a . a → a M a y b e , c ) , ( M a y b e , { Nothing ↦ ( ∀ a . a M a y b e , c ) } ) Just ↦ ( ∀ a . a → a M a y b e , c ) Nothing ↦ ( ∀ a . a M a y b e , c ) Result Result ↦ ( R e s u l t , { Ok ↦ ( ∀ x a . a → ( x , a ) R e s u l t , c ) , ( R e s u l t , { Err ↦ ( ∀ x a . x → ( x , a ) R e s u l t , c ) } ) Ok ↦ ( ∀ x a . a → ( x , a ) R e s u l t , c ) Err ↦ ( ∀ x a . x → ( x , a ) R e s u l t , c ) String String ↦ ( S t r i n g , { } ) Char Char ↦ ( C h a r , { } ) toCode ↦ ( C h a r → I n t , v ) fromCode ↦ ( I n t → C h a r , v ) Array Array ↦ ( A r r a y , { } ) Bytes Bytes ↦ ( B y t e s , { } )
\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}
Maybe Maybe Just Nothing Result Result Ok Err String String Char Char toCode fromCode Array Array Bytes Bytes ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ( Maybe , { Just ↦ ( ∀ a . a → a Maybe , c ) , ( Maybe , { Nothing ↦ ( ∀ a . a Maybe , c )}) ( ∀ a . a → a Maybe , c ) ( ∀ a . a Maybe , c ) ( Result , { Ok ↦ ( ∀ x a . a → ( x , a ) Result , c ) , ( Result , { Err ↦ ( ∀ x a . x → ( x , a ) Result , c )}) ( ∀ x a . a → ( x , a ) Result , c ) ( ∀ x a . x → ( x , a ) Result , c ) ( String , { }) ( Char , { }) ( Char → Int , v ) ( Int → Char , v ) ( Array , { }) ( Bytes , { }) Figure 41 : Static Interfaces of Maybe, Result, String, Char, Array and BytesThe 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 M E 0 \ME_0 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 T a s k \sbtTask Task and P r o c e s s I d \sbtProcessId ProcessId themselves (Section 4.5 ), and likewise Json.Decode.Value is bound to V a l u e \tValue Value and Html.Html to N o d e \sbtNode Node .
Debug log ↦ ( ∀ a . S t r i n g → a → a , v ) todo ↦ ( ∀ a . S t r i n g → a , v ) toString ↦ ( ∀ a . a → S t r i n g , v ) Platform Program ↦ ( P r o g r a m , { } ) Task ↦ ( T a s k , { } ) ProcessId ↦ ( P r o c e s s I d , { } ) worker ↦ ( ∀ f l a g s m o d e l m s g . { init ↦ f l a g s → ( m o d e l , m s g C m d ) T u p l e 2 , { update ↦ m s g → m o d e l → ( m o d e l , m s g C m d ) T u p l e 2 , { subscriptions ↦ m o d e l → m s g S u b } → ( f l a g s , m o d e l , m s g ) P r o g r a m , v ) Platform.Cmd Cmd ↦ ( C m d , { } ) none ↦ ( ∀ m s g . m s g C m d , v ) batch ↦ ( ∀ m s g . ( m s g C m d ) L i s t → m s g C m d , v ) map ↦ ( ∀ a m s g . ( a → m s g ) → a C m d → m s g C m d , v ) Platform.Sub Sub ↦ ( S u b , { } ) none ↦ ( ∀ m s g . m s g S u b , v ) batch ↦ ( ∀ m s g . ( m s g S u b ) L i s t → m s g S u b , v ) map ↦ ( ∀ a m s g . ( a → m s g ) → a S u b → m s g S u b , 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}
Debug log todo toString Platform Program Task ProcessId worker Platform.Cmd Cmd none batch map Platform.Sub Sub none batch map ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ( ∀ a . String → a → a , v ) ( ∀ a . String → a , v ) ( ∀ a . a → String , v ) ( Program , { }) ( Task , { }) ( ProcessId , { }) ( ∀ flags model msg . { init ↦ flags → ( model , msg Cmd ) Tuple 2 , { update ↦ msg → model → ( model , msg Cmd ) Tuple 2 , { subscriptions ↦ model → msg Sub } → ( flags , model , msg ) Program , v ) ( Cmd , { }) ( ∀ msg . msg Cmd , v ) ( ∀ msg . ( msg Cmd ) List → msg Cmd , v ) ( ∀ a msg . ( a → msg ) → a Cmd → msg Cmd , v ) ( Sub , { }) ( ∀ msg . msg Sub , v ) ( ∀ msg . ( msg Sub ) List → msg Sub , v ) ( ∀ a msg . ( a → msg ) → a Sub → msg Sub , v ) Figure 42 : Static Interfaces of Debug and the Platform ModulesTask Task ↦ ( T a s k , { } ) succeed ↦ ( ∀ x a . a → ( x , a ) T a s k , v ) fail ↦ ( ∀ x a . x → ( x , a ) T a s k , v ) map ↦ ( ∀ x a b . ( a → b ) → ( x , a ) T a s k → ( x , b ) T a s k , v ) map2 ↦ ( ∀ x a b r . ( a → b → r ) → ( x , a ) T a s k → ( x , b ) T a s k ( ∀ x a b r . → ( x , r ) T a s k , v ) map3 ↦ ( ∀ x a b c r . ( a → b → c → r ) → ( x , a ) T a s k → ( x , b ) T a s k ( ∀ x a b c r . → ( x , c ) T a s k → ( x , r ) T a s k , v ) map4 ↦ ( ∀ x a b c d r . ( a → b → c → d → r ) → ( x , a ) T a s k ( ∀ x a b c d r . → ( x , b ) T a s k → ( x , c ) T a s k → ( x , d ) T a s k ( ∀ x a b c d r . → ( x , r ) T a s k , v ) map5 ↦ ( ∀ x a b c d e r . ( a → b → c → d → e → r ) → ( x , a ) T a s k ( ∀ x a b c d e r . → ( x , b ) T a s k → ( x , c ) T a s k → ( x , d ) T a s k ( ∀ x a b c d e r . → ( x , e ) T a s k → ( x , r ) T a s k , v ) sequence ↦ ( ∀ x a . ( ( x , a ) T a s k ) L i s t → ( x , a L i s t ) T a s k , v ) andThen ↦ ( ∀ x a b . ( a → ( x , b ) T a s k ) → ( x , a ) T a s k ( ∀ x a b . → ( x , b ) T a s k , v ) onError ↦ ( ∀ x y a . ( x → ( y , a ) T a s k ) → ( x , a ) T a s k ( ∀ x y a . → ( y , a ) T a s k , v ) mapError ↦ ( ∀ x y a . ( x → y ) → ( x , a ) T a s k → ( y , a ) T a s k , v ) perform ↦ ( ∀ a m s g . ( a → m s g ) → ( N e v e r , a ) T a s k → m s g C m d , v ) attempt ↦ ( ∀ x a m s g . ( ( x , a ) R e s u l t → m s g ) → ( x , a ) T a s k ( ∀ x a m s g . → m s g C m d , 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}
Task Task succeed fail map map2 map3 map4 map5 sequence andThen onError mapError perform attempt ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ↦ ( Task , { }) ( ∀ x a . a → ( x , a ) Task , v ) ( ∀ x a . x → ( x , a ) Task , v ) ( ∀ x a b . ( a → b ) → ( x , a ) Task → ( x , b ) Task , v ) ( ∀ x a b r . ( a → b → r ) → ( x , a ) Task → ( x , b ) Task ( ∀ x a b r . → ( x , r ) Task , v ) ( ∀ 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 ) ( ∀ 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 ) ( ∀ 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 ) ( ∀ x a . (( x , a ) Task ) List → ( x , a List ) Task , v ) ( ∀ x a b . ( a → ( x , b ) Task ) → ( x , a ) Task ( ∀ x a b . → ( x , b ) Task , v ) ( ∀ x y a . ( x → ( y , a ) Task ) → ( x , a ) Task ( ∀ x y a . → ( y , a ) Task , v ) ( ∀ x y a . ( x → y ) → ( x , a ) Task → ( y , a ) Task , v ) ( ∀ a msg . ( a → msg ) → ( Never , a ) Task → msg Cmd , v ) ( ∀ x a msg . (( x , a ) Result → msg ) → ( x , a ) Task ( ∀ x a msg . → msg Cmd , v ) Figure 43 : Static Interface of TaskProcess Id ↦ ( P r o c e s s I d , { } ) spawn ↦ ( ∀ x y a . ( x , a ) T a s k → ( y , P r o c e s s I d ) T a s k , v ) sleep ↦ ( ∀ x . F l o a t → ( x , ( ) ) T a s k , v ) kill ↦ ( ∀ x . P r o c e s s I d → ( x , ( ) ) T a s k , v ) Json.Encode and Json.Decode Value ↦ ( V a l u e , { } ) VirtualDom Node ↦ ( N o d e , { } ) Html Html ↦ ( N o d e , { } )
\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}
Process Id spawn sleep kill Json.Encode and Json.Decode Value VirtualDom Node Html Html ↦ ↦ ↦ ↦ ↦ ↦ ↦ ( ProcessId , { }) ( ∀ x y a . ( x , a ) Task → ( y , ProcessId ) Task , v ) ( ∀ x . Float → ( x , ( ) ) Task , v ) ( ∀ x . ProcessId → ( x , ( ) ) Task , v ) ( Value , { }) ( Node , { }) ( Node , { }) Figure 44 : Static Interfaces of Process, Json and View Modules