I'm studying optimal implementations of the λ-calculus. There is a particular subset of lambda terms that is very efficient. It corresponds to the type system of Elementary Affine Logic with fixed points. In order to test my implementations of that algorithm, I have to write moderately complex terms on that system. This is difficult without a infrastructure. I have to use the untyped lambda calculus and then manually add the types; no checking, unification, no type errors.
One idea would be to write programs in Haskell - taking benefit from its mature type-checker - and then translate to EAL. Unfortunately, there is a mismatch between System-Fw and EAL. For example, you can't express Scott-encoded ADTs in Haskell without newtype
, due to the lack of a type-level fix
. Moreover, Haskell is a complex language, and writing a Haskell->EAl
compiler would not be trivial.
Is there any quick/dirty way to get a working type checker/inferencer/unifier for that system - or at least something close enough - without having to program it all myself?