Fast serialization in haskell