BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Elm 0.11 Improves JavaScript Interop

Elm 0.11 Improves JavaScript Interop

This item in japanese

Elm’s recent 0.11 release aims to simplify using the FRP language in combination with Javascript. To achieve this goal, two key aspects have been added:

  1. The ability to create Components, which are compiled Elm code that is embeddable within a div. Once embedded it will act as a normal part of the page.

  2. Ports are the means for communication between JavaScript and Elm. Messages are passed into the Elm Component via defined in-ports, while replies are handled by call back functions subscribed to out-ports.

These two elements in combination allow you to create embeddable UI widgets and processing units using Elm’s Haskell styled syntax and libraries.

Elm’s author, Evan Czaplicki, spoke about the future of Elm during the first Elm Workshop, held in Budapest in November 2013. He expressed four priorities for Elm’s development:

  1. Library sharing.

  2. HTML and JavaScript integration.

  3. Easing contributions from others to Elm.

  4. Tail call optimization.

He also demoed a prototype REPL for Elm, following a request from the community.

There are many examples of Elm applications to interact with on the main website. A basic Mario game, largely created in front of a live audience at Strange Loop 2013, shows off Elm’s graphical abilities. For a more practical example take a look at the Todo application (demo), the “Hello World” of web frameworks. For an indepth look into the theoretical underpinnings of Elm see Evan’s paper, which he presented at the Programming Language Design and Implementation Conference 2013.

InfoQ talked with Evan about his progress on those priorities:

InfoQ: At the workshop, it sounded like you might integrate with Node Package Modules, to deliver a library solution for Elm, but you had reservations about being able to segregate Elm modules from the rest. Have you managed to resolve that issue or have you decided on a different solution?

Evan: I decided on a different solution, and I am really happy I did! Elm Public Library was recently released, making it easy to share libraries. It is backed by GitHub, but otherwise built from scratch to be a delightful experience for Elm users. This gives me the freedom to provide easily searchable documentation (written in Elm) that displays types, documentation, and examples. The announcement goes into much more depth about technical decisions and roadmap, but the important part is that you can now share libraries!

InfoQ: In 2012 you wanted to get more industry support for Elm. Has your role at Prezi brought the support you were looking for?

Evan: Definitely! Working at Prezi has significantly accelerated Elm's development, but more importantly, it helps me really focus on getting Elm's ecosystem ready for industrial users. This has been my goal since early on, but I now have a friendly and technically skilled support structure to help make it happen. So when I am prioritizing features or tweaking an API, there are always engineers happy to discuss and improve things. In one case I was directly inspired by Prezi's language interop infrastructure, leading to Elm's ports which make Elm/JS interop simple and seamless.

InfoQ: What is the roadmap for Elm now?

Evan: With ports in 0.11 and the upcoming Graphics.Input overhaul, I feel like Elm is getting extremely close to production ready. This summer we will be focusing on squeezing more performance out of the runtime, supporting tail-call elimination, and improving debugging and IDE support. Working on optimization and tooling indicates a general shift towards supporting production users rather than working on the language itself.

In the meantime, Prezi is already using Elm internally. I am really excited to see this happening! The key observation so far is that the component model works really well in practice. Some components are very nice to write in Elm and now we can easily integrate them into larger JS or TypeScript projects. We are actually looking for a developer to write more Elm at Prezi, I think this will be the trial by fire that proves Elm is ready for industry.

Rate this Article

Adoption
Style

BT