finished Q1-10 in Haskell