Where do I put the *definition* of a DFunId?

ÉRDI Gergő gergo at erdi.hu
Fri Feb 11 10:41:04 UTC 2022


On Fri, 11 Feb 2022, Simon Peyton Jones wrote:

> A `ModDetails` gives the type signatures for everything, but no actual code.  For
> example if you have `f :: Int -> Int` in the `md_types`, the `ModDetails` doesn't
> include the binding `f = rhs` for `f`.

Yes, this on its own makes sense.

> Presumably you must also be generating these bindings (in a `ModGuts` perhaps?) and
> generating code for them that will ultimately be linked into the program to run.

I am not generating a `ModGuts`. My intention is to use these instances 
from "normal" (hand-written) source input to GHC. GHC should use the 
`DFunUnfolding`s during specialization to get rid of overloaded code, 
after which I should have inlined-due-to-specialization versions of my 
definitions.

> Well, put the `DFunId` binding in the same place, alongside `f`.

For the sake of argument, suppose that I did make a `ModGuts`. In that 
case, what kind of internal state would be updated based on the contents 
of that `ModGuts` such that references to my `DFunId` would work?


More information about the ghc-devs mailing list