In the pipeline of GHC there is a stage of translating Haskell source code to Core and then (not necessarily as an immediate next step) translating Core to STG. However, one issue escapes me from my understanding - when do we have a "normal" code (i.e. as plain text), and when something actually living in memory, like abstract syntax trees (ASTs)?
And to make my question a bit more precise, I'll divide it into parts:
1) in the parsing of Haskell source file phase, do we immediately construct ASTs of Core language? If not, then it seems to me that we have to construct ASTs of full Haskell (which seems strange) and then either transform them to ASTs of Core, or firstly to textual representation of them in Core and again invoking parsing to obtain Core's ASTs.
2) almost the same question applies to Core to STG transition (but in this case I think I can assume that what we have is Core's ASTs - correct?)