[Haskell-cafe] how to get a string from file

Pradeep Wickramanayake pradeep at talk.lk
Wed Mar 3 13:26:30 EST 2010


 

getItemFile :: IO String

getItemFile test = 

                                do

                                                test <- readFile "input.txt"

                                                return test

 

this is the program I did to take a file and get all the data from that file
to a string. 

 

Can someone help me. 

 

I get this error

 

Type error in explicitly typed binding

*** Term           : getItemFile

*** Type           : a -> IO [Char]

*** Does not match : IO String

 

What I need is to get the file to a string and then get it to a tuple by
checking each places where the file contain a blank space

 

Please help me 

 

Thanks

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100303/6bcba6a3/attachment.html


More information about the Haskell-Cafe mailing list