Solve #58 in Haskell.