
28 Apr
2006
28 Apr
'06
11:59 a.m.
Hi, I have a program which needs to cache intermediate data structures to a file (finite, non-cyclic, relatively simple, around ~100Kb when shown). Is there any easy way to acheive this? The current approach I am using is to add deriving Read, Show to all the data structures, and then writeFile "output.txt" (show x) read =<< readFile "output.txt" The problem is that this is too slow, and itsn't lazy. Is there any way to do better than this? I can imagine something like showBinary/readBinary which did this using binary files directly, but is there anything that does this? I'd like it to work with GHC and Hugs at least, and the less extra code I have to write the better :) Thanks Neil