
On Sat, Mar 03, 2007 at 09:18:00AM +0000, Lennart Augustsson wrote:
Why would there be an extra function?
The type data Dynamic = forall a . Dynamic TypeRep a is simply a pair. And so is data Dynamic = forall a . (Typeable a) => Dynamic a I think the latter is the most natural representation for Dynamic.
-- Lennart
On Mar 2, 2007, at 23:55 , Stefan O'Rear wrote:
the current type:
data Dynamic = Dynamic TypeRep Obj
the new type, if lucky:
data Dynamic = Dynamic !(a -> TypeRep) a
if unlucky:
data TypeableD a = TypeableD (a -> TypeRep) data Dynamic = Dynamic (TypeableD a) a
either way, the typeclass approach gives a lot more boxing.
Because the compiler can't statically prove that the typeRep field of the dictionary doesn't depend on its argument. Therefore, the function cannot be unpacked. (Or can it? Could hbc?) Stefan