Solved 7, 8, 9 and 10 in Haskell