Higher-order type-level programming in Haskell

  • Csongor Kiss ,
  • Susan Eisenbach ,
  • Tony Field ,
  • Simon Peyton Jones

International Conference on Functional Programming (ICFP'19) |

Published by ACM

Type family applications in Haskell must be fully saturated. This means that all type-level functions have to be first-order, leading to code that is both messy and longwinded. In this paper we detail an extension to GHC that removes this restriction. We augment Haskell’s existing type arrow, (->), with an  unmatchable arrow, (~>), that supports partial application of type families without compromising soundness. A soundness proof is provided.

We show how the techniques described can lead to substantial code-size reduction (circa 80%) i the type-level logic of commonly-used type-level libraries whilst simultaneously improving code quality and readability.