Hamler Blog Post Series …
- Hamler (I) - First week (this post)
- Hamler (II) - All solutions for part 1 (in Hamler and Haskell)
- Hamler (III) - Making Day21 10 times faster
What’s at the intersection of Haskell, the Erlang Beam/OTP and the Advent-of-Code?
Yes, right: Hamler!
Hamler is a Haskell-like language that runs on the Erlang Beam/OTP.
At Community we are big Beam/OTP fans (because we like highly-scalable and highly-available shared nothing micro-services systems). Our entire backend runs on the Beam (written in Elixir).
And I am a big fan of Haskell and Functional Programming and the Advent-of-Code (I guess you can see, where this is going :)).
So … I figured, this year I do the Advent-of-Code in Hamler (and as far as I can see it, I am the only one to do it Hamler).
There are a couple of questions I want to answer …
- How stable is Hamler? Does it work? Does it crash? A lot? When compiling code? When running code?
- How close is it to Haskell? Do you have to learn a new language or can you (more or less) write Haskell code and “it will just work” (tm)?
- How complete is it? Is all of Haskell supported? Or just parts of it? Which parts?
- How about the eco-system? Are there (already) any libraries? Is there a Hamler version of Hackage?
- How about the development environment? Can you use existing IDE’s to develop Hamler code?
- How about the performance? Is it as fast as Haskell? As fast as Erlang?
- How about the exisiting Haskell eco-system? Can you use/reuse existing Haskell code in Hamler?
- How about the existing Erlang eco-system? Can you use/resuse existing Erlang code (or maybe even Elixir code) in Hamler?
- How about the Beam/OTP? How can you use GenServers and Supervisors?
First (to set the scene/stage): Hamler was/is developed/sponsored by EMQ. EMQ is an open source software company providing highly-scalable, real-time messaging and streaming engine for IoT platform & applications in 5G Era. It is implemented in Erlang. But (it seems) that the guys at EMQ also felt that there are a couple of things that are missing, when you use Erlang as the means to get to the goodness of OTP and the Beam (not to dissimilar to Jose’s motivation when he started Elixir).
The first impression (week 1) is good. Hamler is much more stable than I thought. The compiler works and is giving meaningful error messages. The runtime works and is only crashing when I am doing something wrong.
The (not so unexpected) gaps are the lack of tooling (but … there is a repl and I was able to get good millage out of the emacs haskell-mode (without using a/the lsp-mode/-server (obvisoulsy)) and the small number libraries and packages that are available (when you do the AoC, something like MegaParsec is obviously very useful to read/parse the input files).
After I am done, I will followup with a couple of blog-posts to answer the questions above. Stay tuned …