Hello,<div><br></div><div><div class="gmail_quote">On Mon, Feb 13, 2012 at 5:32 PM, Edward Kmett <span dir="ltr"><<a href="mailto:ekmett@gmail.com">ekmett@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div>There are fewer combinators from commonly used classes for working with the left argument of a bifunctor, however.</div></div></blockquote></div><br></div><div>I think that the bifunctor part of Bas's version is a bit of a red herring. What I like about it is that it overloads exactly what needs to be overloaded---the representation of the type---without the need for any fake parameters. To make things concrete, here is some code:</div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">> newtype TypeRepT t = TR TypeRep</font></div><div><font face="'courier new', monospace">> </font></div>
<div><font face="'courier new', monospace">> class Typeable t where</font></div><div><font face="'courier new', monospace">> typeRep :: TypeRepT t</font></div><div><font face="'courier new', monospace">></font></div>
<div><font face="'courier new', monospace">> instacne Typeable Int where typeRep = TR type_rep_for_int</font></div><div><font face="'courier new', monospace">> instance Typeable [] where typeRep = TR type_rep_for_list</font></div>
<br>The two formulations support exactly the same interface (you can define `Proxy` and the proxied `typeRep` in terms of this class) so I wouldn't say that the one is easier to use that the other, but I think that this formulation is slightly simpler because it avoids the dummy parameter to typeRep.<div>
<br></div><div>-Iavor<br><div><div><font face="'courier new', monospace"><br></font></div><div><br></div></div></div>