Primality predicate in Haskell
All in all, that is some good looking, idiomatic Haskell. Well done!



You seem to be using the mod n x == 0 idiom quite often, so let's extract that to its own function.

divides :: Integral a =&gt; a -&gt; a -&gt; Bool
n `divides` m = m `mod` n == 0




You could also make your predicate polymorphic. No need to restrict yourself to Int, any Integral will do the trick.

isPrime :: Integral a =&gt; a -&gt; Bool
isPrime 2 = True
-- and so on




I've often read that rem is faster than mod, but I've never checked... maybe it does give you some speed.



Through clever reordering of the guards, you can get rid of the if then else.



Instead of having a simple comment to explain the function, consider writing actual Haddock documentation.


Putting it together:

-- | @divides n m@ checks whether @n@ evenly
--   divides @m@, meaning that @m `mod` n == 0@.
divides :: Integral a =&gt; a -&gt; a -&gt; Bool
n `divides` m = m `rem` n == 0


-- | Checks whether a given number is prime.
isPrime :: Integral a =&gt; a -&gt; Bool    
isPrime 2 = True
isPrime 3 = True
isPrime n 
    | 2 `divides` n = False
    | 3 `divides` n = False 
    | otherwise     = check 5 2 
  where check i w 
      | i * i &gt; n     = True
      | i `divides` n = False
      | otherwise     = check (i + w) (6 - w)


Maybe check 5 2 deserves a comment, as I couldn't see why these numbers are there on a first glance.