I'm trying to learn how various aspects of GHC, like type inference, pattern matching, and other code transformations, are implemented.
However the codebase is fairly large and the file names use a lot of acronyms (simpl, stg, stranal...). What do these mean, and how is the code organized?
Open a command window and navigate to the directory where you want to keep your Haskell source files. Run Haskell by typing ghci or ghci MyFile. hs. (The "i" in "GHCi" stands for "interactive", as opposed to compiling and producing an executable file.)
If you have installed the Haskell Platform, open a terminal and type ghci (the name of the executable of the GHC interpreter) at the command prompt. Alternatively, if you are on Windows, you may choose WinGHCi in the Start menu. And you are presented with a prompt. The Haskell system now attentively awaits your input.
As hammar says, the GHC commentary is probably the best place to start for learning about GHC itself. This does assume some prior knowledge of compilers in general, but if your primary interest is in modifying GHC you can probably get by with just a basic CS background.
If you're interested more generally in the principles behind GHC, e.g. if you want to learn how to write your own compiler, you'd probably be better served by perusing Simon Peyton-Jones' myriad publications on relevant topics, including an entire book on implementing functional languages and a "tutorial" book that goes through the implementation of a non-strict functional language.
The GHC commentary is a good place to start.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With