On Sun, Jan 24, 2010 at 5:49 AM, Neil Mitchell <span dir="ltr">&lt;<a href="mailto:ndmitchell@gmail.com">ndmitchell@gmail.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
The problem with Data for Text isn&#39;t that we have to write a new<br>
instance, but that you could argue that proper handling of Text with<br>
Data would not be using a type class, but have special knowledge baked<br>
in to Data. That&#39;s far worse than the Serialise problem mentioned<br>
above, and no one other than the Data authors could solve it. Of<br>
course, I don&#39;t believe that, but it is a possible interpretation.<br></blockquote><div><br></div><div>Right.. that is the problem with Text. Do you think the correct thing to do for gunfold and toConstr is to convert the Text to a String and then call the gufold and toConstr for String? Or something else? </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
The Serialise problem is a serious one. I can&#39;t think of any good<br>
solutions, but I recommend you give knowledge of your serialise class<br>
to Derive (<a href="http://community.haskell.org/~ndm/derive/" target="_blank">http://community.haskell.org/~ndm/derive/</a>) and then at<br>
least the instances can be auto-generated. Writing lots of boilerplate<br>
and regularly ripping it up is annoying, setting up something to<br>
generate it for you reduces the pain.</blockquote><div><br></div><div>We currently use template haskell to generate the Serialize instances in most cases (though some data types have more optimized encodings that were written by hand). However, you must supply the Version and Migration instances by hand (they are super classes of Serialize).</div>
<div><br></div><div>I am all for splitting the Serialize stuff out of happstack .. it is not really happstack specific. Though I suspect pulling it out is not entirely trivial either. I think the existing code depends on syb-with-class.</div>
<div><br></div><div>- jeremy</div></div>