Prime factorization in Haskell