Elm Exactly

Rule 173p-stat-main-program

Elaboration of ProgramsBSTAT⊢STATprogram⇒(τ,PE)\jstat{\pgBstat}{\program}{(\tau,\PE)}
BSTAT⊢module⇒BSTAT′,EDom (PEofBSTAT′)∩(Dom (PEofBSTAT)∪Managerplat)=∅E(main)=(σ,v)σ=∀ξ(k).(τ1,τ2,τ3)ProgramPort(τ1)BSTAT⊢STATmodule⇒(Dflt σ, PEof(BSTAT+BSTAT′))\frac{\begin{array}{c}\jdg{\pgBstat}{\modm}{\pgBstat',E}\\ \Dom(\PE\of\pgBstat')\cap\big(\Dom(\PE\of\pgBstat)\cup\effMgrPlat\big)=\emptyset\\ E(\kw{main})=(\sigma,\isv)\premsep \sigma=\forall\tyrowvar^{(k)}.(\tau_1,\tau_2,\tau_3)\sbtProgram\premsep \Port(\tau_1)\end{array}}{\begin{array}{c}\jstat{\pgBstat}{\modm}{\big(\pgDflt\sigma,\ \PE\of(\pgBstat+\pgBstat')\big)}\end{array}}
(173)
Read it in its chapter·Permanent address: /standard/rules/p-stat-main-program

Comments

Rules (173) and (174) cover the one production, since main may have either of two forms of type. Only the main of the main module is constrained; a main in another module is an ordinary value. The scheme of main is taken from EE, the environment of all the declarations of the module, not from its interface, so main need not be exposed. A bound variable of class number\knum in the scheme of main is Float\tFloat in its type: with init = \() -> (0, Cmd.none) and no other constraint on the model, the model type is Float\tFloat, and the value of main is that of its default copy, at Float\tFloat (rule (176)). The flags type τ1\tau_1 is a port type, and is taken from the scheme before the default, so it contains no type variable. Thus main : Program (Int -> Int) Model Msg and main : Program flags Model Msg, with flags a type variable, do not elaborate, and nor does an unannotated main whose init is \n -> (n + 1, Cmd.none), whose flags type is a variable of class number\knum. The unit type is a port type, and as flags it is treated specially (Section 9.4). Since Bytes is a port type, flags may be, or contain, values of type Bytes. The model type τ2\tau_2 and the message type τ3\tau_3 are unconstrained. Some implementations admit further types of flags, which are not port types (Appendix E).

Referred to from

TeX source
\defnrule[r:p-stat-main-program]
  {\jdg{\pgBstat}{\modm}{\pgBstat',E}\\
   \Dom(\PE\of\pgBstat')\cap\big(\Dom(\PE\of\pgBstat)\cup\effMgrPlat\big)=\emptyset\\
   E(\kw{main})=(\sigma,\isv)\premsep
   \sigma=\forall\tyrowvar^{(k)}.(\tau_1,\tau_2,\tau_3)\sbtProgram\premsep
   \Port(\tau_1)}
  {\jstat{\pgBstat}{\modm}{\big(\pgDflt\sigma,\ \PE\of(\pgBstat+\pgBstat')\big)}}

Tests (12)

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:p-stat-main-program] 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.