top | item 27808306

Elm Compiler Written in Elm

126 points| otobrglez | 4 years ago |github.com

79 comments

order
[+] lisardman|4 years ago|reply
Sad that they have to put a massive "Non-goals" full of emojis so the main Elm team does't feel threated. A languange doesn't lose anything with an extra compiler - a competing compiler is actually what Elm needs right now.
[+] vanderZwan|4 years ago|reply
I don't see how the emojis have anything to do with that section, since they're all over the readme anyway. Aside from that: what they're stating is that they "don't want to and aren't planning to divide the community into multiple Elm derivatives, and will actively try to prevent that". Not dividing the community is not the same thing as threatening the main Elm team. And for a smallish language like Elm it makes sense to me that they want to keep everyone on the same team.
[+] mjaniczek|4 years ago|reply
Hello! Author here. Didn't expect to land on HN before the compiler is actually useful - Oto, you'll pay for this! :)

Feel free to ask me anything about the project, although bear with me - I'm learning compilers/... on the go, didn't study them or anything.

[+] tpoindex|4 years ago|reply
eie.io would be an awesome domain name for this project. Too bad it's already parked by a squatter as a "premium name". (For non-native or non-Western English speakers, it's a line from the children's song "Old McDonald Had a Farm".)
[+] neolog|4 years ago|reply
> EIEIO (“Enhanced Implementation of Emacs Interpreted Objects”) provides an Object Oriented layer for Emacs Lisp, following the basic concepts of the Common Lisp Object System (CLOS). It provides a framework for writing object-oriented applications in Emacs.

https://www.gnu.org/software/emacs/manual/html_node/eieio/

[+] forgotpwd16|4 years ago|reply
Premium names aren't squatted but designated as such by the central registry. For the TLDs .ac, .io, and .sh those are previously unavailable short domains that are now released to public and auctioned by Divido, the company that has set up the site you see.
[+] andrewzah|4 years ago|reply
I know you're not trying to replace the official Elm compiler, but that's precisely what is needed. I really, really wanted to like Elm but the way it's managed is horrible and antithetical to the idea of Open Source software. With the current compiler I wouldn't touch Elm with a 39.5" pole, even if Elm is a joy to work with.
[+] savanaly|4 years ago|reply
One's attitude towards Elm directly correlates with the degree to which one likes to dig into and tinker with the internals of their tools and frameworks and rearrange things. Unfortunately that means it's a hard sell around HN-- in a way it's antithetical to "hackers". But I don't think it's antithetical to John Carmack's proverbial "engineer"-- someone who wants to do what they can do with what they've actually got. Elm lets me do what I want to do, exceedingly efficiently and makes it fun, and that should make it a good choice for plenty of projects.
[+] Ciantic|4 years ago|reply
I like it! I gather now you can compile Elm in the browser? It allows many things, similarly as F# with Fable, which allows to compile F# code in browser without a server.

Ability to compile code in browser allows to do sandboxes, or tools that otherwise would require a server.

[+] pd-andy|4 years ago|reply
I think the project is a while off of being properly usable. I think it's mostly written with Node in mind, but shouldn't be too difficult to swap out the Fs bits for browser-specific code.
[+] mjaniczek|4 years ago|reply
As pd-andy says, it's not finished yet, but yes you're right, that's one of the things it will enable: interpreting Elm code from within Elm - an eval function of sorts.
[+] rishav_sharan|4 years ago|reply
I really would love to have this compiler have a llvm backend. I like the idea of a small FP language with amazing error messages. Haskell is too big and complex for me.
[+] mjaniczek|4 years ago|reply
I've briefly looked at LLVM and how to interface with it but back then I didn't find much else than some C++ Builder API. I'd hope for some textual format that I could give to LLVM as an input. I assume it exists and that I've just been googling wrong :) Would definitely appreciate some pointers in that regard.

Other than that my best bet for native binaries is most likely compiling to C or GraalVM (which already exists as an experimental backend in elm-in-elm via Truffle!)

[+] yladiz|4 years ago|reply
Serious question: how popular is Elm? I've recently seen some tutorials showing up and anecdotally know some friends that have played around with it, but I haven't seen any job postings for it and so I'm wondering if it's just hyped up or if there is real demand for Elm developers professionally.
[+] toastal|4 years ago|reply
There was a sizable rift after Elm’s 0.19 version. Removing synchronous FFI, especially to existing browser APIs that haven’t been rewrapped with a new API by the core team caused a lot of individuals and businesses to migrate mainly to PureScript, Reason, and/or Typescript—myself included. Couple with community hierarchy issues, lack of development/roadmap transparency, rotting merge requests to the core libraries (security, bugfix, and performance issues), and community libraries, Git hosting, and identity tied solely to Microsoft’s GitHub accounts, it’s not something I personally could recommend. I do however think it’s a great learning language—especially for first-time functional programming—but I would be very hesitant in your assessment for production if you need to scale to use browser APIs, i18n, l10n, etc. or like/need the ability to fork and contribute to the core.
[+] pd-andy|4 years ago|reply
Neither, really. I'd say it has the largest community out of the various compile-to-js statically typed FP langs, at least with an explicit front-end focus.

