7
Praat
adlı bir veri tipine sahibim. Praat
'un Eq
örneğini olmasını istiyorum, böylece Praat
s eşit olduğunda ve yalnızca mx
eşitse. Bunu nasıl yapıyor?Nasıl yapılır: Örnek
-- 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) = ...........
Örneği nasıl tanımlamaya çalışıyorum ama çalışmıyor.
-- 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
Hatta 'mx' üzerinde '(==)' yazabilirim –