generate well-typed code