Elm Language

Topics related to Elm Language:

Getting started with Elm Language

Lists and Iteration

The List (linked list) shines in sequential access:

  • accessing the first element
  • prepending to the front of the list
  • deleting from the front of the list

On the other hand, it's not ideal for random access (ie. getting nth element) and traversation in reverse order, and you might have better luck (and performance) with the Array data structure.

Functions and Partial Application

Collecting Data: Tuples, Records and Dictionaries

Ports (JS interop)

Consult http://guide.elm-lang.org/interop/javascript.html from The Elm Guide to aid in understanding these examples.

Types, Type Variables, and Type Constructors

Please play with these concepts yourself to really master them! The elm-repl (see the Introduction to the REPL) is probably a good place to play around with the code above. You can also play with elm-repl online.

Debugging

Json.Decode

Json.Decode exposes two functions to decode a payload, first one is decodeValue which tries to decode a Json.Encode.Value, the second one is decodeString which tries to decode a JSON string. Both function take 2 parameters, a decoder and a Json.Encode.Value or Json string.

The Elm Architecture

Subscriptions

Subscriptions are means to listen to inputs. Incoming ports, keyboard or mouse events, WebSocket messages, geolocation and page visibility changes, all can serve as inputs.

Pattern Matching

Backend Integration

Making complex update functions with ccapndave/elm-update-extra

Custom JSON Decoders