summaryrefslogtreecommitdiff
path: root/src/Data/Binary.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Binary.hs')
-rw-r--r--src/Data/Binary.hs10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/Data/Binary.hs b/src/Data/Binary.hs
index 86353e143..1b287a099 100644
--- a/src/Data/Binary.hs
+++ b/src/Data/Binary.hs
@@ -264,18 +264,10 @@ encodeFile f v = L.writeFile f (encode v)
--
-- > return . decode . decompress =<< B.readFile f
--
--- After contructing the data from the input file, 'decodeFile' checks
--- if the file is empty, and in doing so will force the associated file
--- handle closed, if it is indeed empty. If the file is not empty,
--- it is up to the decoding instance to consume the rest of the data,
--- or otherwise finalise the resource.
---
decodeFile :: Binary a => FilePath -> IO a
decodeFile f = bracket (openBinaryFile f ReadMode) hClose $ \h -> do
s <- L.hGetContents h
- evaluate $ runGet (do v <- get
- m <- isEmpty
- m `seq` return v) s
+ evaluate $ runGet get s
-- needs bytestring 0.9.1.x to work