On Fri, Mar 09, 2007 at 03:40:07PM +0000, Simon Peyton-Jones wrote:
> Yes, Dynamic preceded the Typeable class, I think.  Were we to do it today, I 
> think we'd have
> 
> | data Dynamic = forall a . (Typeable a) => Dynamic a
> 
> Whether it's worth changing, I'm not sure.  It's a library so, if a change 
> desirable, anyone could take a lead.

I think

data Dynamic where
        Dynamic :: a -> TypeRep -> Dynamic

would be better, as it would cache the TypeRep for fast equality, while
the 'Typeable' version would perhaps have to go through a dictionary
lookup to get at it.

        John


-- 
John Meacham - ⑆repetae.net⑆john⑈
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to