
Hi, thanks for your pointers, they are very helpful. The problem is that one way of implementing NT involves a class declaration (not just instances) that I cannot write in Haskell. I tried to completely generate the the class in GHC.Prim, without corresponding source, but that failed (e.g. that module has mi_decl = []; I took that as a sign that I’m not on the right track). So I am back at generating a TypeCon in GHC.Prim which (to Haskell abstractly) contains the non-Haskell-fields and then have a simple class with one member of that type. Semantically all the same, and easier implementation. Am Freitag, den 16.08.2013, 10:25 -0700 schrieb Iavor Diatchki:
The exact shape of the evidence depends on the class method, but `makeDict` in the same function may give you an idea of what to do in your particular case. If the evidence needs to be more complex (i.e., you need to generate an implementation in Core, Simon showed me another trick involving rules, which is a bit of a hack, but does seem to work, so I could show you what I did there too, so just ask).
In my case, I’d like to generate instances when the users asks for it via derving clauses; but there as well I have the issue that deriving stuff happens before desugaring, but the implementation will have to be in Core. So I’m very much interested in the trick. Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org