getting Core Haskell from GHC API with cross-module inlinings

Tim Chevalier catamorphism at gmail.com
Mon Jun 21 22:01:16 EDT 2010


On 6/21/10, Roman Beslik <beroal at ukr.net> wrote:
>  I'm trying to:
>  - get source code on different stages of processing in GHC;

Probably not hard to do by giving different combinations of compiler
flags -- you could do this with either the API or External Core.

>  - dig to the GHC function which is responsible for some alteration in a
> source code.

That would be harder. It would require modifying GHC quite a bit, but
I could imagine getting there by using Core's "Note" construct and
then getting the results as External Core.

>  It is hard to trace a link between source code appearing as values in GHC
> functions and what "-ddump-simpl" outputs. And I guess that "-ddump-simpl"

Indeed, I think that including enough information in an External Core
file, or internal Core module, to map any value back to the original
Haskell expression would be a research project in and of itself. Part
of that project would involve specifying exactly what "the original
Haskell expression" means -- for example, in the presence of
aggressive inlining...

Cheers,
Tim

-- 
Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt
"In a land of quince jelly, apple butter, apricot jam, blueberry
preserves, pear conserves, and lemon marmalade, you always get grape
jelly."  -- William Least Heat-Moon


More information about the Glasgow-haskell-users mailing list