The actual complete error message received, hints us the fix to this problem.
Prelude> let listRestDiv n = floor(n/(fromInteger (nextPrimeDiv n)))
<interactive>:8:21:
Could not deduce (RealFrac Integer) arising from a use of `floor'
from the context (Integral b)
bound by the inferred type of
listRestDiv :: Integral b => Integer -> b
at <interactive>:8:5-59
Possible fix: add an instance declaration for (RealFrac Integer)
In the expression: floor (n / (fromInteger (nextPrimeDiv n)))
In an equation for `listRestDiv':
listRestDiv n = floor (n / (fromInteger (nextPrimeDiv n)))
<interactive>:8:28:
Could not deduce (Fractional Integer) arising from a use of `/'
from the context (Integral b)
bound by the inferred type of
listRestDiv :: Integral b => Integer -> b
at <interactive>:8:5-59
Possible fix: add an instance declaration for (Fractional Integer)
In the first argument of `floor', namely
`(n / (fromInteger (nextPrimeDiv n)))'
In the expression: floor (n / (fromInteger (nextPrimeDiv n)))
In an equation for `listRestDiv':
listRestDiv n = floor (n / (fromInteger (nextPrimeDiv n)))
The important thing to be noted here is
Possible fix: add an instance declaration for (Fractional Integer)
In the first argument of `floor', namely
`(n / (fromInteger (nextPrimeDiv n)))'
So, all you have to do is, use fromInteger
for n
also, like this
Prelude> let listRestDiv n = floor(fromInteger n/(fromInteger (nextPrimeDiv n)))
ScopedTypeVariables
will help a lot sometimes. – dfeuer