- PureScript has a small but passionate community, one of the biggest players in that community laid off their whole ps team so that doesn't bode well.

- ReasonML fractured into ReScript but left half the Reason community behind, it's a confusing space to navigate now.

- GHCJS...

Most (perhaps even all) of the job postings end up on the elm slack (rather than, say, reddit or other more visible places).

There was some controversy with the release of 0.19 a couple of years ago, and general contempt (in the wider community, not inside Elm) for the way the language is developed and run which means there isn't a great deal of buzz about it outside of those already using it.

[+] mrweasel|4 years ago|reply
There where an article recently regarding Humios use of Elm: https://www.humio.com/whats-new/blog/why-we-chose-elm-for-hu...

Using job postings isn't really that useful. If they where any indication then the two only language in existence would be Java and C#. That depends on where you live of cause. E.g. there are plenty of Python jobs around where I live, but they aren't frequently posted on the regular job sites. I'd suspect that Elm jobs are posted where Elm developers are to be found.

[+] gampleman|4 years ago|reply
I write Elm full time, so there are definitely jobs out there.

That said, I suspect that given how fun the language is to write, supply probably outpaces demand a bit. Which is actually good, in the sense that for many companies adopting a somewhat less mainstream language one of the main concerns is "will I be able to hire for this?", which generally the answer is "yes, especially for more senior positions".

[+] wolfadex|4 years ago|reply
We have a team at Square that uses Elm and I've made a few commits. They've been working on their app for around 18 months now.

I find it slightly funny because I also write Svelte at work and that app is public facing so it gets public attention but the Elm app is internal facing so the public will never see it. Also helps that Svelte uses its own name in the code it generates. Which is why I try to promote Elm myself. To semi-quote @SvelteSociety "@Square, a >$100 billon company, uses @elmlang."

[+] girishso|4 years ago|reply
I’ve been writing Elm professionally for the past 2.5 years on a large project. The language is a pure joy to use, unparalleled refactoring experience. Yes it’s a small community, but there’s many jobs posted on Elm slack.
[+] mjaniczek|4 years ago|reply
The #jobs section on the Elm Slack is quite alive.

Can't speak for the community as whole, but there is at least some demand: the company I'm working for is actively hiring Elm devs for at least two teams at this moment :)

[+] yakshaving_jgt|4 years ago|reply
I write Elm and I hire Elm (and Haskell) programmers. It works great for our business so we’re going to continue doing that.
[+] leshow|4 years ago|reply
AFAIK Elm can't actually write to the filesystem, how does the compiler get around that? Or has Elm changed such that it can work outside the browser now?
[+] mjaniczek|4 years ago|reply
I use ports to write to the filesystem. There is a small amount of JS that initializes Elm, which runs in Node and has the ability to write to the filesystem.

Of course if you'll be running elm-in-elm in the browser, you won't be able to do that. But there are more interesting things to do with a compiler in the browser :)

[+] de_keyboard|4 years ago|reply
Very cool! However, could they not compile the Haskell Elm compiler to JS using GHCJS and then write Elm bindings for it?
[+] raffomania|4 years ago|reply
One of their stated goals is to show people how to write a compiler in Elm, and another is to allow programmers familiar with Elm to hack on the Elm compiler without needing to learn Haskell.
[+] mjaniczek|4 years ago|reply
One thing to note is that writing the compiler in Elm instead of just compiling the Haskell compiler to JS allows us to expose bits of the compiler as an Elm library.

I mean, being able to bootstrap is nice and nerdy and so on, but I believe exposing the parser, optimizer, type inference etc. as standalone functions will be the most impactful aspect of the repo, in terms of enabling better tooling in the Elm ecosystem.

[+] pd-andy|4 years ago|reply
The compiler written in Haskell relies on some extensions and/or optimisation tricks that make it not possible to compile with GHCJS. The 0.18 compiler (or maybe it was 0.17) was compiled with it though, it was what Ellie (third-party online playground) used.
[+] terezasokol|4 years ago|reply
Great work, Martin! Excited to see how the project turns out <3