use unsafePerformIO (that's this year's April fools' joke :-). Do a Google on "Monads Haskell" and you will find plenty of answers; in short you should "bind" the result of readFile using (>>=) : IO a -> (a -> IO b) -> IO b. Erik ----- Original Message ----- From: <MikeKn22@aol.com> To: <haskell@haskell.org> Sent: Monday, April 02, 2001 5:57 PM Subject: Hello List Have an IO String question
I am new to the list and to Haskell, and would appreciate any help anyone can give me on a problem I am having. I am using Hugs98 in case that matters. My question involved reading from a file. I used the line: readFile "c:/myfile.txt"
To read my file and this works fine. I now want to take the contents of the file and use it in a function that takes in a String, but am getting an error since readFile returns an IO String. Is there a way to convert an IO String to a normal String? Thank you all.
Rob
_______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell