The C++ template system is expressive enough to allow the programmer to write programs which are evaluated at compile time. This can be exploited for example in generic programming.
However, these programs are very often hard to write, read and maintain. We introduce a simple translation from lambda calculus to C++ templates and show how it can be used to simplify C++ metaprograms.
This variation of lambda calculus is then extended with Hindley-Milner type system and various other features (Haskell-like syntax, user-defined data types, tools for interaction with existing C++ template code) to create a simple functional language. We then build a compiler capable of transforming programs written in this language into C++ template metaprograms.