Hi, Am Mittwoch, den 09.10.2013, 15:21 -0400 schrieb Richard Eisenberg: > Wait! I have an idea! > The way I've been describing GND all along has been an abbreviation. > GHC does not coerce a dictionary from, say, Ord Int to Ord Age. > Instead, GHC mints a fresh dictionary for Ord Age where all the > methods are implemented as coerced versions of the methods for Ord > Int. (I'm not sure why it's implemented this way, which is why I've > elided this detail in just about every conversation on the topic.) > With this in mind, I have a proposal: > > > 1) All parameters of all classes have nominal role. > 2) Classes also store one extra bit per parameter, saying whether all > uses of that parameter are representational. Essentially, this bit > says whether that parameter is suitable for GND. (Currently, we could > just store for the last parameter, but we can imagine extensions to > the GND mechanism for other parameters.) > > > Because GND is implemented using coercions on each piece instead of > wholesale, the nominal roles on classes won't get in the way of proper > use of GND. An experiment (see below for details) also confirms that > even superclasses work well with this idea -- the superclasses aren't > coerced.
what do you need the extra bit for? During GHD, can’t you just create the new dictionary (using "method = coerce original_method) and then see if it typechecks, i.e. if the method types can be coerced. (If not, the error messages might need massaging, though.) Greetings, Joachim -- Joachim “nomeata” Breitner m...@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nome...@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nome...@debian.org
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users