Thanks for the reference. Sounds like a neat idea so I&#39;ll definitely check it out!<div><br></div><div>Right now, there are lots of complications in designing this library, at least if I want a nice API. I have lots and lots of type definitions to encode the various constructs of the protocol I&#39;m working with. New versions could make arbitrary changes: add or remove a field to a record, change the type of a record field, add or remove one of several possible cases (which I encode with sum types), and so on. It&#39;s not at all clear to me yet how I should factor my type definitions, and/or use other features such as polymorphic types, type classes, etc. But I guess this is a different thread.<br>

<br><div class="gmail_quote">On Wed, May 12, 2010 at 4:35 PM, Stephen Blackheath [to Haskell-Beginners] <span dir="ltr">&lt;<a href="mailto:mutilating.cauliflowers.stephen@blacksapphire.com">mutilating.cauliflowers.stephen@blacksapphire.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Ashish,<br>
<br>
I&#39;ve been using XML picklers for serialization, which you might want to<br>
consider if you can handle a little extra CPU/data cost.  I&#39;m the author<br>
of hexpat-pickle, so this is a plug for my package.  I lifted the idea<br>
wholesale from the HXT package.<br>
<br>
Handling changes in protocol version is really easy.  I&#39;ve been doing a<br>
lot of<br>
<br>
xpSomething = new `xpTryCatch` old<br>
  where<br>
     new = ...<br>
     old = ...<br>
<br>
If the new encoding fails to parse, it tries the old one, and on<br>
transmission it uses the new one.  I find it very quick and convenient<br>
to bang out a new pickler now that I&#39;m familiar with it.  You write your<br>
pickler and your unpickler with the same code - it works well.<br>
<br>
I am also working on hexpat-iteratee which is a lot more socket friendly<br>
since it doesn&#39;t use Haskell&#39;s lazy I/O.  The learning curve increases a<br>
little bit with doing it that way, though.<br>
<br>
<br>
Steve<br>
<div class="im"><br>
On 13/05/10 05:15, Ashish Agarwal wrote:<br>
&gt; Thanks for all the advice. It seems I should avoid making my types<br>
&gt; instances of Binary. In fact, this relates to another design issue I&#39;ve<br>
&gt; been grappling with, supporting multiple versions of the protocol.<br>
&gt; Probably I&#39;ll need something like, putProtVersion1, putProtVersion2,<br>
&gt; etc. Or something along this line.<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>