[Haskell-cafe] Windows: openFile gives permission deniedwhenfilein use

Donn Cave donn at avvanta.com
Thu Dec 29 19:28:46 CET 2011


Quoth Antoine Latter <aslatter at gmail.com>,
...
> Would this program then loop:
>
> append fromFilePath toFilePath = do
>   str <- readFile fromFile
>   writeFile toFile str
>
> if 'from' and 'to' where the same file?
>
> Currently the locking prevents this.

Do you mean, locking makes that work, or just makes it fail in a
different way?  Anyway, I think that's an example that would have
the same issues without hGetContents - that is, any way you set
out to overwrite a file by modifying its contents, you have the
same problem.

	Donn



More information about the Haskell-Cafe mailing list