Complete haskell solution to 2