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

后端 未结 4 1219
予麋鹿
予麋鹿 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:29

    I think the easiest way to solve this problem is useing strict IO:

    import qualified System.IO.Strict as S
    main = do
        file <- S.readFile "filename"
        writeFile "filename" file
    

提交回复
热议问题