Functional Reactive Programming
Elm is a language built around functional-reactive programming (FRP). That
means two things. First, it’s a functional language—functions are
first-class values, values are immutable, and you can’t reassign variables.
Second, the way Elm handles user input is different, and more concise. For
example, your web application might want to know when the mouse position
changes. In Elm, the mouse position is a special kind of value called a
Signal that you can embed in expressions. When the mouse position changes,
the Signal changes value, and every expression it appears in is automatically
recomputed. You don’t have to use callbacks, so you avoid inversion of control
and callback hell. The result is shorter and easier to
understand programs, written in a declarative style.
FRP has been a subject of academic research for years. It’s not new. But Elm is applying FRP concepts specifically to the problem of developing GUIs for the web. It’s also taking a novel approach to supporting asynchronous computation, the details of which you can read in this PLDI paper. Doug Crockford said it best at MLOC.js: It just doesn’t make sense to create another Java-like language and expect it to spur innovation in the way we develop GUIs for the web.
Compilers Can Optimize
Keep Moving Forward