Learning Elm

I’ve not done a lot of front-end web work. Well, at least not in the last decade or so, so I’m a bit out of touch. I recently stumbled on Elm, a Haskell-like language that compiles to JavaScript. About the same time, I had an idea for a site that I wanted to try out. It seemed like a good time to put both into action.

Did I also mention I have a 5-month-old baby at home? Yeah, sounds like a great time to start a new project… sigh

First and foremost, the thing I love most about Elm is its attitude to getting started. When trying to learn what to do with AngularJS it felt like I had to do about a million things before I could see anything, which was a bit overwhelming. Elm, on the other hand, encouraged a “do the simplest thing that might work & build from there” approach that was not quite so daunting. This was a real positive when coding is limited to what feels like a 15-minute window between the kids’ bed time and falling asleep myself.

The second thing I love is that it has all my favourite characteristics of a language: strong, static typing, pattern matching, immutable data, etc, etc. The Elm compiler also has the best & most useful error messages I have ever seen. Seriously. They’re fantastic.

The third thing I love is that there is a well-defined pattern for building applications in Elm that is simple enough to illustrate with sane basic examples. In so many cases, examples have stuff that makes no sense in context but is required if you want your app to grow or they illustrate a simple concept in such a way that will cripple your program as it gets larger.

Having an architecture that encourages you to do the obviously right thing at any point and having that choice remain the right thing even after your program grows is a fabulous help.

I fully expect that initial hump that I experienced with Angular is just that – a hump that disappears once you’ve gotten properly started. Unfortunately my available time didn’t allow for any ramp up, so I probably didn’t give it a fair go. Also, I have a bit of a background with Haskell, so it’s entirely possibly that I’ve simply paid for that hump with Elm back in my freewheeling, child-free days.

Anyway, I like it. Check it out.

Leave a comment