Figureappendix-standard-ml-modules
| Feature | Standard ML | Elm (this definition) | Where defined here |
| Modules | Structures, signatures and functors; sharing; transparent and opaque signature matching, with realisation and enrichment. | Flat modules: a module is a header, imports and top-level declarations, and exports top-level names by an exposing list; a custom type is exposed with or without its constructors. No signatures, functors or sharing; the import relation between modules has no cycle. | Ch. 3; Ch. 5, Sec. 5.2; Ch. 7 |
| Programs | An interactive top level: a sequence of top-level declarations, each elaborated and evaluated in the basis left by those before it; a declaration that fails is rejected and the session continues. | A program is a main module and the modules it imports, elaborated as a whole; its value main is executed by a platform, as a labelled transition system whose observable behaviour is its traffic on ports. | Ch. 9, Sec. 9.4 |
| Effects | At the level of the language, only state and exceptions; input and output are left to library functions with side effects. | Evaluation has no effect. Tasks, commands and subscriptions are values, built by functions of the basis, which the platform carries out; their results return to the program as messages. | Ch. 8, Sec. 8.4, Sec. 8.5 |
| Ports | None. | A port declaration in a port module gives a command for sending values out or a subscription for receiving them. Only values of port types may cross a port, encoded as JSON values in which byte sequences may stand. | Sec. 5.4; Sec. 8.7 |
Referred to from
Tests (0)
No test of the suite checks this figure yet.
Discussions
Discuss this figure·Search the discussions on GitHub
Discussions are on GitHub; one about this figure has [fig:appendix-standard-ml-modules] 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.