Output language of typechecking pass?

Benjamin Redelings benjamin.redelings at gmail.com
Wed Oct 27 13:54:17 UTC 2021


Hi,

     I have been looking for info on what actually comes out of the 
type-checking pass in GHC.  This is mostly because it seems like the 
"Type classes in Haskell" paper implements both type checking and 
translation to dictionary-passing in one pass, whereas it seems like GHC 
separates this into (i) type checking and (ii) desugaring.

Questions:

1. It seems like this separation is actually necessary, in order to 
apply generalization only to let arguments written by the programmer, 
and not to let bindings introduced during desugaring. Is that right?

2. Does the output of type checking contain type lambdas?

3. Does the type checking pass determine where to add dictionary arguments?

4. Are there any other resources I should be looking at?

I am confused about #3, because the `-ddump-tc` output doesn't seem to 
show any type dictionaries in function bodies themselves, but it does 
seem to contain some kind of info about dictionaries as "evidence" -- 
but I am not sure what "evidence" is, or how it links into the AST for a 
function body.  I did briefly look at `-ddump-tc-ast`, but not in detail 
yet.

-BenRI



More information about the ghc-devs mailing list