하스켈에서 다음과 같은 에러를 만날 경우에

withFile: resource busy (file is locked)

readFile 대신 readFile'을 써보셔요!

  • readFile은 lazy 버전이고
  • readFile'은 strict 버전입니다!

System.IO 모듈 문서에 다음과 같은 설명이 있습니다.

경고: readFile 연산은 파일의 전체 내용을 모두 소비할 때까지 그 파일에 대해 부분적으로 닫힌(semi-closed) 핸들을 유지한다. 따라서 이전에 readFile로 연 파일에 대해(writeFile 등을 사용하여) 쓰기를 시도하면, 일반적으로 isAlreadyInUseError 오류와 함께 실패하게 된다.

3

If you have a fediverse account, you can quote this note from your own instance. Search https://hackers.pub/ap/notes/019a7b35-6deb-7f65-b4f8-c32d1a464e77 on your instance and quote it. (Note that quoting is not supported in Mastodon.)