week 34, 2019

Haskell - An Experience Summary

Approximately a year ago, we chose to begin the process of migrating our backend into Haskell. As of March 2019, Holmusk is now powered fully by Haskell and this post is a summary of our experiences so far.

In the evening I read Haskell - An Experience Summary, an article published on the Holmusk Tech Blog.

Counting tumblelog days

In the afternoon I was curious how many days I had blogged on Plurrrr. A simple one-liner using find on the command line provided the answer: 150.

find htdocs/archive/ \
     -name '*.html'  \
     -print | grep -cv week

This one-liner finds all files ending in .html in the archive directory and prints the path and filename of each match. The grep command counts (option -c) all lines except for those containing week; the option -v inverts the match.

Note that I split the one-liner over 3 lines for clarity and to make it fit on this page by using backslashes. A backslash at the end of a line means the line continues on the next line. You can either copy paste the example as is, or glue the lines together to get a true one-liner.

Time to shed Python 2

The end of life (EOL) date for Python 2 has been a long time coming, but it's finally in sight. As of the 1st of January 2020, Python 2 will no longer be supported. There will be no more bug fixes, or security updates, from Python's core developers.

So, if you're still using 2.x, it's time to port your code to Python 3. If you continue to use unsupported modules, you are risking the security of your organisation and data, as vulnerabilities will sooner or later appear which nobody is fixing.

In the evening I read Time to shed Python 2 on the National Cyber Security Centre website.

When I wrote the Python version of tumblelog, the static site generator that creates this blog, I made sure to use a recent version of Python. Not only because of the upcoming end-of-life of Python 2 but also because of the handy new features in Python 3.

Coming soon: tumblelog 2.0.0

In the evening I worked a little on what will become tumblelog version 2.0.0. In this version the following Markdown:

A cat resting in the shadows.

will be rendered to HTML as follows:

<img src="cat.jpg" alt="photo" />
A cat resting in the shadows.

instead of the default for CommonMark, the renderer I use:

<img src="cat.jpg" alt="photo" />
A cat resting in the shadows.

This makes it possible to style the image and the caption via CSS.

Image rendering in tumblelog 2.0.0
Image rendering in tumblelog 2.0.0.

The Python version is finished, and currently used to test this feature on this site. For the Perl version I have to create a Perl module and release it on CPAN. This module will make it possible to render the CommonMark abstract syntax tree (AST) in a different way in order to get the desired HTML output.

The Daemoniac: an entertaining read

In the early afternoon, just before work, I finished The Daemoniac. It was an entertaining read, I liked the young female protagonist a lot.

In the "Note to the reader" the author, Kat Ross, explains that in the sequel, The Thirteenth Gate, she brings together the characters of her Fourth Element series and the Dominion mystery series. So, before I start in this sequel I want first to read the Fourth Element trilogy, probably next month.


In the year 2204, humanity is expanding into the wider galaxy in leaps and bounds. Cutting-edge technology of linked jump gates has rendered most forms of transportation—including starships—virtually obsolete. Every place on Earth, every distant planet humankind has settled, is now merely a step away from any other. All seems wonderful—until a crashed alien spaceship of unknown origin is found on a newly located world eighty-nine light-years from Earth, carrying a cargo as strange as it is horrifying. To assess the potential of the threat, a high-powered team is dispatched to investigate. But one of them may not be all they seem. . . .

In the evening I started in Salvation, the first book in the Salvation Sequence by Peter F. Hamilton.

I've read most of Hamilton's books and I like his writing a lot, so I look forward to the start of this new series.

Planet of Adventure

Stranded on the distant planet Tschai, young Adam Reith is the sole survivor of a space mission who discovers the world is inhabited--not only by warring alien cultures, but human slaves as well, taken early in Earth's history. Reith must find a way off planet to warn the Earth of Tschai's deadly existence. ⇧ Against a backdrop of baroque cities and haunted wastelands, sumptuous palaces and riotous inns, Reith will encounter deadly wastrels and murderous aliens, dastardly villains and conniving scoundrels.

And always the random beauty in need of rescue...

Source: GoodReads.

Late in the evening I talked with Adam. He asked me if he could read one of my books and I asked him and Esme to show me the bookcase with the camera, as they are in Mexico and I am in The Netherlands.

I recommended Planet of Adventure by Jack Vance; one of my favourite books by this author.

The cover of "Planet of Adventure" by Jack Vance
The cover of "Planet of Adventure" by Jack Vance.

When Adam read the back of the book and discovered his name he jumped up and down and yelled "I am a character in a book". He went outside and told his sister, Alice, as well. He was very happy, more so when I told him he was in fact named after the protagonist in the book.

Code is not Literature

I have started code reading groups at the last two companies I’ve worked at, Etsy and Twitter, and some folks have asked for my advice about code reading and running code reading groups. Tl;dr: don’t start a code reading group. What you should start instead I’ll get to in a moment but first I need to explain how I arrived at my current opinion.

In the evening I read Code is not Literature by Peter Seibel. A recommended read.

YAML: probably not so great after all

Don’t get me wrong, it’s not like YAML is absolutely terrible – it’s probably better than using JSON – but it’s not exactly great either. There are some drawbacks and surprises that are not at all obvious at first, and there are a number of better alternatives such as TOML and other more specialized formats. Personally I’m not likely to use it again when I’ve got a choice.

One good alternative might be to just use commandline flags.

If you must use YAML then I recommend you use StrictYAML, which removes some (though not all) of the more hairy parts.

The above is the conclusion Martin Tournoij reaches in his article YAML: probably not so great after all

Don't Fear the Makefile

I’m writing this because I have the feeling that many developers underestimate the power of Makefiles and they are simply not aware of this nice and handy tool which is installed on nearly every Unix-like machine. To be honest, who have never executed a make install or something similar? Most tutorials I’ve found out there are bloated with stuff, more complex than they would have to and you have to read pages after pages to get the basics.

writes Max in his introduction of Don't Fear the Makefile.