Search code examples
clojurescriptelm

How does Elm compare to ClojureScript?


I'm reaching a point where GUI coding with Backbone.js object-oriented MVC pattern is getting quite complex, and looking around at other paradigms. MDV, FRP, ECS, oh my.

How does Elm compare to ClojureScript? Where do they overlap?

Both are languages very different from JS that compile to JS. I understand that Elm is a functional reactive programming (FRP) language. ClojureScript isn't necessarily FRP, but you can do FRP with it. Elm compiles with Haskell and ClojureScript with the JVM, so both of those are extra requirements for a Node shop.

Maybe it just boils down to Clojure vs Haskell.


Solution

  • Both force you to use a more declarative/functional programming style than pure JS. ClojureScript is more like a JS replacement, whereas Elm is more like a replacement for the entire web development stack (HTML/CSS/JS).

    Other differences:

    • Elm syntax is much more Haskell-like
    • ClojureScript is much closer to traditional Lisp syntax
    • Elm is highly optimized for time-varying values ("signals" in Elm)
    • ClojureScript is more mature and you can find some sweet development tools for it (Eclipse plug-ins, LightTable, etc.)
    • Elm is statically typed, ClojureScript is dynamically typed

    Hope this helps. I'm still learning both of these languages so I may have missed something.