[Haskell-beginners] System.IO.withFile

Rafael Gustavo da Cunha Pereira Pinto RafaelGCPP.Linux at gmail.com
Mon Jan 19 20:30:30 EST 2009


Hi folks,



I am trying to use the withFile function of System.IO, but it always return
an empty string when testing.

Could someone explain why:

main= do
              h<-openFile "test.cir" ReadMode
              c<-hGetContents h
              print c

> runhaskell test1.hs
> "* Teste\n\nR1  1 0 10\nC1  1 0 10uF\nI1  1 0 1mA\n\n.DC \n.PRINT\n"

works and


main= (withFile "test.cir" ReadMode hGetContents) >>= print

> runhaskell test1.hs
> ""

don't?


Thanks!
-- 
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090119/86c36b61/attachment.htm


More information about the Beginners mailing list