It would be interesting to see when you HAVE to use dynamics, e.g. when no other solution is possible in Haskell...<div><br></div><div>Right now if I use it, it feels that I'm doing so because I'm too new to Haskell.</div>
<div><br></div><div><div><div><br><div class="gmail_quote">On Thu, Feb 12, 2009 at 7:53 PM, Lennart Augustsson <span dir="ltr"><<a href="mailto:lennart@augustsson.net">lennart@augustsson.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
You're quite right. You should only be allowed to derive Typeable.<br>
(Which could be arranged by hiding the methods of typeable.)<br>
<div><div></div><div class="Wj3C7c"><br>
On Thu, Feb 12, 2009 at 6:24 PM, Jonathan Cast<br>
<<a href="mailto:jonathanccast@fastmail.fm">jonathanccast@fastmail.fm</a>> wrote:<br>
> On Thu, 2009-02-12 at 19:04 +0100, Lennart Augustsson wrote:<br>
>> They are not unsafe in the way unsafePerformIO is,<br>
><br>
> I beg permission to demur:<br>
><br>
> newtype Unsafe alpha = Unsafe { unUnsafe :: alpha }<br>
> instance Typeable (Unsafe alpha) where<br>
> typeOf _ = typeOf ()<br>
><br>
> pseudoSafeCoerce :: alpha -> Maybe beta<br>
> pseudoSafeCoerce = fmap unUnsafe . cast . Unsafe<br>
><br>
> Note that<br>
><br>
> pseudoSafeCoerce = Just . unsafeCoerce<br>
><br>
>> but I regard them<br>
>> as a last resort in certain situations.<br>
>> Still, in those situations they are very useful.<br>
><br>
> But I would agree with both of these. As long as you *derive* Typeable.<br>
><br>
> jcc<br>
><br>
><br>
</div></div><div><div></div><div class="Wj3C7c">> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div></div></div>