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

E.Y.Kow at brighton.ac.uk E.Y.Kow at brighton.ac.uk
Thu Jun 12 13:10:50 UTC 2008


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.
  

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-darcs-patch
Size: 4918 bytes
Desc: A darcs patch for your repository!
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20080612/b861f4d0/attachment.bin 


More information about the darcs-users mailing list