Changes to Typeable

Iavor Diatchki iavor.diatchki at
Sun Feb 12 04:21:22 CET 2012


I like Bas's variation on the design (except, perhaps, for the name
"Tagged" ;)  It captures exactly what we are trying to do: the
dictionary for Typeable becomes simply the run-time representation of
the type.  Coincidentally, this is exactly the same as what I am using
to link value level numbers/strings to type-level numbers/symbols, on
the type-nats branch of GHC.  I wonder if it might make sense to unify
the two designs?

PS: I wouldn't worry too much about breaking existing code, as long as
derived Typeable instances continue to work---I never provide custom
ones and, in fact, I think that GHC should no allow them or, at least,
give a stern warning when it sees one.

On Fri, Feb 10, 2012 at 4:35 PM, Bas van Dijk <v.dijk.bas at> wrote:
> Or don't use an argument at all:
> class Typeable t where
>  typeRep :: Tagged t TypeRep
> newtype Tagged s b = Tagged { unTagged :: b }

More information about the Glasgow-haskell-users mailing list