Goodbye Hakyll / Haskell, hello Zola / Rust!

It is this time of the year where I once again felt the urge to write something and revive this homepage of mine by infusing some new content, possibly write all those things down I’ve been planning to for a while. But the page initially was built using Hakyll, which is a very cool and very hackable static site generator (actually, a library) implemented in Haskell. Here I reflect on my choice to migrate the page from Hakyll to Zola, which is happening in parallel to my slow shift away from Haskell towards Rust.

From Haskell to Rust

While I have been a huge fan and enthusiast of Haskell and also used it for multiple hobby projects, and would have loved to use it at work (and actually still would, if it really is the right tool for a task), I have not used it in quite a while. And, truth be told, I’ve grown older, wiser, more lazy, and have less time.

I learned so much about code, mathematics, structure and thinking from Haskell and its community. But over the years, and since having an actual job where I need to responsibly develop software, I learned to value many other things in programming languages going beyond the syntax and features of a language. And just like I had to accept that it is not my destiny to be a researcher in TCS, I more and more see and accept that I am simply not the person who is able to wield “co-free affine comonad transformer lenses”1 to solve my coding problems, at least not in the way the very smart people who use Haskell seriously and blog about it seem to do so effortlessly.

While I have been very much enjoying to learn bits and pieces of type theory, programming language theory and also category theory just for its own sake (where Haskell, Coq, Agda and Idris are the places to be), more recently I feel the need for a more pragmatic and immediately practical language to just quickly get stuff done.

At work I use Python – because of the setting and the ecosystem. I can’t say that I really like Python, but with type hints, lots of tooling, and high-quality well-documented libraries, it is quite bearable (even though, sadly, the avearage code quality of what is out there is abysmal). And in fact I must admit - it is nice to spin up a Jupyter notebook with Python to quickly load some table and easily plot it. But it will never be a language I genuinely like and am excited about, for many many reasons.

A language that I do like is Rust, and after some good initial flirting experience over 5 years ago, I had it on my to-learn list for a while. Finally, it is happening – I am working on a non-trivial hobby project using Rust (this will hopefully yield a bunch of posts here), and I am very much enjoying it. The people who created Rust took the 70-80% of what makes Haskell a good language (sacrificing some arcane type sorcery by necessity and/or for good reasons), combined it with the crucial parts that make C and C++ successful languages, and even had the wisdom to prioritize building very good tooling (possibly learning from Java).

Rust is both ambitious and pragmatic, in the sense of balancing doing the right thing and doing the practical thing, respectively in the right places. It feels like Rust could (or even should) become my new favorite language. I have been watching it grow for a few years, and now it feels like a good time to jump in. As more and more major companies adopt Rust and it even got blessed by Linus Torvalds himself, It also feels like learning Rust is also a good time investment from a professional point of view. Not to mention that having an actually nice language under your belt which is also damn fast is simply amazing.

From Hakyll to Zola

My site used an old version of Hakyll, I did not even understand my configuration code anymore, and to build it I needed to install the whole toolchain and libraries, which takes lots of both space and time. But all I wanted to do was to simply write a post.

Annoyed by my old and rusty (pun intended) Hakyll-based website, I decided to switch the backend to something simpler to work with and maintain. Looking for a Rust-based generator I found Zola. In the end it does not actually matter that Zola is built with Rust, but in fact it is a nice static site generator. It can provide everything I want without much effort – either out of the box, or by using some good themes and useful code snippets. My requirements are very modest:

  • pages and blog posts
  • syntax highlighting
  • math formatting
  • Atom/RSS feed

Probably any static site generator would be fine, I happened to choose Zola and I am quite satisfied with the result. The templating language feels very similar to Jinja2, which I have some experience with from cookiecutter and Python backend development.

Once I settled on a theme and tweaked it a bit, it was mostly smooth sailing and repetitive syntactic changes in the post metadata headers. Luckily there are not so many pages to migrate. The most annoying part was switching from MathJax to KaTeX (which is faster, but less powerful), as I needed to fix many formulas in some of the posts, but this is not strictly a Zola-specific issue. Probably I’ll tweak and customize the theme some more in the future, as the need arises, but for now I think that the result is at least not worse than the old site.


Haskell word salad for dramatic effect.