<div dir="ltr"><div class="gmail_extra">On Mon, Mar 10, 2014 at 6:35 AM, Roman Cheplyaka <span dir="ltr"><<a href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>></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">Ok, one reason is that the TypeRep won't be cached in the Dynamic value.<br>
Even in GHC 7.8 Typeable is defined as<br>
<br>
  class Typeable a where<br>
    typeRep# :: Proxy# a -> TypeRep<br>
<br>
instead of<br>
<br>
  class Typeable a where<br>
    typeRep :: Tagged a TypeRep<br>
<br>
Why? Is this an oversight?<br></blockquote><div><br><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">I talked with Ed about this, and he noted that this might be a false problem. Certainly, the Proxy# is never actually used, so as long as the generated instances are of the form:<br>
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">    typeRep# = let tr = ... in \_ -> tr<br><br>the TypeReps are shared, and are at most a bit of indirection away. Also, how different are (Tagged tr :: Tagged a TypeRep) and ((\_ -> tr) :: Proxy# a -> TypeRep) at a low level? I know the constructor of the former disappears in core, but don't know what specifically happens with 0-width fields like Proxy#. Is the latter slightly less efficient? If so, can the optimizer eliminate the difference for cases like this?<br>
<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">-- Dan<br></div></div></div></div></div>