[Haskell-cafe] Is using Data.Dynamic considered a no-go?

Peter Verswyvelen bugfact at gmail.com
Thu Feb 12 14:55:35 EST 2009


It would be interesting to see when you HAVE to use dynamics, e.g. when no
other solution is possible in Haskell...
Right now if I use it, it feels that I'm doing so because I'm too new to
Haskell.


On Thu, Feb 12, 2009 at 7:53 PM, Lennart Augustsson
<lennart at augustsson.net>wrote:

> You're quite right.  You should only be allowed to derive Typeable.
> (Which could be arranged by hiding the methods of typeable.)
>
> On Thu, Feb 12, 2009 at 6:24 PM, Jonathan Cast
> <jonathanccast at fastmail.fm> wrote:
> > On Thu, 2009-02-12 at 19:04 +0100, Lennart Augustsson wrote:
> >> They are not unsafe in the way unsafePerformIO is,
> >
> > I beg permission to demur:
> >
> >  newtype Unsafe alpha = Unsafe { unUnsafe :: alpha }
> >  instance Typeable (Unsafe alpha) where
> >    typeOf _ = typeOf ()
> >
> >  pseudoSafeCoerce :: alpha -> Maybe beta
> >  pseudoSafeCoerce = fmap unUnsafe . cast . Unsafe
> >
> > Note that
> >
> >  pseudoSafeCoerce = Just . unsafeCoerce
> >
> >> but I regard them
> >> as a last resort in certain situations.
> >> Still, in those situations they are very useful.
> >
> > But I would agree with both of these.  As long as you *derive* Typeable.
> >
> > jcc
> >
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > Haskell-Cafe at haskell.org
> > http://www.haskell.org/mailman/listinfo/haskell-cafe
> >
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090212/feefc285/attachment.htm


More information about the Haskell-Cafe mailing list