Solve #57 in Haskell.