lazy-io

What caused this “delayed read on closed handle” error?

 ̄綄美尐妖づ 提交于 2019-12-07 01:41:02
问题 I just installed GHC from the latest sources, and now my program gives me an error message about a "delayed read on closed handle". What does this mean? 回答1: The fundamental lazy I/O primitive, hGetContents , produces a String lazily—it only reads from the handle as needed to produce the parts of the string your program actually demands. Once the handle has been closed, however, it is no longer possible to read from the handle, and if you try to inspect a part of the string that was not yet

What caused this “delayed read on closed handle” error?

家住魔仙堡 提交于 2019-12-05 05:09:42
I just installed GHC from the latest sources, and now my program gives me an error message about a "delayed read on closed handle". What does this mean? dfeuer The fundamental lazy I/O primitive, hGetContents , produces a String lazily—it only reads from the handle as needed to produce the parts of the string your program actually demands. Once the handle has been closed, however, it is no longer possible to read from the handle, and if you try to inspect a part of the string that was not yet read, you will get this exception. For example, suppose you write main = do most <- withFile "myfile"