Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting to know Elm: the functional front-end l...

Anne
June 12, 2018

Getting to know Elm: the functional front-end language

Ever found yourself looking for hours on end why your console was saying “undefined is not a function”? Those frustrations and more were the reason that Evan Czaplicki thought “can’t this be better?” and developed Elm, the functional front-end language. The beauty is: because of its functional pureness, runtime exceptions are now history! Elm’s powerful compiler is able to detect errors in front-end code in a way unimaginable until now and even has the decency to give you a user…developer…friendly error message with hints where possible. Did we peek your interest? Come and find out more in this session about Elm, the functional front-end language.

Anne

June 12, 2018
Tweet

Other Decks in Programming

Transcript

  1. Who are we? Anne van den Berg Dutch (¼ Polish)

    JCore Full-stack Developer Sports Travel #share Bas Knopper Dutch JCore Full-stack Developer AI Running #share acvdb bknopper @BWknopper
  2. Agenda 1. What is Elm? 2. Elm basics 3. Hello

    World 4. Demo 5. Developer Practicalities 6. Comparison with Angular 7. Community 8. Lessons learned
  3. Elm basics • think in functions ◦ consider every edge

    case ◦ void functions don’t exist • operator (++, -, *) = function • if-else = function • constant = function without argument • HTML & CSS are in functions • EVERYTHING = function
  4. Function syntax • function definition → not necessary <function name>

    : <input type> -> <output type> • `=` to denote function body <function name> <input arg> = <function body> • function call: <function name> <input arg>
  5. HTML in Elm • HTML package ◦ functions ◦ Elements

    (div, p, h1, …) ◦ Attributes (class, style, …) ◦ Events (onClick, onMouseDown, …) • Don’t forget to import them
  6. HTML in Elm • div with input and button •

    two pair of brackets (lists): div [<attributes>] [<body>]
  7. Development Environment • Install Elm ◦ elm-reactor → live server

    with debugger ◦ elm-make → build ◦ elm-repl → read eval print loop ◦ elm-package → package manager • Install other tools ◦ elm-format ◦ elm-lint ◦ elm-live ◦ elm-test • Install editor + plugins
  8. Build • Use code bundler for: ◦ loading external CSS

    ◦ minifying ◦ prettifying ◦ ... • For example Webpack & yarn:
  9. Standard modules for app development • Routing ◦ elm-lang/navigation •

    Http calls ◦ elm-lang/http ◦ typed http calls
  10. Comparison with AngularJS (1) Elm AngularJS Typed + - Speed

    + - Errors ++ - Clean code ++ - Learning curve - + Community - +
  11. Comparison with Angular 2+ Elm AngularJS Angular 2+ Typed +

    - + Speed + - +/- Errors ++ -- - Clean code ++ - + Learning curve - + + Community - + ++
  12. Community Slack channel elmlang.herokuapp.com /r/elm Twitter @elmlang @czaplic #elmlang Discourse

    Meetup group (Warsaw) Stackoverflow (not too big) Elm conference (July, 5-6th 2018, France) http://2018.elmeurope.org/
  13. Lessons learned • Steeper learning curve ◦ Thought we knew

    functional programming ◦ Keep practicing • Small community (but very helpful) • Accept its formatting