
9 Dec
2014
9 Dec
'14
3:21 p.m.
I've encountered unexplainable of "withFile" function. Consider "example.hs" program: import System.IO main = do cnts <- withFile "example.hs" ReadMode $ (\h -> do res <- hGetContents h --putStr res return res) putStr cnts When commented-out line is like that, program doesn't write out anything to the STDOUT. If "--" (commend characters) are removed, program writes out contents of "example.hs" two times. Is this expected behavior? I asked on #haskell (freenode) and one fellow there found it equally confusing... ------------------------------------------- GHC version: The Glorious Glasgow Haskell Compilation System, version 7.6.3 OS: Linux Thanks, Zoran PlesivĨak