added solution to problem 3 (Haskell)