Hi Simon, 2010/10/28 Simon Peyton-Jones <[email protected]>
> OK good. I got it built. Then I compiled > > data D = D > > with –XGenerics –ddump-deriv –dppr-debug > > The “-dppr-debug” flag makes the uniques show up. > > > > Then you can see that the two from0 occurrences have different uniques, > hence the error. > > > > The problem was that you’d assigned a unique to fromOName, namely > from0ClassOpKey, but you hadn’t added from0 to the list of > basicKnownKeyNames in PrelNames. > > > > Have a look here > http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/WiredIn > > > > In fact you don’t need to give a Key to from0. Instead, just use a > qualifed RdrName Generics.from0. You want an “Orig” RdrName (see > http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/RdrNameType). > You build one of those with varQual_RDR; there are lots of other examples in > PrelNames. > > > > I’ve made a patch and have pushed it, so you can just pull. > Great, it works now, thanks. > > > I have started a wiki page in the Commentary > http://hackage.haskell.org/trac/ghc/wiki/Commentary/Compiler/GenericDeriving > > > > Can you fill in brief details, summarising where the main code lives? > Details belong in the code itself; this overview is just to orient someone, > and to help us to work together. Eg you can record open problems, or to-do > lists. > Yes, I've started doing this. Can you tell me what is the best way to create new (empty) datatypes? We need those for the meta-information. Basically, a user-defined datatype data A a = A0 | A1 a (A a) > gives rise to compiler-generated datatypes data D_A > data C_A0 > data C_A1 > data S_A0_0 > data S_A1_0 > data S_A1_1 > that are used in the representation type for A Rep (A a) = D1 D_A ((C1 C_A0 (S1 S_A0_0 U1)) :+: (C1 C_A1 (S1 S_A1_0 (Par0 > a) :*: S1 S_A1_1 (Rec0 (A a))))) > and given instances of the meta-information classes instance Datatype D_A ... > instance Constructor C_A0 ... > instance Selector S_A0_0 ... > I don't think we can create new datatypes in TcDeriv; am I right? Where should this be done? (Also, I still have the assembler errors when there is more than one datatype. This is also documented on the commentary page.) Thanks, Pedro
_______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
