
On Wed, 2009-02-25 at 17:15 +0000, Neil Mitchell wrote:
Hi,
I want to read a file using Data.Binary, and I want to read the file strictly - i.e. when I leave the read file I want to guarantee the handle is closed. The reason is that (possibly immediately after) I need to write to the file. The following is the magic I need to use - is it all necessary, is it guaranteed correct, should I use something else?
src <- decodeFile "_make/_make" Map.size mp `seq` performGC
I suggest you use withFile instead and decode from the Handle that gives you (via hGetContents) rather than decodeFile from the file name. That makes it much clearer. Of course you have to avoid doing lazy stuff, but that should be ok, Binary is strict in reading by default. Duncan