writeFile should use openBinaryFile
Apparently, I can't use writeFile
to write binary data to a file in Windows:
Prelude Codec.Binary.Base64.String Data.Char> readFile "foo.txt"
>>= return . decode . filter isAlphaNum >>= writeFile "foo.dat"
*** Exception: .../foo.dat: commitBuffer: invalid argument
(character is not in the code page)
This is clearly because openFile
opens the file with newline translation etc. (why would you ever want this by default? D:). writeFile
does not mention this behaviour in its documentation.
Trac metadata
Trac field | Value |
---|---|
Version | 7.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |