
One reason for favoring the Proxy# a style over the Tagged style is almost
any manipulation of the Tagged variant requires ScopedTypeVariables and a
very awkward programming style, while a 0-width proxy can be passed around
like an explicit type application.
Otherwise they are largely equivalent if you're careful about how the low
level definitions work.
As the original author of both, I'm not personally wedded to either the
Tagged or the Proxy style, but I find in practice the Proxy version leads
to much prettier code that is easier to follow.
-Edward
On Mon, Mar 10, 2014 at 6:35 AM, Roman Cheplyaka
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
[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
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries