hi, all, I'm having problem convert IO String to string, I read a file, and it's an IO String, what i need is a string, but couldn't figure out how to do the convertion. there are couple posts talked about this topic, but didn't work for me please help me out, thanks a lot Ron _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
Lu Mudong wrote:
hi, all, I'm having problem convert IO String to string,
That's because you can't convert IO String to String.
I read a file, and it's an IO String,
No. Calling readFile doesn't read the file, and the value which readFile returns isn't the result of reading the file. The value which readFile returns is an "action" which represents the act of reading a file as a String.
what i need is a string, but couldn't figure out how to do the convertion. there are couple posts talked about this topic, but didn't work for me
Read the section of the Haskell tutorial regarding I/O: http://www.haskell.org/tutorial/io.html I guarantee that you will not be able to figure out how I/O works in Haskell by guessing. You need to actually read a tutorial on the subject. -- Glynn Clements <glynn.clements@virgin.net>
participants (2)
-
Glynn Clements -
Lu Mudong