<div dir="ltr">It seems to be a fairly popular proposal. =)<div><br></div><div><a href="https://mail.haskell.org/pipermail/libraries/2014-August/023633.html">https://mail.haskell.org/pipermail/libraries/2014-August/023633.html</a><br></div><div><br></div><div>-Edward</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 28, 2015 at 6:03 PM, Roman Cheplyaka <span dir="ltr"><<a href="mailto:roma@ro-che.info" target="_blank">roma@ro-che.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I suggested this last year, see this thread<br>
<a href="https://mail.haskell.org/pipermail/libraries/2014-March/022287.html" rel="noreferrer" target="_blank">https://mail.haskell.org/pipermail/libraries/2014-March/022287.html</a><br>
<div class="HOEnZb"><div class="h5"><br>
On 09/29/2015 12:51 AM, David Feuer wrote:<br>
> Currently,<br>
><br>
> data Dynamic = Dynamic TypeRep Obj<br>
> deriving Typeable<br>
> where<br>
> type Obj = Any<br>
><br>
> As a result, all of the operations must be implemented "by hand" using<br>
> unsafeCoerce. The more obvious representation these days would seem to be<br>
><br>
> data Dynamic where<br>
> Dynamic :: Typeable a => a -> Dynamic<br>
><br>
> Most of the operations then become trivial applications of Typeable<br>
> functions. The only exceptions seem to be dynApply and dynApp. That<br>
> there are exceptions strikes me as quite unfortunate. The easiest fix is<br>
> inspired by the fact that Data.Dynamic uses<br>
><br>
> funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep<br>
><br>
> from Data.Typeable to decide whether to coerce. It seems reasonable to<br>
> add a more informative version, something like<br>
><br>
> applyTypeable :: (Typeable f, Typeable a) =><br>
> proxy f -><br>
> proxy a -><br>
> (forall b . (Typeable b, f ~ (a -> b)) => r) -><br>
> Maybe r<br>
><br>
> On the other hand, it would be really cool if there were some more<br>
> general way to get type-level information out of Typeable instances,<br>
> pattern matching on the type constructors.<br>
<br>
<br>
</div></div><br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
<br></blockquote></div><br></div>