Fix pattern matching on records when local instances are used
Generate functions instead of lambdas for increased performance. Also
don't generate type signatures for attrs