[Haskell-cafe] How to read a file and return a String?

yi lu zhiwudazhanjiangshi at gmail.com
Wed Sep 4 16:21:37 CEST 2013


I want to read a text file, and store it in a *String*. But readFile will
get *IO String*. I search with google and they tell me it is not
necessarily to do so. Can you explain to me why is this? Furthermore, How
to read a file and store it in a String?

In fact, I want to read a file and split it into *[String]* with
*lines*function. Here is what I have tried.
link<https://github.com/eccstartup/findDict/blob/master/src/Data/Dict/Utils.hs>I
think I could directly operate on
*[String]*. But it is not true for me.


[1] http://www.haskell.org/hoogle/?hoogle=IO+String+-%3E+String


Yi Lu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130904/34c42979/attachment.htm>


More information about the Haskell-Cafe mailing list