Elm v0.18 Installation

The Elm installation page provides installers for Mac and Windows and sources to build on Linux systems. We will be using v0.18, so make sure you see 0-18 somewhere in the name of the installer you choose. Language versions are not compatible in general.

The Elm tools should also be available on linux.cs.uchicago.edu.

Online Editor

The live editor is a useful tool for trying out small bits of code on the go and for experiment with the Examples. But you certainly will not want to rely on it as part of your development workflow in this course.

REPL

The Elm Platform installation comes with a Read-Eval-Print-Loop (REPL) that will be very useful for developing and testing code that does not require HTML integration.

% elm-repl
---- elm repl 0.18.0 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------

“Hello, world!” “Hello, world!” : String

If you run into some weird behavior that you think may be a bug, try the age-old trick of quitting (:exit or Ctrl+D) and restarting. You can also take a look at the Elm mailing list to see if any related bug reports have been opened.

Building Standalone HTML

You will use elm-make to compile Elm programs into HTML and JavaScript. Before running elm-make in any project directory, you will be asked to download and install the core libraries. Give your blessings when asked.

% elm-make Foo.elm --output=Foo.html
Some new packages are needed. Here is the upgrade plan.

  Install:
    elm-lang/core 5.1.1
    elm-lang/html 2.0.0
    elm-lang/virtual-dom 2.0.4

Do you approve of this plan? [Y/n] y
Starting downloads...

  ● elm-lang/html 2.0.0
  ● elm-lang/virtual-dom 2.0.4
  ● elm-lang/core 5.1.1

Packages configured successfully!
Success! Compiled 38 modules.
Successfully generated Foo.html

Subsequent builds:

% elm-make Foo.elm --output=Foo.html
Success! Compiled 0 modules.
Successfully generated Foo.html

Notice that 5.1.1 is the version of the core Elm libraries used in v0.18 of the Elm Platform. When you are browsing the documentation and source code for the core libraries, make sure you are viewing the correct version.

Take a look at the elm-package.json file and elm-stuff/ directory that are created in your working directory. The former declares the libraries required by your program and the latter contains snapshots of them all. If you ever need or want to install the libraries a particular project, you can simply delete the elm-stuff/ folder in that project directory.

Reactor

The installation also includes Elm Reactor, an interactive development environment. Run elm-reactor from a directory that contains *.elm files you are working on:

% elm-reactor
elm reactor 0.18.0
Listening on http://0.0.0.0:8000/

Launch a browser and navigate to http://localhost:8000. You will be able to click any Elm file in the directory where elm-reactor was run in order to run the Elm program. Edit your source file, save, and then refresh the browser page.

This old blog post describes and demonstrates some nifty debugging features that are not active in the current version of the language.


Lab Submission System

We will use Moodle for lab submissions.

XXX

Links