/elm-demystify-decoders

Primary LanguageElmBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Article

Demystifying Elm JSON Decoders

https://blog.ilias.xyz/demystifying-decoders-d294ed35bc6e

Clone of

https://github.com/zwilias/elm-demystify-decoders

Spoiler alert

I am working on solving the exercises in this reprository.

Making decoders is a bit tricky to begin with, but very important when talking to APIs.

Spoiler alert: You will find solutions to the exercises here.

Status:

  • exercise 1
  • exercise 2
  • exercise 3
  • exercise 4
  • exercise 5
  • exercise 6
  • exercise 7
  • exercise 8
  • exercise 9
  • exercise 10
  • exercise 11
  • exercise 12

Demystifying JSON decoders

Some people learn best by reading, others learn by best exploring and experimenting. This project caters to the latter.

Decoding JSON in Elm can often feel daunting and difficult, even to experienced developers. The exercises in this project attempt to guide you through JSON decoding, by gradually increasing the level of complexity.

Starting the exercises

  • Clone this repository
  • Install elm and elm-test
  • Open the project in your editor

Installing elm and elm-test

There are a couple of options. You can either install them globally, using npm -g i elm elm-test or using yarn global add elm elm-test, or locally in the scope of this project using either npm i or yarn install.

Running the tests for a specific exercise

After solving an exercise, for example Exercise01, you can run the tests for that exercise. The method you use will depend on how you chose to install elm and elm-test:

  • elm-test tests/Exercise01 - if you installed it globally
  • npm run elm-test tests/Exercise01 - locally using npm
  • yarn elm-test tests/Exercise01 - locally using yarn