title: Could not deduce (Eq a) from (Num a) or from (Floating a). But Can deduce (Eq a) from (Integral a). Why?
body: <p>I'm going through a haskell tutorial (Learn you a haskell for great good) and I was playing around with this code I wrote based of off one of the functions in the book.</p>
  
  <pre><code>reverseNum :: (Num a) =&gt; a -&gt; a
  reverseNum 123 = 321
  reverseNum x = 0
  </code></pre>
  
  <p>and ghci tells me that it can't deduce (Eq a) from (Num a).</p>
  
  <p>So I change the first line to this</p>
  
  <pre><code>reverseNum :: (Integral a) =&gt; a -&gt; a
  </code></pre>
  
  <p>and it worked. This was strange because I thought to be a part of the Num typeclass you needed to also be apart of Eq. </p>
  
  <p>I tried one more thing to satisfy me curiosity and changed the first 2 lines to this</p>
  
  <pre><code>reverseNum :: (Floating a) =&gt; a -&gt; a
  reverseNum 1.0 = 0.1
  </code></pre>
  
  <p>and it gave me the same error.</p>
  
  <p>I know that you can fix this by doing something like <code>reverseNum :: (Num a, Eq a) ...</code> but I want to know why Integral is the only one where Eq can be deduced.
  Why is that?</p>
  
  <p>P.S. I am really new to haskell so... be gentle :)</p>