[Haskell-cafe] Array Binary IO & molecular simulation

Krzysztof Skrzętnicki gtener at gmail.com
Sat May 2 05:59:41 EDT 2009

On Sat, May 2, 2009 at 11:12, Jason Dusek <jason.dusek at gmail.com> wrote:
>  I believe Data.Binary includes a header with the data
>  it serializes. In consequence, the second and all following
>  arrays will be invisible.
[Apologies for Jason for sending this twice to him]

I didn't check the Binary instance for arrays, however I belive it's
not true. Consider Binary instances for tuples:

instance (Binary a, Binary b) => Binary (a,b) where
   put (a,b)           = put a >> put b
   get                 = liftM2 (,) get get

instance (Binary a, Binary b, Binary c) => Binary (a,b,c) where
   put (a,b,c)         = put a >> put b >> put c
   get                 = liftM3 (,,) get get get

If what you are saying would be true, the tuple instances would be
incorrect for array tuples.

Best regards

Christopher Skrzętnicki

More information about the Haskell-Cafe mailing list