Inhabiting Habit: An Introduction to the Habit Compiler
With a name that combines parts of "Ha"skell and "bit"s, Habit is a new functional programming language that is specifically designed for use in the construction of bare-metal systems software such as microkernels and device drivers. As such, Habit embraces key features of Haskell---from basic syntax to an extended type class mechanism with support for functional dependencies and instance chains---but also adds mechanisms for describing bit-level representations and low-level memory layout.
In this talk, I will give an overview of the structure and implementation of the Habit compiler prototype, combining a front-end that is written in Haskell with a backend that reuses significant parts of the CompCert verified compiler for C that is written in Coq. In the process, I will also describe some of the more unusual aspects of the implementation, such as: the design of several intermediate languages; the use of an independent constraint solver in support of type inference; and a specialization phase that eliminates the need for a dictionary passing implementation of type classes and allows the use of type-specific, custom value representations.