Haskell prime test
I'm new to Haskell, and I'm trying a bit: isPrime :: Integer->Bool isPrime x = ([] == [y | y<-[2..floor (sqrt x)], mod x y == 0]) I have a few questions. Why when I try to load the .hs, WinHugs say: Instances of (Floating Integer, RealFrac Integer) required for definition of isPrime ? When the interpreter finds one element in the right set, it immediately stops or it computes all the set? I think you know what I mean. Sorry about my english. 1) The problem is that sqrt has the type (Floating a) => a -> a , but you try to use an Integer as argument. So you have to convert your Integer first to