Matrix/Haskell: refacter main method to read more fluidly