Type classes and code generation