Learning Elm

I have to admit to being a bit of a language geek.

A few years ago I started working my way through Seven Languages in Seven Weeks (Ruby [x] , Io [x], Prolog [x], Scala [x], Erlang [x], Clojure [], Haskell []).

More recently I started working my way through Seven More Languages In Seven Weeks (Lua [], Factor [], Elm [], Elixir [x], Julia [x], miniKanren [], Idris [])

I have been posting various things about Elixir which seems to be a very promising language.

The Elm chapter of that book was based upon 0.13 but that language is now at 0.18 which has changed significantly.

I have now found a pluralsight course (https://www.pluralsight.com/courses/elm-getting-started) that gives the latest view on 0.18

Key points

Install the language tools with:

npm install -g elm

Add the cli completion with

npm install elm-oracle -g

Here is the language documentation:

http://elm-lang.org/

Here are the useful examples:

http://elm-lang.org/examples

Here is the package search engine:

http://package.elm-lang.org/

There are a few basic tools supplied with the elm environment:

  elm-make      Compile an Elm file or project into JS or HTML

  elm-package   Manage packages from <http://package.elm-lang.org&gt;

  elm-reactor   Develop with compile-on-refresh and time-travel debugging

  elm-repl      A REPL for running individual expressions

So far I have been experimenting with moving the samples from the above examples into a simple reactor app. The major problem that I have found so far is determining the required packages. The online tool clearly can find them yet it’s hard to find the right version locally.

For example I was trying to get the Markdown sample (http://elm-lang.org/examples/markdown) into a simple reactor project (copy code into a file called Mardown.elm). I was provided with the useful error message that it could not find the Markdown module. Searching on http://package.elm-lang.org/packages revealed that the best package was evancz/elm-markdown/3.0.2. Adding “evancz/elm-markdown”: “3.0.2 <= v < 4.0.0” to the elm-package.json seemed to work. I did need to delete the elm-stuff directory to get reactor to update.

 

 

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s