Flow-Directed Monomorphization in SCC
Modern functional languages rely heavily on parametric polymorphism, allowing data structures and algorithms to be defined generically over arbitrary types. To eliminate the overhead of boxing and enable further optimizations, compilers typically employ monomorphization, which is the process of generating type-specialized copies of generic definitions. This thesis extends the Sequent Calculus Compiler (SCC), a research compiler whose intermediate representation is grounded in Gentzen’s classical sequent calculus, with first-class support for parametric polymorphism across both the Fun surface language and the Core IR. Currently, SCC supports only a limited form of polymorphism for data and codata types, resolved implicitly during type checking with no polymorphism at the term level. We address this by extending Fun and Core with structural type parameters and adapting the flow-directed monomorphization algorithm of Lutze, Schuster, and Brachthäuser (2025) to the sequent calculus setting, realizing it as a dedicated Core-to-Core pass that must account for the symmetric treatment of producers and consumers inherent to the sequent calculus.