[Haskell-cafe] Implementation of "Dynamic" datatype
Lennart Augustsson
lennart at augustsson.net
Sat Mar 3 04:18:00 EST 2007
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.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list