Elm Language — Familiarization:

COSC4315 TT
3 min readApr 1, 2019

--

Toolchains, Internals, and Intermediate Representations

Part 1, Part 2, and Part 3 of series on Elm

Toolchains:

A toolchain is a set of tools (programs) that developers use to aid in the development, maintenance, and support of a software task or product. The basic tools used in software development are source code editors and compilers or interpreters. A basic toolchain may comprise a compiler and linker, libraries, and a debugger. As mentioned earlier in this series, it is recommended that you install a text editor like Atom to use when writing Elm programs. Unlike other languages, where a lengthy tool stack is often necessary, Elm has many desirable features built-in. For example, if you are using JavaScript as your language of choice, you would have to install a package manager like npm to get packages. This feature is built-in in Elm.

Furthermore, if you wanted static type-checking and immutability, you would have to add these features. This is not the case when you use Elm. These features are not libraries that you have to install. These features are part of the language.

static type checking

Internals and Intermediate Representations:

Elm compiles to JavaScript. A web browser then interprets this code. elm make builds Elm projects. It can compile Elm code to HTML or JavaScript. It is the most general way to compile Elm code, so if your project becomes too advanced for elm reactor, you will want to start using elm make directly.

Say you want to compile Main.elm to an HTML file named main.html. You would run this command:

elm make Main.elm --output=main.html
compiling Elm file to JavaScript

Compiling this program to an HTML file, allows you to view it in your browser.

a simple program

The provided examples above shows the most common commands in elm. However, there are a few more commands that provides easy support in implementing programs. To see a full list of commands just type elm into your terminal.

Publish/Bump/Diff:

What makes Elm a powerful language is how easy to create a package by running a simple command elm publish. It’s vast package ecosystem makes it easier to for people to share ideas, mainly through Github, and test the packages to ensure the package is working properly.

The command elm bump takes the published package version number and bump the version if any modifications to the package were made. Then enter the elm publish command to release that version.

Finally, the elm diff command detects API changes. For example, if you updated a newer version of a package and wondered what is the difference between the new version and the old version.

For more information on publishing a package on elm, the provided link below is a great start:

References:

https://elm-lang.org/

https://guide.elm-lang.org

https://www.youtube.com/watch?v=kEitFAY7Gc8&t=959s

--

--