e01.org

Elm (programming language)

Elm is a domain-specific programming language for declaratively creating web browser-based graphical user interfaces. Elm is purely functional, and is developed with emphasis on usability, performance, and robustness. It advertises "no runtime exceptions in practice", made possible by the Elm compiler's static type checking.

Elm is a domain-specific programming language for declaratively creating web browser-based graphical user interfaces. Elm is purely functional, and is developed with emphasis on usability, performance, and robustness. It advertises "no runtime exceptions in practice", made possible by the Elm compiler's static type checking. For example, imagine an application that displays a number and a button that increments the number when pressed. In this case, all we need to store is one number, so our model can be as simple as type alias Model = Int . The view function would be defined with the Html library and display the number and button. For the number to be updated, we need to be able to send a message to the update function, which is done through a custom type such as type Msg = Increase . The Increase value is attached to the button defined in the view function such that when the button is clicked by a user, Increase is passed on to the update function, which can update the model by increasing the number. In the Elm Architecture, sending messages to update is the only way to change the state. In more sophisticated applications, messages may come from various sources: user interaction, initialization of the model, internal calls from update , subscriptions to external events (window resize, system clock, JavaScript interop...) and URL changes and requests. -- This is a single line comment. {- This is a multi-line comment. It is {- nestable. -} -} -- Here we define a value named `greeting`. The type is inferred as a `String`. greeting = "Hello World!" -- It is best to add type annotations to top-level declarations. hello : String hello = "Hi there." -- Functions are declared the same way, with arguments following the function name. add x y = x + y -- Again, it is best to add type annotations. hypotenuse : Float -> Float -> Float hypotenuse a b = sqrt (a^2 + b^2) -- We can create lambda functions with the `\[arg] -> [expression]` syntax. hello : String -> String hello = \s -> "Hi, " ++ s -- Function declarations may have the anonymous parameter names denoted by `_`, -- which are matched but not used in the body. const : a -> b -> a const k _ = k -- Functions are also curried; here we've curried the multiplication -- infix operator with a `2` multiplyBy2 : number -> number multiplyBy2 = (*) 2 -- If-expressions are used to branch on `Bool` values absoluteValue : number -> number absoluteValue number = if number < 0 then negate number else number -- Records are used to hold values with named fields book : { title : String, author : String, pages : Int } book = { title = "Steppenwolf" , author = "Hesse" , pages = 237 } -- Record access is done with `.` title : String title = book.title -- Record access `.` can also be used as a function author : String author = .author book -- We can create tagged unions with the `type` keyword. -- The following value represents a binary tree. type Tree a

References

  1. ^ "Elm home page" . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  2. ^ "Elm: Concurrent FRP for Functional GUIs" (PDF) . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  3. ^ "Try Elm" . elm-lang.org . Retrieved 2025-04-26 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1745622000.0
  4. ^ "elm and prezi" . elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  5. ^ "new adventures for elm" . elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  6. ^ "elm/compiler" . GitHub . 16 October 2021. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  7. ^ "repl" . elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  8. ^ "package manager" . elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  9. ^ "Home" . elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  10. ^ "Install" . guide.elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  11. ^ "Releases: elm/Compiler" . GitHub . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  12. ^ "Elm packages" . Elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  13. ^ "Ellie" . Ellie-app.com . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  14. ^ "elm/core" . package.elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  15. ^ "Model The Problem" . Elm . Retrieved 4 May 2016 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  16. ^ "JavaScript interop" . elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  17. ^ "elm/html" . package.elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  18. ^ "Blazing Fast HTML" . elm-lang.org . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  19. ^ "When Evan's Backend Work Will Be Released?" . Elm . 2025-02-18 . Retrieved 2026-04-14 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1776121200.0
  20. ^ Elm Europe (2019-11-28). Mario Rogic - Elm as a Service . Retrieved 2025-03-27 – via YouTube. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1743030000.0
  21. ^ Elm Online Meetup (2021-07-23). Building a Meetup clone on Lamdera - Martin Stewart . Retrieved 2025-03-27 – via YouTube. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1743030000.0
  22. ^ "Episode 38: Lamdera" . Elm Radio Podcast . Retrieved 2025-03-27 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1743030000.0
  23. ^ "Elm Studio" . www.elm.studio . Retrieved 2025-03-27 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1743030000.0
  24. ^ Cesarini, Francesco (22 May 2023). "@evancz tempting the demo gods…" . Twitter . Retrieved 26 March 2025 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  25. ^ "Status Update - 3 Nov 2021" . Elm . 2021-11-03 . Retrieved 2025-03-27 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1743030000.0
  26. ^ "elm-pages - pull in typed elm data to your pages" . elm-pages . Retrieved 2025-03-27 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1743030000.0
  27. ^ "Pine — Run Elm Everywhere" . pine-vm.org . Retrieved 2025-03-27 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1743030000.0
  28. ^ "Kofigumbs/Elm-beam" . GitHub . 24 September 2021. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  29. ^ "What is it?" . GitHub . 24 September 2021. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  30. ^ "Buttons · An Introduction to Elm" . guide.elm-lang.org . Retrieved 2020-10-15 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1602716400.0
  31. ^ "Prior Art - Redux" . redux.js.org . 28 April 2024. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  32. ^ "Higher-Kinded types Not Expressible? #396" . github.com/elm-lang/elm-compiler . Retrieved 6 March 2015 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  33. ^ "Higher-Kinded types Not Expressible #396" . github.com/elm-lang/elm-compiler . Retrieved 19 November 2019 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  34. ^ "The Elm Architecture" . tyrian.indigoengine.io . Retrieved 2024-09-07 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1725663600.0
  35. ^ "Main.elm" . github.com/rtfeldman/elm-spa-example . Retrieved 30 June 2020 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  36. ^ "Shapes of errors to come" . Rust Blog . Retrieved 2016-10-08 . Those of you familiar with the Elm style may recognize that the updated --explain messages draw heavy inspiration from the Elm approach. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1475881200.0
  37. ^ "Comparison with Other Frameworks — Vue.js" . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  38. ^ "roc/roc-for-elm-programmers.md at main · roc-lang/roc" . GitHub . Retrieved 2024-02-17 . Roc is a direct descendant of the Elm programming language. The two languages are similar, but not the same! Wikipedia revision 1378655114, retrieved 2026-11-19 · 1708124400.0
  39. ^ "Why Derw: an Elm-like language that compiles to TypeScript?" . 20 December 2021. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  40. ^ "Gren 0.1.0 is released" . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  41. ^ Czaplicki, Evan (30 March 2012). "My Thesis is Finally Complete! "Elm: Concurrent FRP for functional GUIs" " . Reddit . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  42. ^ "elm/compiler" . GitHub . 16 October 2021. Wikipedia revision 1378655114, retrieved 2026-11-19 · 1795042800.0
  43. ^ "syntax" . elm-lang.org . Retrieved 2025-04-26 . Wikipedia revision 1378655114, retrieved 2026-11-19 · 1745622000.0
source: e01 Encyclopedia · licence: CC BY-SA 4.0 · page · source revision

Cite this

"Elm (programming language)". 1791201128. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1378655114

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·