Add a type pattern matching routine