Implementing a haskell function for checking if a given number is prime.