Nix has changed everything
I've carried the same dotfiles around for years, copying them from machine to machine, patching over the differences by hand, and never quite trusting that a fresh setup would end up like the last one. I used my dotfiles to configure my Linux machines at home as well as my MacBook, which I generally use for work. Every time I set up a new machine, I ended up tweaking the scripts to fix a broken package or a moved config path.
I also preferred using a Linux distribution with a rolling release, so that I could try out the latest versions of the tools I use. I moved from Ubuntu to Manjaro ages ago for this reason, but my dotfiles often broke in the most unexpected ways.
So I decided to run an experiment: rebuild my entire environment declaratively with Nix and try out NixOS, and see how far the reproducibility actually goes. The result is nix-dotfiles.
Continue reading →A story about map
In Haskell, map is defined as:
map :: (a -> b) -> [a] -> [b]
Continue reading →
A lesson from open source software
I've always tried to contribute to open source software whenever I've seen the opportunity, but becoming a maintainer of an open source library gave me some completely new perspectives.
I've used Emacs for almost a decade, and I used Vim before that. Maybe the fact that vi key bindings are just another package in Emacs, called Evil, was one of the reasons I switched to Emacs. I like modal editing, but I don't use Evil. Instead, I use God mode with Emacs key bindings.
At some point, I discovered Doom Emacs, which packed a lot of functionality that interested me compared to other Emacs distributions.
Continue reading →Can functors solve the expression problem?
An elegant approach to solve the Expression Problem is to use functors and F-algebras to decompose expression types, allowing us to add new variants and new operations easily through modules. The goal is to define a data type by cases while being able to add both new variants and operations without recompiling existing code, and while retaining static type safety.
In Haskell, adding new operations over a fixed set of types is easily done by writing a new function. But adding a new type variant to an existing data type forces you to touch every function that pattern-matches on it. In object-oriented languages the problem is actually reversed.
Continue reading →