On Mon, Feb 13, 2012 at 3:27 PM, Simon Marlow <span dir="ltr">&lt;<a href="mailto:marlowsd@gmail.com">marlowsd@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">
<div class="im">On 13/02/12 18:16, Edward Kmett wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
You could probably get away with something like<br>
<br>
data Proxy = Proxy a<br>
<br>
class Typeable a where<br>
   typeOfProxy :: Proxy a -&gt; TypeRep<br>
<br>
typeOf :: forall a. Typeable a =&gt; a -&gt; TypeRep<br>
typeOf = typeOfProxy (Proxy :: Proxy a)<br>
<br>
which being outside of the class won&#39;t contribute to the inference of<br>
&#39;a&#39;s kind.<br>
<br>
This would let you retain the existing functionality.<br>
</blockquote>
<br></div>
Simon&#39;s version has this:<div class="im"><br>
typeOf :: forall a. Typeable a =&gt; a -&gt; TypeRep<br></div>
typeOf x = typeRep (getType x) where<br>
  getType :: a -&gt; Proxy a<br>
  getType _ = Proxy<br>
<br>
(your version is clearer, though)<br>
<br>
I&#39;m assuming there&#39;s no significance behind your renaming of &#39;typeRep&#39; to &#39;typeOfProxy&#39;?<br></blockquote><div><br></div><div>No significance at all. I probably should have read the page before commenting. ;)</div>
<div><br></div><div>-Edward</div></div>