Partway through porting the big file, Codegen.hs