Compiling a New Kind of Faster Curry
Shant Hairapetian
Committee: Zena Ariola (chair), Michal Young, Paul Downen
Masters Thesis(Aug 2021)
Keywords: currying, arity, type systems, kinds, Haskell, GHC, compilers

Traditionally, programming languages based on lambda calculus such as Haskell and ML do not support functions with a number of arguments (or arity) greater than one. In these languages, currying emulates the passing of multiple arguments by accepting one argument at a time and returning a closure that accepts the next. This approach is inefficient from a performance perspective. As such, Downen et al [A faster Curry with Extensional Types] proposed the addition of a primitive, extensional function type that accepts all of its arguments at once. Though this new function type enabled optimization for functions across known types, generic types could not enjoy this optimization. In their follow-up paper [Kinds are Calling Conventions] Downen et al proposed a new kind of system which allows for statically tracking arity information about generic types, thereby enabling faster currying and efficient compilation for these generic types. This paper will discuss the implementation of both of these changes in GHC (Glasgow Haskell Compiler).