Changes between Version 20 and Version 21 of ModuleDependencies


Ignore:
Timestamp:
Apr 24, 2011 9:33:30 PM (4 years ago)
Author:
megacz
Comment:

move this page into the commentary

Legend:

Unmodified
Added
Removed
Modified
  • ModuleDependencies

    v20 v21  
     1[[redirect(wiki:Commentary/ModuleStructure)]] 
    12 
    2  
    3 = The Marvellous Module Structure of GHC = 
    4  
    5  * '''See also: [ModuleDependencies/Hierarchical Proposal for hierarchical module structure]''' 
    6  
    7 (possibly outdated, please fix anything that is wrong) 
    8  
    9 GHC is built out of about 245 Haskell modules. It can be quite tricky to figure out what the module dependency graph looks like. It can be important, too, because loops in the module dependency graph need to be broken carefully using .hi-boot interface files. 
    10  
    11 This section of the commentary documents the subtlest part of the module dependency graph, namely the part near the bottom. 
    12  
    13  * The list is given in compilation order: that is, module near the top are more primitive, and are compiled earlier. 
    14  * Each module is listed together with its most critical dependencies in parentheses; that is, the dependencies that prevent it being compiled earlier. 
    15  * Modules in the same bullet don't depend on each other. 
    16  * Loops are documented by a dependency such as "loop Type.Type". This means tha the module imports Type.Type, but module Type has not yet been compiled, so the import comes from Type.hi-boot.  
    17  
    18 == Compilation order is as follows: == 
    19  
    20  * First comes a layer of modules that have few interdependencies, and which implement very basic data types: 
    21    * Util 
    22    * !OccName 
    23    * Pretty 
    24    * Outputable 
    25    * !StringBuffer 
    26    * !ListSetOps 
    27    * Maybes 
    28    * etc  
    29  
    30  * Now comes the main subtle layer, involving types, classes, type constructors identifiers, expressions, rules, and their operations. 
    31    * Name, !PrimRep 
    32    * !PrelNames 
    33    * Var (Name, loop !IdInfo.!IdInfo, loop Type.Type, loop Type.Kind) 
    34    * !VarEnv, !VarSet, !ThinAir 
    35    * Class (loop !TyCon.!TyCon, loop Type.Type) 
    36    * !TyCon (loop Type.Type, loop !DataCon.!DataCon, loop Generics.!GenInfo) 
    37    * !TypeRep (loop !DataCon.!DataCon, loop Subst.substTyWith) 
    38    * Type (loop !PprType.pprType, loop Subst.substTyWith) 
    39    * !FieldLabel (Type), !TysPrim (Type) 
    40    * Literal (!TysPrim, !PprType), !DataCon (loop !PprType, loop Subst.substTyWith, !FieldLabel.!FieldLabel) 
    41    * !TysWiredIn (loop !MkId.mkDataConIds) 
    42    * !TcType ( lots of !TysWiredIn stuff) 
    43    * !PprType ( lots of !TcType stuff ) 
    44    * !PrimOp (!PprType, !TysWiredIn) 
    45    * !CoreSyn [does not import Id] 
    46    * !IdInfo (!CoreSyn.Unfolding, !CoreSyn.!CoreRules) 
    47    * Id (lots from !IdInfo) 
    48    * CoreFVs, !PprCore 
    49    * !CoreUtils (!PprCore.pprCoreExpr, CoreFVs.exprFreeVars, !CoreSyn.isEvaldUnfolding !CoreSyn.maybeUnfoldingTemplate) 
    50    * !CoreLint ( !CoreUtils ), !OccurAnal (!CoreUtils.exprIsTrivial), !CoreTidy (!CoreUtils.exprArity ) 
    51    * !CoreUnfold (!OccurAnal.occurAnalyseGlobalExpr) 
    52    * Subst (!CoreUnfold.Unfolding, CoreFVs), Generics (!CoreUnfold.mkTopUnfolding), Rules (!CoreUnfold.Unfolding, !PprCore.pprTidyIdRules) 
    53    * !MkId (!CoreUnfold.mkUnfolding, Subst, Rules.addRule) 
    54    * !PrelInfo (!MkId), !HscTypes ( Rules.!RuleBase )  
    55  
    56  * That is the end of the infrastructure. Now we get the main layer of mdoules that perform useful work. 
    57    * !CoreTidy (!HscTypes.!PersistentCompilerState)  
    58  
    59 == !HsSyn stuff == 
    60  * !HsPat.hs-boot 
    61  * !HsExpr.hs-boot (loop !HsPat.LPat) 
    62  * !HsTypes (loop !HsExpr.!HsSplice) 
    63  * !HsBinds (!HsTypes.LHsType, loop !HsPat.LPat, !HsExpr.pprFunBind and others) !HsLit (!HsTypes.!SyntaxName) 
    64  * !HsPat (!HsBinds, !HsLit) !HsDecls (!HsBinds) 
    65  * !HsExpr (!HsDecls, !HsPat)  
    66  
    67 == Library stuff: base package == 
    68  * GHC.Base 
    69  * Data.Tuple (GHC.Base), GHC.Ptr (GHC.Base) 
    70  * GHC.Enum (Data.Tuple) 
    71  * GHC.Show (GHC.Enum) 
    72  * GHC.Num (GHC.Show) 
    73  * GHC.ST (GHC.Num), GHC.Real (GHC.Num) 
    74  * GHC.Arr (GHC.ST) GHC.STRef (GHC.ST) 
    75  * GHC.!IOBase (GHC.Arr) 
    76  * Data.Bits (GHC.Real) 
    77  * Data.!HashTable (Data.Bits, Control.Monad) 
    78  * Data.Typeable (GHC.IOBase, Data.!HashTable) 
    79  * GHC.Weak (Data.Typeable, GHC.IOBase)  
    80  
    81 == High-level Dependency Graph == 
    82  
    83 Dark red edges indicate that only one module in one group depends on a module in the other group. Dark green means 11 or more dependencies. Arrows point from the importing module to the imported module. 
    84  
    85 [[Image(dep5.png)]] 
     3Moved [wiki:Commentary/ModuleStructure here].