CHECK constraints are a powerful way to control data stored in a SQL database. Combined with choosing the appropriate type for we can enforce that the data written adheres to our business rules.
Building slim Docker images for Haskell applications
Providing an application as a Docker executable image is a handy way to distribute an application: no need to install toolchains, frameworks and dependencies. One can just pull a Docker image and run it. It’s really that simple. Docker images can grow wildly in size because they need to install all the dependecies needed to run the application: this as a user can be quite annoying. Imagine you want to use a tiny application that solves a very specific problem and you have to download a 2GB Docker image! It’s undesirable. And it’s actually not needed: why not shipping only the executable in a very compact Docker image? How can this be achieved if the application is built in Haskell?
Connecting to a dockerised postgres instance via psql using user-defined bridge networks
Docker containers can communicate with each other either using the deprecated links machinery or using user-defined networks. The latter also is the way to go when using docker-compose since a user-defined network is created by default (at least in recent versions).
Generating a sitemap of a website built with Hakyll
Adding sitemap.xml and robots.txt to a website built with Hakyll is not explicitly documented but it ended up being quite easy with the help of some DuckDuckGo-fu.