Latest Posts

  • 29th January 2019

When to use `never` and `unknown` in TypeScript

This is an excerpt of a post that I wrote for LogRocket. The never and unknown primitive types were introduced in TypeScript v2.0 and v3.0 respectively. These two types represent fundamental and complementary aspects of type theory. TypeScript is carefully designed according to principles of type theory, but it is also a practical language, and its features all have practical uses – including never and unknown. To understand those uses we will have to begin with the question, what exactly are types? …

Read more 
  • 16th August 2018

Automatic Code Formatting for Partially-Staged Files

I wrote git-format-staged to apply an automatic code formatter or linter to staged files. It ignores unstaged changes, and leaves those changes unstaged. When run in a Git pre-commit hook git-format-staged guarantees that committed files are formatted properly, and does not clobber unstaged changes if formatting cannot be applied to working tree files cleanly.

Read more 
  • 13th May 2018

I finally set up XMonad to build with Stack!

Reconfiguring the XMonad window manager involves having XMonad recompile itself. It took some effort to get XMonad to build itself using my preferred dependency management and build tool, Stack. Here's how I did it.

Read more