|Version 12 (modified by guest, 10 years ago) (diff)|
Notes From a Beginning GHC Hacker
General notes (some just for Windows)
- The Building Guide is very good, read the appropriate parts.
- Optimize your set up for build speed. Having to wait 10 minutes to compile because you added an export to a critical module is no fun.
- Use MSYS, not cygwin. MSYS is much faster.
- Do not use -O to compile GHC while you are making heavy changes. Once things compile smoothly and you want to test it, compile with optimization (on my machine, adding -O triples the compile time for a fresh 'make').
- If you do a 'make tags' then you can go right to the definition of a function (from any module) using alt-. in emacs.
- If you need to add or delete modules, use 'make boot' to fix up the dependencies.
Notes on the type system (and its interactions)
The compiler is, of course, found in the fptools/compiler directory. Important subdirectories for hacking on the type system include:
- basicTypes (Name, Var, OccName)
- prelude (PrelNames, TysWiredIn)
- iface (IfaceType, BinIface)
- parser (ParserCore)
The critical parts dealing with types are in the 'types' and 'typecheck' directories:
- The representation of types, the Type datatype, is defined here and exported concretely
- A few crucial type constructors (like ->) are defined here in order to avoid excessive module loops
- The representation of type constructors, TyCon, is defined here and exported abstractly
- Construction and manipulation functions for type constructors are here
- Contains the bulk of the type system, imports the concrete representation from TypeRep, and re-exports Type abstractly