It seems like a reasonable and not-too-painful solution, thanks!<br><br>Concerning Haskell typesystem, I know it to be beautiful, but also kind of complex. One of the great Haskell assets is genericity, but this complexity sometimes encumbers this genericity.<br>
But still, Haskell is -- in terms of flexibility -- way before other languages which pretend to be generic.<br><br><br><div class="gmail_quote">2010/4/18 Sebastian Fischer <span dir="ltr">&lt;<a href="mailto:sebf@informatik.uni-kiel.de">sebf@informatik.uni-kiel.de</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
On Apr 18, 2010, at 11:01 AM, Limestraėl wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It&#39;s strange I can&#39;t declare a generic instance for Binary types... I thought I was trying to do something quite common in Haskell.<br>
</blockquote>
<br></div>
A common workaround is to define a newtype like this<br>
<br>
    newtype GenericBinary a = GB { fromGB :: a }<br>
<br>
and an instance like this<br>
<br>
    instance Binary a =&gt; Binarizable (GenericBinary a) a where<br>
      toBinary = fromGB<br>
<br>
which only needs FlexibleInstances enabled.<br>
<br>
You can then &#39;tag&#39; Binary types for which you want to use the generic default instance above with the GB newtype constructor. Whether this is less of a pain than implementing a Binarizable instance for each Binary type is a different question..<br>

<br>
Sebastian<br><font color="#888888">
<br>
-- <br>
Underestimating the novelty of the future is a time-honored tradition.<br>
(D.G.)<br>
<br>
<br>
<br>
</font></blockquote></div><br>