Kate
The idea is that the Renamer sucks in any declarations from
interface files that might be needed to compile the module.
It may suck in more than turn out to be necessary, but it must
not suck in fewer.
The version of GHC you have is sucking in a lot more than it
needs for a blank module! But some things are hard to predict.
Notably, string literals give rise to uses of unpackCString# and a couple
of other similar functions; and the compiler itself introduces string
literals
(e.g. when compiling code for pattern-match failure). So the renamer sucks
those function signatures in regardless of what's in the module.
The details are unimportant: the key idea is that the renamer does its best
to be parsimonious, but doesn't always succeed. Later versions of GHC
do better. The head of the tree says only this for a blank module (without
-O):
unpackCString# :: Addr# -> [Char]
unpackFoldrCString# :: forall a. Addr# -> (Char -> a -> a) -> a -> a
unpackNBytes# :: Addr# -> Int# -> [Char]
The more optimisation you have (e.g. you add -O) the more
declarations get sucked in.
As Marcin noted, names in interface files are "z-encoded" so that
we don't need to worry about operators etc. GHC now prints out the
user-readable names (as above) by default. Adding -dppr-debug reverts
to the z-encoded form and adds lots of other info too, much as in the dump
you gave.
I hope this is useful to you. Let us know what you are trying to do and
we'll see if we can help.
Simon
| -----Original Message-----
| From: Kate S. Golder [mailto:[EMAIL PROTECTED]]
| Sent: 17 July 2000 21:39
| To: [EMAIL PROTECTED]
| Subject: GHC Renamer
|
|
| I have been playing around with parts of the GHC front end,
| particularly
| the Renamer, and am trying to understand the output dumped by
| this stage.
| As part of this process I created a file (Blank.hs), where the file
| contains only an empty module declaration:
|
| module Blank where
|
| when I run "ghc -ddump-rn Blank.hs" I get the output which
| appears at the
| end of this message.
|
| Are these declarations simply added to all files? If so,
| why, and what
| are they used for?
| In particular what are "PrelBase.zi" and "PrelBase.zaza"?
| Also, why are only the types of the functions given, and not their
| definitions?
|
| Thanks,
| Kate Golder
|
| ==================== Renamer: ====================
| module Blank where
| PrelBase.zi{-r7V,i-} ::
| forall b{-rNx-} :: PrelGHC.*{-312,l-} c{-rNy-} ::
| PrelGHC.*{-312,l-}
| a{-rNz-} :: PrelGHC.*{-312,l-}.
| (b{-rNx-} -> c{-rNy-})
| -> (a{-rNz-} -> b{-rNx-}) -> a{-rNz-} -> c{-rNy-}
....