Skip to content

Instantly share code, notes, and snippets.

@mindbat
Created January 21, 2017 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mindbat/44fc6725b89ad3e230d000da3dcff439 to your computer and use it in GitHub Desktop.
Save mindbat/44fc6725b89ad3e230d000da3dcff439 to your computer and use it in GitHub Desktop.
Seven More Languages in Seven Weeks - Elm Day Two Examples

Updated Elm Examples

The Elm examples given in the book (especially from Day Two, forward) are for an older version of Elm. Elm 0.17 changed a lot of things in the language, including eliminating signals and moving a lot of the libraries around.

I’ve translated the Day Two examples from the book to run on Elm 0.18

Examples

Avoiding Callbacks (p. 103)

Elm 0.17+ avoids callbacks using Subscriptions, not Signals: https://gist.github.com/mindbat/7afc23cad8da000e4b26de55986d4eaf

Maintaining State (p. 104-105)

For all three of these examples, we need to swap signals for subscriptions:

Working with Text Input (p. 107)

This one had to be reworked to use the new Elm Architecture: https://gist.github.com/mindbat/edfc8329bd2a97f4f9a00d245fe35ce5

Drawing Shapes (p. 108)

The car just needs a few tweaks to work properly: https://gist.github.com/mindbat/f106eeb324032064e493dec31dbbbc2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment