title: Haskell: Couldn't expected type 'Integer' with actual type 'Int'
body: <p>I've been staring at this code for quite some time now and I can't get my head around that error message.</p>
  
  <pre><code>divisors :: Integer -&gt; [Integer]
  divisors n = [t | t &lt;- [1..n], mod n t == 0]
  
  length' :: [a] -&gt; Integer
  length' []      = 0
  length' (x:xs)  = 1 + length' xs
  
  divLengths :: [(Integer, Integer)]
  divLengths = [(n, length' (divisors n)) | n &lt;- [1..]]
  
  divLengths' :: [Integer]
  divLengths' = [length' (divisors n) | n &lt;- [1..]]
  
  hcn :: [Integer]
  hcn = [n | n &lt;- [1..], max (take n divLengths') == length' (divisors n)]
  </code></pre>
  
  <p>"divisors" takes an Integer and returns a list with all its divisors.</p>
  
  <p>"length'" is the same as the built-in "length", only it returns an Integer.</p>
  
  <p>"divLengths" is an infinite list of tuples of a Integer and the number of its divisors.</p>
  
  <p>"divLengths'" only returns the number of divisors of the numbers.</p>
  
  <p>"hcn" is supposed to be an infinite list of highly composite numbers (if the number of divisors is the same as the maximum of all numbers of divisors of all numbers (up to the number being checked)).</p>
  
  <p>However, i get this error when trying to load the .hs in ghci:</p>
  
  <pre><code>Couldn't match expected type `Integer' with actual type `Int'
  In the first argument of `divisors', namely `n'
  In the first argument of length', namely `(divisors n)'
  In the second argument of `(==)', namely `length' (divisors n)'
  </code></pre>
  
  <p>Can you please help me out here?</p>
  
  <p>Best regards,
  Lukas</p>