[Haskell-beginners] Haskell Serialization

Stephen Tetley stephen.tetley at gmail.com
Mon May 10 17:49:45 EDT 2010

Hi Ashish

Daniel has largely answered this for me (thanks Daniel!).

If you define Binary instances for your data types to match a protocol
- then as Daniel says you can only use them for that protocol.
Similarly the all the regular Haskell types - Int, Word8, Float, etc.
- have Binary instances ready-made which you may not want when dealing
with anything non-Haskell [*]: numbers are always big-endian, the
encodings for Integers, Floats and the like are sparsely documented
and may well handle signs differently to an equivalent C / Java / ...

[*] Personally I'd go as far as saying, as saying you should avoid
them entirely except for writing other instances of the Binary class.

Best wishes


More information about the Beginners mailing list