Introducing ember-elm

Write Elm in your Ember.js app

Jason Tu
2 min readJan 3, 2017
Get it? It’s the Ember and Elm taglines combined! Ehh…

As an Ember developer, you’ve probably heard of the Elm programming language. (If you haven’t, lemme redirect you to Elm’s home page. ☺) It’s a language that was specifically designed for front-end developers such as ourselves, and it has a few advantages compared to Ember.

Static typing

Elm guarantees that every variable:

  1. has a single, unchanging type known at compile time, and
  2. is immutable.

You don’t have to worry about passing the wrong type or number of arguments into a function, like you do in JavaScript. Everything is checked for you by the compiler.

Functional at its core

Ember addons such as ember-let, ember-redux, and ember-composable-helpers encourage a functional style of programming. In Elm, all of that is built into the language!

(Almost) zero runtime errors

It isn’t perfect, but Elm’s type system gets us one step further to the pipe dream of writing flawless, bug-free code. If it compiles, it’ll run correctly.

Yet, in spite of Elm’s benefits, I find myself punching ember new into my keyboard when it comes time to start a new project. It turns out that migrating wholesale to another front-end stack incurs a huge productivity hit, which is completely infeasible for most people. Ember may not be flawless, but it sure as heck is productive once you get to know it.

Enter ember-elm

With ember-elm, you can try Elm on a small component in your project, without having to migrate to another front-end stack. As Evan Czaplicki (the creator of Elm) would say:

Companies that use Elm in production usually start with a single component. So if you want to use Elm at work, start with a small experiment. Do people think it is nice? Do more! Do people think it sucks? Do less!

ember-elm integrates seamlessly with ember-cli, so you keep ember-cli’s live reloading and project conventions, and you don’t have to waste time learning new build tools.

Elm’s place in Ember’s project structure

Feel free to read the docs and try it out. The Elm community has loads of neat ideas on software quality and developer experience, and it’s be interesting to see some cross-pollination between the Ember and Elm communities.

Let me know if you discover anything cool!

--

--