I have a data type called Praat. I want Praat to be an instance of Eq so that two Praats are equal if and only if mx are equal. How does one do this?
-- data type
data Praat t = Praat [k] [(k,k,k,k)]
-- praat gives the maximum frequency
Praat t -> Int
mx (Praat [] _) = 0
mx (Praat (e:es) pt) = ...........
This is how I am trying to define the instance but it is not working.
-- I want to make Praat instance of Eq so that two Praat are equal
-- when their respective `mx` are equal
instance Eq Praat where
mx :: (Praat k)->Int
(mx k) == (mx k) = True
_ == _ = False
This is pretty much a direct translation of what you said.
xis equal toywhenmx x == mx y.