#5420: writeFile should use openBinaryFile
---------------------------------+------------------------------------------
Reporter: Tinctorius | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.2.1 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
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.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5420>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs