Do problem 1 in Haskell.