Fixed problem with operator precedence, separated type generalization from pattern matching, a bit messy at the moment