parsing a file line by line

Anagha lilly_143 at rediffmail.com
Thu Oct 16 21:01:26 EDT 2003


An HTML attachment was scrubbed...
URL: http://porky.devel.redhat.com/pipermail/haskell-cafe/attachments/20031016/2ac42dfa/attachment.htm
-------------- next part --------------
Hi ,
I am a new bie to haskell.
I need to read a file and get it contents line by line and then eventually word by word. 

I have written the code to read a file , but the returned value is all the lines in the file.
How do I parse this whole text message ( contents of the file) into individual lines ( that is parsing / splitting the whole text to get me one line at a time. 
Also once I get the individual line, I o parse it word by word.
I have a start  on this thing. by using the line function in haskell, but I have not managed to write it successfully.
Can anyone help me in this.

Below is the code to read a file. 
fileFun :: IO ()

fileFun = do
          putStr "Please input a file name: "
          fname <- getLine
          contents <- readFile fname

How do I split the data returned in contents( Contents contains all the text in the file, which is given as input)

Thanks
Anagha







More information about the Haskell-Cafe mailing list