I am a beginner with Haskell and I can't seem to understand what is wrong with my function. I keep getting a parse error and I don't understand what is wrong with my code.
isPrime :: Int -> Bool
isPrime x
| x <= 1 = False
| x `mod` y == 0 for y in [2, 3 .. floor x^0.5] = False
| otherwise = True
List comprehensions are different in Haskell than they are in Python. Instead of
expr for var in list, it's[expr | var <- list]. Also, you need anallto make it verify they're all true. Further,floor x^0.5will parse as(floor x)^0.5, which you don't want. Use parentheses to fix it. Finally, to raise something to a non-integer power, you need to use**instead of^, but this will introduce complexity you don't want, so just usesqrtinstead.