class Eq a where
(==), (/=) :: a -> a -> Bool
x /= y = not (x == y)
x == y = not (x /= y)
deriving instance Eq Bool
I assume it generates
instance Eq Bool where
True == True = True
False == False = True
But how do I create a instance from something like
newtype Sink p = Sink {unSink :: MVar (E.Iteratee (Message p) IO ())}
instance Eq (Sink p) where
?==? = True
Do I just use deriving and ghc will figure out itself?
deriving instance Eq (Sink p)
PS I have read this but it goes beyond my capabilities of understanding http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/deriving.html
newtype Sink p = Sink {unSink :: MVar (E.Iteratee (Message p) IO ())} deriving (Eq)
works because every socket has a different MVar - Gert Cuykens