[Haskell-beginners] IO String and String using readFile

Yugesh Kothari kothariyugesh at gmail.com
Wed Mar 27 03:35:14 UTC 2019


Hi,

I am trying to read data from a file.
When I do-
ghci> contents <- readFile "file.txt"
ghci> words contents

Then everything works.

The same thing when done in a .hs file gives an IO String vs [String] error.

Why is that so?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20190327/5d7c81cf/attachment.html>


More information about the Beginners mailing list