Stepping inside the elm runtime

If you have ever wondered how the elm runtime works you may have traced the function calls required to create an application (for example elm/core:Platform.worker or elm/browser:Browser.element). If you do so you will end up at elm/core:Elm.Kernel.Platform.initialize. The initialize function in the elm/core package is defined like this: function _Platform_initialize(flagDecoder, args, init, update, subscriptions, stepperBuilder) { // ... } flagDecoder sounds a bit scary but we ignore it for now. args is the javascript object you pass to init: Elm. [Read More]

A wish list for the elm-in-elm CLI

How should we design the elm-in-elm command line interface? I suggest that the design should provide A pure interface At the core of the design should be a command that is as pure as possible. The compiler takes some (elm) files and produces some (javascript) files. Given the same input files the compiler produces the same output files. This command should not try to connect to the internet, read the elm. [Read More]

Effect modules in elm

For every action performed by an elm program (for example making a http request) and every event the program wishes to listen to (for example running code after a delay) there must be an event module responsible. An effect module is an elm module that Uses a different syntax in the first line of the file. Has access to one or two special functions. Must define some functions with specific names and type signatures. [Read More]

An Elm Runtime in Elm

Note I am writing this post in response to a comment on my last post suggesting that, as a platform-y thing, the elm runtime should be written platform specific code. The elm runtime must do three things: Detect external, asynchronous events. Inform the elm application about these detected events by passing it information describing the event. Perform actions as requested by the elm application. [Read More]

Why Platform Must Define Task

span:before { display: block; position: absolute; content: " "; margin-top: -285px; height: 285px; visibility: hidden; pointer-events: none; } Why Platform must define Task The examples in this post uses elm 0.19.1 and elm/core 1.0.2. I have been investing the runtime of the elm programming language, mainly to see if it is possible to write more of the logic of the runtime in elm code, rather than in JavaScript “kernel code”. [Read More]