n = 5m = 3 readMatr :: IO [[Int]]readMatr = sequence . replicate n $ fmap (map read . take m . words) getLine main = readMatr >>= print
1 2 3 2 3 4 1 2 4 5 3 5 4 6 4
[[1,2,3],[2,3,4],[1,2,4],[5,3,5],[4,6,4]]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!