<div>I&#39;m a big fan of this!</div><div><br></div>There aren&#39;t any covariant occurrences of <font face="courier new, monospace">Proxy</font> in the <font face="courier new, monospace">Typeable</font> use-case. So it really doesn&#39;t need an explicit <font face="courier new, monospace">Proxy</font> type at all.<div>
<br></div><div>Both the <font face="courier new, monospace">tagged</font> and <font face="courier new, monospace">reflection</font> packages go out of their way to make all contravariant uses agnostic about the proxy type. This rather dramatically cuts down on the amount of ScopedTypeVariable noise I need to use in my code, because I can often just pass a container holding values of the correct type directly as my &quot;Proxy&quot; when I have one.</div>
<div><br></div><div>-Edward<br><br><div class="gmail_quote">On Sat, Jan 26, 2013 at 3:27 AM, Roman Cheplyaka <span dir="ltr">&lt;<a href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Very nice idea! Thanks for bringing it up.<br>
<br>
The only case I can see when this &quot;proxyless&quot; approach wouldn&#39;t work is<br>
if Proxy ever has to be in a covariant position (e.g. returned by a<br>
function). Then you&#39;d need either a concrete proxy or an existential<br>
wrapper.<br>
<br>
If there are no such functions in the new Data.Typeable (which is very<br>
plausible), then I&#39;d prefer not to include Proxy into base, given that<br>
it&#39;s already provided by an alternative package.<br>
<br>
Roman<br>
<br>
* Shachaf Ben-Kiki &lt;<a href="mailto:shachaf@gmail.com">shachaf@gmail.com</a>&gt; [2013-01-25 20:07:10-0800]<br>
<div class="HOEnZb"><div class="h5">&gt; I see that the new-typeable branch in GHC is using &quot;typeRep :: forall a.<br>
&gt; Typeable a =&gt; Proxy a -&gt; TypeRep&quot; rather than &quot;typeOf :: forall a. Typeable a<br>
&gt; =&gt; a -&gt; TypeRep&quot;. This is clearly a big improvement over using undefined<br>
&gt; everywhere.<br>
&gt;<br>
&gt; I&#39;d like to suggest a small change, if it hasn&#39;t been brought up before --<br>
&gt; &quot;typeRep :: forall proxy a. Typeable a =&gt; proxy a -&gt; TypeRep&quot;. This makes<br>
&gt; typeRep compatible with any other Proxy type, since it doesn&#39;t use any<br>
&gt; properties of the concrete type -- it just uses it to pass information about<br>
&gt; the &quot;a&quot;. Things that consume a Proxy don&#39;t ever need to refer to Proxy<br>
&gt; explicitly.<br>
&gt;<br>
&gt; This would make Typeable compatible with other Proxy libraries, like the one in<br>
&gt; &quot;tagged&quot;. It would also make it compatible with any other type of kind * -&gt; *<br>
&gt; -- for example, &quot;typeRep ([] :: [Int])&quot; would be a valid, and arguable more<br>
&gt; convenient, syntax for using typeRep. &quot;Nothing :: Maybe Int&quot; and so on would<br>
&gt; work too. So things that produce a &quot;proxy&quot; don&#39;t need to refer to Proxy<br>
&gt; explicitly either.<br>
&gt;<br>
&gt; Possibly this would make the Proxy type entirely unnecessary. If it stays,<br>
&gt; though, I suggest that it belongs in a module other than Data.Typeable.Internal<br>
&gt; -- it&#39;s a useful type for many other things, and as long as it&#39;s in base and<br>
&gt; exposed to users, it might as well be treated as a type in its own right. It&#39;s<br>
&gt; also a monad, can provide a variant of `asTypeOf`, and so on.<br>
&gt;<br>
&gt;     Shachaf<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Libraries mailing list<br>
&gt; <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
<br>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>