Wired-in type class
Joachim Breitner
mail at joachim-breitner.de
Fri Aug 16 21:54:28 CEST 2013
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 at joachim-breitner.de • http://www.joachim-breitner.de/
Jabber: nomeata at joachim-breitner.de • GPG-Key: 0x4743206C
Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130816/00822a39/attachment.pgp>
More information about the ghc-devs
mailing list