question about GHC API on GHC plugin
Mike Izbicki
mike at izbicki.me
Mon Aug 24 21:42:47 UTC 2015
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 <omeragacan at gmail.com> 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...
More information about the ghc-devs
mailing list