Solve #243 in Haskell.