[Haskell-cafe] two problems with Data.Binary and Data.ByteString

Don Stewart dons at galois.com
Wed Aug 13 00:43:15 EDT 2008

> >I'm starting to wonder if this isn't an issue with
> >Data.ByteString.Lazy.Char8.{read,write}File.
> This simple test case fails:
>   module Main where
>   import qualified Data.ByteString.Lazy.Char8 as B
>   main = do
>       print =<< B.readFile "xxx"
>       B.writeFile "xxx" =<< B.readFile "test.hs"
> If you replace B.readFile with readFile and B.writeFile with writeFile
> it works properly.  ByteString bug?

Ah, that would be a bug in older ByteString implementations, that were a
bit incautious about closing handles. This example works for me with 


You're looking for a post-Dec 19, 2007 release, after the patch,

  Wed Dec 19 22:06:13 PST 2007  Don Stewart
    * For lazy IO operations, be sure to hClose the resource on EOF

-- Don

More information about the Haskell-Cafe mailing list