Time limit exceed in Haskell