Did homework 6 from the uva haskell lectures