Intro to Template Haskell

Compile-time evaluation

I’ve been wanting to write about Template Haskell for a while. Like many Haskell users, I’m not a huge fan of metaprogramming in general – but I do think that, when applied judiciously, it has some great applications.

Template Haskell is hard to approach because the API is huge. There are some tough concepts, and there are a lot of laborious details. So rather than write a big overview of Template Haskell, I’m starting from a narrow use case: Making constant expressions evaluate during compilation. This article emphasizes why you might want metaprogramming for this particular situation. And, thanks to the wonderful DeriveLift extension, we get to skip over most of the tedious details contained within the template-haskell package.

NixOS on EC2 update

Type Classes had some downtime yesterday due to a misunderstanding I had about the role of user data in NixOS EC2 initialization: The instance automatically switches to the config specified in the user data every time the server boots, not just the first time. I’ve updated the article on how we deploy the Type Classes servers to include this information.