I'm not positive, but I believe each dictionary has a field for its superclass dictionary. So if you have a dictionary for `Floating Float`, one of the fields will be the `Num Float` dictionary.
How to get the projector function for the field... I'm not sure. But perhaps you can find it by type? On Mon, Aug 24, 2015 at 2:42 PM, Mike Izbicki <[email protected]> wrote: > Thanks! Now one more question :) > > The code Andrew Farmer showed me for getting dictionaries works great > when I have a concrete type (e.g. Float) I want a dictionary for. But > now I'm working on polymorphic code and running into a problem. > > Lets say I'm running the plugin on a function with signature `Floating > a => a -> a`, then the plugin has access to the `Floating` dictionary > for the type. But if I want to add two numbers together, I need the > `Num` dictionary. I know I should have access to `Num` since it's a > superclass of `Floating`. How can I get access to these superclass > dictionaries? > > On Sat, Aug 22, 2015 at 7:35 AM, Ömer Sinan Ağacan <[email protected]> > wrote: >>> I have a new question: I'm working on supporting literals now. I'm having >>> trouble creating something that looks like `(App (Var F#) (Lit 1.0))` >>> because >>> I don't know how to create a variable that corresponds to the `F#` >>> constructor. The mkWiredInName function looks promising, but overly >>> complicated. Is this the correct function? If so, what do I pass in for >>> the >>> Module, Unique, TyThing, and BuiltInSyntax parameters? >> >> mkConApp intDataCon [mkIntLit dynFlags PUT_YOUR_INTEGER HERE] >> mkConApp floatDataCon [mkFloatLit dynFlags PUT_YOUR_FLOAT_HERE] >> >> Similarly for other literals... > _______________________________________________ > ghc-devs mailing list > [email protected] > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs _______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
