I am currently working with some large Trie structures in Haskell that I build from a binary file. The process takes some time, and I was curious if there is a general-case approach to fast-ish (de)serialization of recursive data structures. For large files and large Tries, using the Show and Read classes is (much) slower than building the tries from scratch. Perhaps I'm doing it wrong.
The Trie is shaped like this:
type Trie e a = T e [Trie e a]
What are some good approaches to serializing a recursive structure like this? Also, what are some good approaches to this problem in general?
The link for deriving an instance of binary
in the documentation is broken as stated in the comments of the question. But the file exists just at a new slightly different URL: http://darcs.haskell.org/packages/binary/tools/derive/BinaryDerive.hs
I haven't used it yet, but I think this does what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With