Getting Started With Elm and Typed Functional Programming
Welcome to this workshop! Today we're learning Elm and typed functional programming techniques through creating the classic game Memory.
The workshop will cover the following topics:
- Type Inference
- Type Signatures
- Union Types
- Type Aliases
- Pattern Matching
- Partial Application
- Running your application in the browser
Some of these concepts may be unfamiliar and somewhat confusing to begin with, so please do ask us if and when you get stuck, or simply have a question. That's what we're here for!
The code for the workshop is available here: https://github.com/ewendel/elm-workshop.
nodeversion 7 or newer (which includes
npm) from nodejs.org.
elm. This can be done with
npm install -g elm,
brew install elm(if on MacOS) or an old-school file download from elm-lang.org.
pluginfor your editor. At the time of writing we prefer VS Code for Elm development so we recommend you use that, even if VS Code is not usually your main editor of choice.
elm-format, which is a crucial tool to make your Elm experience more enjoyable.
npm install -g elm-format
- Remember to make sure that
elm-formatis available on your PATH or that you tell your editor where to find it
- Follow the instructions here to enable running
elm-formatin VS Code
- You can find the path for
which elm-formaton MacOS/*Nix or
Get-Command elm-formatin powershell on Windows
Clone the repo (https://github.com/ewendel/elm-workshop) to your computer
npm install(please make sure to have
npmversion 3 or newer)
Start your local application environment with
npm startin the root folder of this repo. This should open a new browser window with
localhost:3000and a nice compilation error.
Congratulations, you're now ready to begin learning Elm!