[Haskell-cafe] Re: Mining Twitter data in Haskell and Clojure

Antoine Latter aslatter at gmail.com
Mon Jun 28 22:51:47 EDT 2010


On Mon, Jun 28, 2010 at 2:32 PM, Don Stewart <dons at galois.com> wrote:
> claus.reinke:
>>
>> To binary package users/authors: is there a typed version of binary (that
>> is, one that records and checks a representation of the serialized type
>> before actual (de-)serialization)? It
>> would be nice to have such a type check, even though it
>> wouldn't protect against missing bytes or strictness changes.
>>
>
> There is a wrapper, that wraps all encodes in a typeOf (iirC), I think
> by Edward Kmett, but I couldn't find e.g. binary-typed on Hackage.
>

In Happstack.Data there's a wrapper type called Object which we
serialize through which has a type-rep field and a ByteString field,
and the deserialize instance function checks that the type-string
filed matches "show (typeOf result)":

http://hackage.haskell.org/packages/archive/happstack-data/0.5.0.2/doc/html/Happstack-Data-Serialize.html#t%3AObject

A similar technique might be approrpiate for 'binary' or 'cereal'.

Antoine


More information about the Haskell-Cafe mailing list