[Haskell-cafe] unresolved overloading
credine at gmail.com
Thu Jul 12 09:48:04 EDT 2007
I have written this code in Haskell which gives an unresolved
g x =  ++ [3,5..truncate(sqrt x)]
p n = fp n (g n)
fp n [ ] = True
fp n (x:xs) = if (mod n x) == 0 then False else fp n xs
when I submit g 103
[2,3,5,7,9] :: [Integer]
when I submit: fp 103 (g 103)
True :: Bool
But when I submit : p 103
ERROR - Unresolved overloading
*** Type : (RealFrac a, Floating a, Integral a) => Bool
*** Expression : p 103
I know why, there is no type that is at the same time: RealFrac, Floating
and Integral; but I don´t know how to solve.
What kind of type casting or type definition can I use to fix the error?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe