[darcs-users] darcs patch: Resolve issue913: Use Data.Bytestring for IO, not Data...

David Roundy droundy at darcs.net
Thu Jun 12 16:39:49 UTC 2008


Applied.  Thanks!

David

On Thu, Jun 12, 2008 at 01:10:50PM +0000, E.Y.Kow at brighton.ac.uk wrote:
> Just as Ian called it...
> 
> Thu Jun 12 13:57:19 BST 2008  Eric Kow <E.Y.Kow at brighton.ac.uk>
>   * Resolve issue913: Use Data.Bytestring for IO, not Data.Bytestring.Char8
>   
>   This solution comes from Ian Lynagh, who points out that the
>   difference between the two is:
>   
>   Data.Bytestring.Char8
>   ---------------------
>   writeFile :: FilePath -> ByteString -> IO ()
>   writeFile f txt = bracket (openFile f WriteMode) hClose
>      (\h -> hPut h txt)
>   
>   Data.Bytestring
>   ---------------
>   writeFile :: FilePath -> ByteString -> IO ()
>   writeFile f txt = bracket (openBinaryFile f WriteMode) hClose
>      (\h -> hPut h txt)
>   
>   We want this change because, as the System.IO docs say:
>   
>     On Windows, reading a file in text mode (which is the default) will
>     translate CRLF to LF, and writing will translate LF to CRLF. This is
>     usually what you want with text files. With binary files this is
>     undesirable; also, as usual under Microsoft operating systems, text
>     mode treats control-Z as EOF. Binary mode turns off all special
>     treatment of end-of-line and end-of-file characters.


More information about the darcs-users mailing list