Equivalent Ecosystems: Groovy vs Elixir

Given that a little over two years ago I was a C# developer I have had to learn the JVM way of doing things fairly rapidly. Java does has many ways of solving things but these are those that I am familiar with:

Here is a map between the Java world and the Elixir world

JVM => BEAM

Gradle => Mix

https://search.maven.org/ => https://hex.pm

JUnit => ExUnit

JavaDoc => ExDoc

Dropwizard (or web framework of choice) => Phoenix

Jooq => Ecto

Learning Elm Part 2

I am now working through the Elm samples and converting them into a elm-reactor application.

The source is here on github:

https://github.com/chriseyre2000/elm-samples.git

Reactor looks really useful. Elm applications hold their state in it’s model.

The default reactor app allows you to preview the commands sent to the model. This will make creating test cases really easy. This is the big advantage of functional programming – there are no side effects.

The type specifications reminds me of Delphi’s interface/implementation split or of C header files.

Interesting note: elm-reactor is case sensitive:

Ask for filename.elm and it compiles and runs the page.

Ask for filename.Elm and it shows the source.

So far I have needed to add:

elm-package install elm-lang/http

elm-package install elm-lang/svg

elm-package install evancz/elm-markdown

elm-package install elm-lang/html

elm-package install elm-lang/websocket

elm-package intstall elm-lang/mouse

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.