I'm trying to read from a file in Haskell, and i'm having trouble handling the data afterwards.
Basically, what i want to do is, read the file, and then create a matrix based on the data that was read. But it is a bit trickier than this. I'll explain:
Here's an example input file:
6 - number of lines in the matrix
7 - number of columns in the matrix
PA 3123
PB 11254
PC 790
PD 86214
PE 114125
PF 36214
and the rest is the data itself.
Now, since in this example,the number of columns is seven, the matrix must be created the following way:
Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7
3123/1 3123/2 3123/3 3123/4 3123/5 3123/6 3123/7
... ... ... ... ... ... ...
and the same for the others.
I've search the site for answers, and i've read some parts of the book Learn You a Haskell for Great Good!, and i was able to come up with this code:
-- Imports needed
import System.IO
import Data.List
import Data.Text
-- Runs the program
main = do
putStrLn "Please insert the name of the file you want to process:"
file <- getLine
read_File file
-- Reads all file content
read_File file = do
h <- openFile file ReadMode
content <- hGetContents h
hClose h
handleFile content
-- Handles the content of the file
handleFile content = do
n1 <- getLine
n2 <- getLine
-- here comes my big problem, how can i create the matrix properly?
putStrLn n1
putStrLn n2
This code compiles just fine, but there is an issue. I've put two putStrLn at the end, to verify that the file was properly read, but when i run it, i get no errors, but no data at all.
Thanks in advance!
PS: Here's the compilation process!

test.hs:22:20: parse error on input ‘=’when doingrunhaskell test.hsread_FileandhandleFilefunctions is incorrect; you need to indent the body of yourdoconstructs. Haskell questions, particularly, need to be properly formatted as many questions are about incorrect parses caused by improper formatting.