ELM , running locally on Windows 10

Elm leafs

Wow. what a title! Ideal for trapping the passing innocent (but sharp and progressive) programmer.

If you are here reading this, I assume you are not a botanist, and you obviously know what is ELM and a bit more about it. So, how do we achieve this master-level ELM magic? How do we make ELM “executable” run “locally” and on Windows (any Windows since 1999) on top of that?

It turns out to be very simple. ELM compiler targets JavaScript. And the result pops-up in one large-ish index.html.

One just has to rename the resulting index.html into index.hta and voila!  We have bog-standard-vanilla-good-old Windows HTA , circa 1999!

There was a “Little” problem on that journey of discovery. My version of ELM was producing index.html with a JavaScript bug in it.

// index.html as produced by ELM compiler
// has/had a bug around a line 10123.
// an JavaScript syntax error that was quietly 
// consumed and "Put under the carpet"
// by so called "modern browsers"
return {
keys: keys, // A hash of key name to index
free: free, // An array of unkeyed item indices

That comma after free is ok in most of the latest browsers, circa 2020 Q1, but not for venerable HTA., runing Internet Explorer Web View Control. So, I removed the offending coma.
return {
keys: keys, 
free: free // COMMA REMOVED

Perhaps the syntax error in ELM compiler output, might delay your “let’s do it all in ELM!” plans, but it is still early days for a prog-lang. Or not?

Anyway, I did this in index.hta and all was fine. I had the eponymous “Hello World!” courtesy of dbj.org.

Hello, ELM+HTA World! Courtesy of dbj.org 2016 Jan 22
Hello, ELM+HTA World! Courtesy of dbj.org 2016 Jan 22



Repository is here

This is where I will be progressing with ELM+HTA attempts and a such.  Any forks are welcome, but not pitchforks :)

For “heads up” … Feel free to play with HTA:APPLICATION and a such, but remember to include FireBug Lite, as ELM JS code is using console. In case browser does not support console, it is provided by FBL inclusion. But then again non-existence of console allowed me to spot a syntax error and remove it.

For further playing with this there are still plenty of serious helpful people and pages on the net.

One thought on “ELM , running locally on Windows 10”

Comments are closed.