
Going through the instances for HTypeable (http://www.haskell.org/HaXml/HaXml/src/Text/XML/HaXml/TypeMapping.html#toHTy... ) I saw the following instance for Either a b. My question is, why doesn't the pattern match in the where clause always fail? If (Left x) = m does not fail, doesn't that imply that m is a Left x and therefore the (Right y) = m should fail? thanks, max instance (HTypeable a, HTypeable b) => HTypeable (Either a b) where toHType m = Defined "Either" [hx, hy] [ Constr "Left" [hx] [hx] {-Nothing-} , Constr "Right" [hy] [hy] {-Nothing-}] where (Left x) = m (Right y) = m hx = toHType x hy = toHType y