Codegen: create match functions for each type