Pattern matching equality on tuples in Haskell
问题 For this function on symmetric equality over tuples, symEq :: Eq a => (a,a) -> (a,a) -> Bool symEq (x,y) (u,v) = (x,y) == (u,v) || (x,y) == (v,u) would like to rewrite it using pattern matching as follows, symEq' :: Eq a => (a,a) -> (a,a) -> Bool symEq' (x,y) (x,y) = True symEq' (x,y) (y,x) = True symEq' _ _ = False The latter fails with error on conflicting definitions for x and y . How to rewrite symEq and take benefit of pattern matching ? 回答1: Unlike in some languages (I hear Erlang works