GHC core representation

Josef Svenningsson josefs@cs.chalmers.se
Wed, 20 Jun 2001 16:01:07 +0200 (MET DST)


[This is a reply to Andrew Tolmachs message to the Haskell list about the
-fext-core flag]

Hi!

Some comments on the -fext-core facility. First I just want to say that
it's a really cool feature. It made me a lot keener to use GHC for program
analysis measurements.

First a question which is not really specific to the -fext-core flag
(which I expect someone of the GHC-people to answer):

* I would like to make GHC generate only the core file and the hi file,
nothing more. However, I haven't found a way of making GHC stop after
outputting the hi file. Being able to do this is useful in some other
cases as well;  I sometimes look at the raw core that comes is printed
with the -ddump* flags. It is often the case that I don't want anything to
be generated then.


OK, here are the comments about the new feature:

* In the grammar:
the productions for the nonterminal Arguments seems to be erronious.
When used as they are they cause tons of shift/reduce conflicts. Having
the following solves to problem (I think this is what you really meant):

Argument arg -> @ aty
             |  aexp

* Speaking of arguments, it would be a nice thing if one could get the
output in A-normal-form. This is done by GHC anyway when converting to STG
and in some cases it would be really useful.

* Exactly when in the compilation process does ghc spit out this info
(when I use -fext-core that is)?  What I am really asking is: which
transformations is applied to the core before it is printed? Knowing this
is pretty important. Being able to control it would be super, and from the
documentation this seems to be a goal.

* A minor point:
The example in the beginning of section 3.6 seems to be incorrect. It
should read:

f :: %forall a . a -> BinTree (BinTree a) =
  \ @a (x::a) -> Leaf @(BinTree a) (Leaf @a x)
                                   ŻŻŻŻŻŻŻŻŻŻŻ

OK, I think that's all for now. I'll probarbly come up with some more
questions in a while.

Cheers,

	/Josef