Rule 174p-stat-main-view
Elaboration of Programs
(174)
Comments
A main of type Html msg or Svg msg has a type , since both are aliases. No function type is of either form, so a main with parameters does not elaborate.
Referred to from
- The comment on rule
p-stat-main-program(Chapter 9) - Section 9.3 Evaluation of Programs
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 / BadMainRecursiveMainTestAn annotated `main` that is mutually recursive with another function is rejected with a BAD MAIN error.
- elm / BadMainRecursiveUnannotatedMainTestAn unannotated `main` that is mutually recursive with another function is rejected with a BAD MAIN error.
- elm / BadMainTypeAliasMainTestA `main` whose type is a record type alias is rejected with a BAD MAIN TYPE error.
- elm / BadMainTypeFunctionMainTestA `main` of function type `Int -> Int -> Int` is rejected with a BAD MAIN TYPE error.
- elm / BadMainTypeRecordMainTestA `main` of record type `{ a : Int, b : ( Int, Int, Int ) }` is rejected with a BAD MAIN TYPE error.
- elm / BadMainTypeThreeArgumentTypeMainTestA `main` whose type is a custom type with three type parameters is rejected with a BAD MAIN TYPE error.
- elm / BadMainTypeTypeVariableMainTestAn unannotated `main` whose inferred type contains a type variable is rejected with a BAD MAIN TYPE error.
- elm / BadMainTypeUnitMainTestA `main` of type `()` is rejected with a BAD MAIN TYPE error.
- elm / EntryMainOfRootModuleTestA program's entry point is the `main` of the module being compiled, even when an imported module also defines and exposes a `main`.
- elm / HelloTestThe 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.