Recursion challenges in Haskell