Elm

http://elm-lang.org/

CLI commands

elm-repl

repl

elm-reactor

to build apps like webpack does

elm-make

to compile apps into HTML and JS

eg.

  1. elm-make Main.elm --output=main.html

elm-package

like npm for elm

notable commands

  • install: install the dependencies in elm-package.json
  • publish: publish your library to the Elm Package Catalog
  • bump: bump version numbers based on API changes
  • diff: get the difference between two APIs

Core language

strings

  1. "hello" -- "hello"
  2. "hello" ++ "world" -- "helloworld"

number

  1. 10/3 -- 3.33333 (float)
  2. 10//3 -- 3 (Int)

functions

  1. isNegative n = n < 0
  2. isNegative 4 -- False

conditionals

  1. if True then "hello" else "world" -- True

lists

Arrays of the same type

  1. names = [ "Alice", "Bob", "Chuck" ]

List methods

  • List.isEmtpy
  • List.length
  • List.sort
  • List.map

Tuples

Array of fixed number of values with any type.

  1. (True, "name accepted!")

Work flow

Redux works similar like Elm.

  • Model (Redux store)
  • Msg (Redux action)
  • Update (Redux reducer)