Lost in the bazar — Elm to the rescue?

I’ve been looking for a package that integrates Elm (http://elm-lang.org/) with Meteor, but haven’t found it. Elm is a (simplified) Haskellish language that compiles to JavaScript.

Elm and the Elm architecture is a clean implementation of reactive functional programming for the frontend. It’s the logical consequence of the mess that is the React/Flux/Reflux/Redux/Whatever architecture in JS today. Boy am I sick of it. We are truly lost in the bazar.

Could Elm be our saviour? And is at at all viable to integrate Elm with Meteor? Does anyone know of packages or ongoing projects that attempts this?

6 Likes

You can use Elm in Meteor by integrating webpack into Meteor. Then you can utilize the Elm loader to build elm files. An alternative would be to just manually build Elm files into the meteor project and let Meteor package up the compiled JS:

meteor_core/
  client/
    elm_ports.js
  server/
elm_app/
  elm_stuff/
makefile

That’s going to be the easiest way. You could also build a package to compile but my thoughts are that it’s not worth it just to have everything in one folder. It’s best to thing of Elm as it’s own separate thing anyhow IMHO.

6 Likes

I’ll put this here for reference; I created the elm:make Meteor package which is a neat build plugin that lets you build Elm inside meteor projects.

5 Likes

Thanks for sharing. Would be curious to hear if anyone has had success using Elm with Meteor (instead of React) using one of the above approaches or any other. Am interested in giving it a try.

Solution 1)

I tried to write an elm-compiler package.

Solution 2)

1 Like

Awesome! Thank you for helping me explore this, would love to get it working smoothly!

Full example: Meteor-Elm-Example

1 Like

the downside of recompilation mentioned in solution 2 solved in the meteor-elm-example. see link above.