Program Generation with Class

We have implemented a program generation library for polymorphically typed functional languages with lazy evaluation. The library combinators perform program generation by partial evaluation, a technique which allows the generation of highly-customized and efficient specialized output programs from general, parameterized input programs. Previously implemented program generation libraries for polymorphically typed languages have either required dynamic typing or been in the context of specially designed program generation languages. In contrast, our library has been implemented in Gofer, a widely available functional language. Moreover, we exploit multi-parameter constructor classes which are part of Gofer’s type system to construct program generators that are binding-time polymorphic. An appropriate polymorphic binding-time analysis can provide the necessary type annotations to specify these properties. However, we designed and implemented a minor extension of Gofer’s type reconstruction mechanism that can automatically infer binding times.