Haskell IO and closing files

后端 未结 6 1986
走了就别回头了
走了就别回头了 2021-01-30 21:21

When I open a file for reading in Haskell, I\'ve found that I can\'t use the contents of the file after closing it. For example, this program will print the contents of a file:<

6条回答
  •  悲哀的现实
    2021-01-30 21:46

    If you want to keep your IO lazy, but to do it safely so that errors such as this don't occur, use a package designed for this such as safe-lazy-io. (However, safe-lazy-io doesn't support bytestring I/O.)

提交回复
热议问题