Solve #8 in Haskell.