pattern matching by value and single type