A compiler for the gradually typed lambda calculus