Type-level magic