title: Unresolved Instance Declaration
body: <p>I have two functions , one to get the squareRoot of a number which differs from the previous item by <code>&lt; 0.0001</code> , <strong>approx is fine</strong>.</p>
  
  <pre><code>squareRoot n = squareRoot' (approx n)
  
  squareRoot' ( n : n2 : ns ) | abs (n2 - n) &lt; 0.0001 = n2
                              | otherwise = squareRoot' ( n2 : ns )
  </code></pre>
  
  <p>And another which uses it to list the infinite list of primes</p>
  
  <pre><code>primes = [ n | n &lt;- [ 2 .. ], isPrime n ]
  
  isPrime 2 = True
  isPrime 3 = True
  
  isPrime n = isPrime' n (squareRoot n) primes
  
  isPrime' n squareRoot (h : t)   
     | h &lt; squareRoot &amp;&amp; mod n ( h :: Int ) /= 0 = False
     | otherwise = isPrime' n squareRoot t
  </code></pre>
  
  <p>I simple cannot see the instance declaration that I must make that results in </p>
  
  <pre><code>No instance for (Fractional Int) arising from a use of `squareRoot'
  Possible fix: add an instance declaration for (Fractional Int)
  In the second argument of isPrime', namely `(squareRoot n)'
  In the expression: isPrime' n (squareRoot n) primes
  In an equation for `isPrime':
      isPrime n = isPrime' n (squareRoot n) primes
  </code></pre>
  
  <p>Could someone help me out ? Thanks</p>