title: How to make a type an instance of Eq
body: <p>I have a data type called <code>Praat</code>. I want <code>Praat</code> to be an instance of <code>Eq</code> so that two <code>Praat</code>s are equal if and only if <code>mx</code> are equal.  How does one do this?</p>
  
  <pre><code>-- data type
  data Praat t = Praat [k] [(k,k,k,k)] 
  
  -- praat gives the maximum frequency
  Praat t -&gt; Int
  mx (Praat [] _) = 0
  mx (Praat (e:es) pt) = ...........
  </code></pre>
  
  <p>This is how I am trying to define the instance but it is not working.</p>
  
  <pre><code>-- 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)-&gt;Int
     (mx k) == (mx k) = True
     _ == _ = False
  </code></pre>