I am going to start working on a webapp, and am currently deciding which language/tech/framework/etc to use. Elm is my first choice but I am anticipating a potential issue:
Chrome OS will be the primary platform where the app will be used. While I don’t anticipate any problems running an Elm app on Chrome OS, the design of the app is such that I want to give people the ability to customize the app and create additional functionality using whatever language the app itself will be written in.
With the above design goal in mind, I wanted to ask if there are any plans for compiling Elm code locally within a webapp? I am familiar with Ellie, but the last time I looked into it, there was still a server component required for the compilation process.
As best I can tell, compiling Elm directly in the browser would currently require some kind of Haskell → JS transpiler. There seem to be a few efforts along these lines like Haste or ghcjs, but I’m not familiar with Haskell so I don’t know if the Elm compiler, as it’s currently built, can work with these tools.
Any thoughts about the near-term (or long-term) viability of compiling Elm within a webapp?
Based off of what I heard @luke talk about at Elm Conf in 2017, the latest versions of Ellie have the Elm compiler running 100% in the browser. What you’re trying to do is rather specific, so my guess is that you will not find find too many other examples of the Elm compiler in the browser. I would take another look Ellie.
As a sidenote, if you’re planning on allowing the user to customize the app from within the app, you could look into allowing the user to write in an Elm-like Domain-Specific Language, and then parsing that DSL in Elm using a tool like elm-tools/parser. This way you don’t need to recompile, just interpret the DSL that the user inputs into Elm. The other benefit of this approach is that you can limit the customizations that the user can make to whatever your DSL includes.
Another great introduction to DSLs: DSL For the Uninitiated
Thanks! Based on Luke’s talk, he seems intent to get the Elm Platform working entirely within the browser, so it looks like it’ll happen eventually. Using a DSL is an interesting idea as well.
I have some more recent learnings that I can share which might help you make decisions:
For these reasons, if I were trying to build a program where I wanted the user to write extensions and I just wanted to get the feature finished then I would either use a different language or make a DSL like @christian suggested. Using Elm will be a lot more work and it includes the risk that upgrading will be blocked in the future.
he seems intent to get the Elm Platform working entirely within the browser
These things I outlined in combination with access to new funding for a server have led me to change course. I’m currently moving Ellie’s compiler integration completely back to the server.
Thank you Luke for these updates and insights! As much as I’d like to use Elm, looks like I might have to go with a different stack for this particular project.
Hey @remmah, have you considered using ports to open up some extension points? I don’t know the details of what kind of extensions you’re trying to enable, but it seems like that would be simpler and would also probably be simpler for users if they had some clear extension points that they could hook into.
An exciting update: It looks like Chrome OS will be able to run linux programs locally in the future, so the standard Elm compiler should be able to be invoked (along with using your linux text editor/IDE of choice).