In Haskell, I want to read a file and then write to it. Do I need strictness annotation?

后端 未结 4 1329
予麋鹿
予麋鹿 2021-02-07 09:14

Still quite new to Haskell..

I want to read the contents of a file, do something with it possibly involving IO (using putStrLn for now) and then write new contents to th

4条回答
  •  长发绾君心
    2021-02-07 09:46

    It's ugly but you can force the contents to be read by asking for the length of the input and seq'ing it with the next statement in your do-block. But really the solution is to use a strict version of hGetContents. I'm not sure what it's called.

提交回复
热议问题