Data.Dynamic: Any vs existential

Roman Cheplyaka roma at ro-che.info
Mon Mar 10 10:35:10 UTC 2014


Ok, one reason is that the TypeRep won't be cached in the Dynamic value.
Even in GHC 7.8 Typeable is defined as

  class Typeable a where
    typeRep# :: Proxy# a -> TypeRep

instead of

  class Typeable a where
    typeRep :: Tagged a TypeRep

Why? Is this an oversight?

* Roman Cheplyaka <roma at ro-che.info> [2014-03-10 12:11:27+0200]
> In Data.Dynamic, Dynamic is defined as
> 
>   data Dynamic = Dynamic TypeRep Any
> 
> Does this have any advantage over a safer
> 
>   data Dynamic = forall a. Typeable a => Dynamic a
>   
> ?
> 
> Roman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140310/9695fe02/attachment.sig>


More information about the Libraries mailing list