overriding default Eq definition for specific pattern

Viewed 293

Suppose I have defined some data type that derives Eq but want to insert my own definition of (==) for some pattern. Is there any way to do this or do I have to define (==) for every pattern?

e.g.

data Asdf = One Char | Two Char Char --(deriving Eq)
instance Eq Asdf where
  (==) (One _) (One _) = True
  --otherwise use what the derived definition would have done
  --can I do this without defining these patterns myself?
2 Answers
Related