[Haskell-cafe] Implementation of "Dynamic" datatype

Simon Peyton-Jones simonpj at microsoft.com
Fri Mar 9 15:20:59 EST 2007


| 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.

But the dictionary would presumably contain a cached version, since the result is independent of the argument.  So I doubt this is a big issue in practice.

Simon


More information about the Haskell-Cafe mailing list