Problem 2 of 99 Haskell Problems solved.  With some nice refactoring!