Solve #56 in Haskell.