Changes to Typeable

Andres Löh andres at well-typed.com
Thu Oct 4 11:29:48 CEST 2012


> So back to the Plan A vs Plan B discussion.

I'm sorry, I don't completely understand why Plan A is an
"optimization". As far as I know, the typechecker doesn't merely have
the task of answering the question "does Typeable X" hold, but rather
it has to come up with evidence that "Typeable X" holds. I fail to see
how even the knowledge that every concrete datatype is in principle
Typeable makes it any easier to come up with the type representation
that's required during run-time.

For example, if you consider

data AnyTypeable = forall a. (Typeable a) => AnyTypeable a

and you unpack and use such a value in a function, then clearly the
only place to get the type representation from is the constructor
itself, and similarly,

data Any = forall a. Any a

should really not have any type representation available at runtime at all.

Similarly, for less extreme cases, we'd still need dictionary
transformers and plug together type representations from different
components. So why can we get rid of the instance table? What am I
missing?

Cheers,
  Andres

-- 
Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com



More information about the Libraries mailing list