Elm Exactly

Rule 174p-stat-main-view

Elaboration of ProgramsBSTAT⊢STATprogram⇒(τ,PE)\jstat{\pgBstat}{\program}{(\tau,\PE)}
BSTAT⊢module⇒BSTAT′,EDom (PEofBSTAT′)∩(Dom (PEofBSTAT)∪Managerplat)=∅E(main)=(σ,v)Dflt σ=τ NodeBSTAT⊢STATmodule⇒(τ Node, 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 \pgDflt\sigma=\tau\,\sbtNode\end{array}}{\begin{array}{c}\jstat{\pgBstat}{\modm}{\big(\tau\,\sbtNode,\ \PE\of(\pgBstat+\pgBstat')\big)}\end{array}}
(174)
Read it in its chapter·Permanent address: /standard/rules/p-stat-main-view

Comments

A main of type Html msg or Svg msg has a type τ Node\tau\,\sbtNode, since both are aliases. No function type is of either form, so a main with parameters does not elaborate.

Referred to from

TeX source
\defnrule[r:p-stat-main-view]
  {\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
   \pgDflt\sigma=\tau\,\sbtNode}
  {\jstat{\pgBstat}{\modm}{\big(\tau\,\sbtNode,\ \PE\of(\pgBstat+\pgBstat')\big)}}

Tests (10)

  • elm / BadMainRecursiveMainTest
    An annotated `main` that is mutually recursive with another function is rejected with a BAD MAIN error.
  • elm / BadMainRecursiveUnannotatedMainTest
    An unannotated `main` that is mutually recursive with another function is rejected with a BAD MAIN error.
  • elm / BadMainTypeAliasMainTest
    A `main` whose type is a record type alias is rejected with a BAD MAIN TYPE error.
  • elm / BadMainTypeFunctionMainTest
    A `main` of function type `Int -> Int -> Int` is rejected with a BAD MAIN TYPE error.
  • elm / BadMainTypeRecordMainTest
    A `main` of record type `{ a : Int, b : ( Int, Int, Int ) }` is rejected with a BAD MAIN TYPE error.
  • elm / BadMainTypeThreeArgumentTypeMainTest
    A `main` whose type is a custom type with three type parameters is rejected with a BAD MAIN TYPE error.
  • elm / BadMainTypeTypeVariableMainTest
    An unannotated `main` whose inferred type contains a type variable is rejected with a BAD MAIN TYPE error.
  • elm / BadMainTypeUnitMainTest
    A `main` of type `()` is rejected with a BAD MAIN TYPE error.
  • elm / EntryMainOfRootModuleTest
    A program's entry point is the `main` of the module being compiled, even when an imported module also defines and exposes a `main`.
  • elm / HelloTest
    The smallest program: a `main` that logs the string `"hello"` with `Debug.log` and renders it as text.

Discussions

Discuss this rule·Search the discussions on GitHub

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