Note to self: should replace `'a` with proper phantom types here and below.