- Notes on module dependencies
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Module dependency information is now given in the GHC commentary
-The Name/Var/Type group is a bit complicated. Here's the deal
-Things in brackets are what the module *uses*.
-A 'loop' indicates a use from a module compiled later
-
- Name, PrimRep
-then
- PrelNames
-then
- Var (Name, loop IdInfo.IdInfo,
- loop Type.Type, loop Type.Kind)
-then
- VarEnv, VarSet, ThinAir
-then
- Class (loop TyCon.TyCon, loop Type.Type)
-then
- TyCon (loop Type.Type, loop Type.Kind, loop DataCon.DataCon, loop Generics.GenInfo)
-then
- Type (loop DataCon.DataCon, loop Subst.substTy)
-then
- FieldLabel( Type), TysPrim (Type), PprEnv (loop DataCon.DataCon, Type)
-then
- Unify, PprType (PprEnv)
-then
- Literal (TysPrim, PprType), DataCon (loop PprType)
-then
- TysWiredIn (DataCon.mkDataCon, loop MkId.mkDataConId, loop Generics.mkGenInfo)
-then
- TcType( lots of TysWiredIn stuff)
-then
- PprType( lots of TcType stuff )
-then
- PrimOp (PprType, TysWiredIn)
-then
- CoreSyn [does not import Id]
-then
- IdInfo (CoreSyn.Unfolding, CoreSyn.CoreRules)
-then
- Id (lots from IdInfo)
-then
- CoreFVs, PprCore
-then
- CoreUtils (PprCore.pprCoreExpr, CoreFVs.exprFreeVars,
- CoreSyn.isEvaldUnfolding CoreSyn.maybeUnfoldingTemplate)
-then
- CoreLint( CoreUtils )
- OccurAnal (CoreUtils.exprIsTrivial)
- CoreTidy (CoreUtils.exprArity )
-then
- CoreUnfold (OccurAnal.occurAnalyseGlobalExpr)
-then
- Subst (CoreUnfold.Unfolding, CoreFVs)
- Generics (CoreUnfold.mkTopUnfolding)
-then
- Rules (CoreUnfold.Unfolding, PprCore.pprTidyIdRules)
-then
- MkId (CoreUnfold.mkUnfolding, Subst, Rules.addRule)
-then
- PrelInfo (MkId)
- HscTypes( Rules.RuleBase )
-
----------------- END OF INFRASTRUCTURE --------------------
-
-then
- CoreTidy (HscTypes.PersistentCompilerState)
+ ghc/docs/comm/genesis/modules.html
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
+ <title>The GHC Commentary - The Marvellous Module Structure of GHC </title>
+ </head>
+
+ <body BGCOLOR="FFFFFF">
+ <h1>The GHC Commentary - The Marvellous Module Structure of GHC </h1>
+ <p>
+
+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 <tt>.hi-boot</tt> interface files.
+<p>
+This section of the commentary documents the subtlest part of
+the module dependency graph, namely the part near the bottom.
+<ul>
+<li> The list is given in compilation order: that is,
+module near the top are more primitive, and are compiled earlier.
+<li> Each module is listed together with its most critical
+dependencies in parentheses; that is, the dependencies that prevent it being
+compiled earlier.
+<li> Modules in the same bullet don't depend on each other.
+<li> Loops are documented by a dependency such as "<tt>loop Type.Type</tt>".
+This means tha the module imports <tt>Type.Type</tt>, but module <tt>Type</tt>
+has not yet been compiled, so the import comes from <tt>Type.hi-boot</tt>.
+</ul>
+
+Compilation order is as follows:
+<ul>
+<li>
+<strong>First comes a layer of modules that have few interdependencies,
+and which implement very basic data types</strong>:
+<tt> <ul>
+<li> Util
+<li> OccName
+<li> Pretty
+<li> Outputable
+<li> StringBuffer
+<li> ListSetOps
+<li> Maybes
+<li> etc
+</ul> </tt>
+
+<p>
+<li> <strong> Now comes the main subtle layer, involving types, classes, type constructors
+identifiers, expressions, rules, and their operations.</strong>
+
+<tt>
+<ul>
+<li> Name <br> PrimRep
+<p><li>
+ PrelNames
+<p><li>
+ Var (Name, loop IdInfo.IdInfo,
+ loop Type.Type, loop Type.Kind)
+<p><li>
+ VarEnv, VarSet, ThinAir
+<p><li>
+ Class (loop TyCon.TyCon, loop Type.Type)
+<p><li>
+ TyCon (loop Type.Type, loop Type.Kind, loop DataCon.DataCon, loop Generics.GenInfo)
+<p><li>
+ Type (loop DataCon.DataCon, loop Subst.substTy)
+<p><li>
+ FieldLabel( Type) <br>
+ TysPrim(Type) <br>
+ PprEnv (loop DataCon.DataCon, Type)
+<p><li>
+ Unify <br>
+ PprType (PprEnv)
+<p><li>
+ Literal (TysPrim, PprType) <br>
+ DataCon (loop PprType)
+<p><li>
+ TysWiredIn (DataCon.mkDataCon, loop MkId.mkDataConId, loop Generics.mkGenInfo)
+<p><li>
+ TcType( lots of TysWiredIn stuff)
+<p><li>
+ PprType( lots of TcType stuff )
+<p><li>
+ PrimOp (PprType, TysWiredIn)
+<p><li>
+ CoreSyn [does not import Id]
+<p><li>
+ IdInfo (CoreSyn.Unfolding, CoreSyn.CoreRules)
+<p><li>
+ Id (lots from IdInfo)
+<p><li>
+ CoreFVs <br>
+ PprCore
+<p><li>
+ CoreUtils (PprCore.pprCoreExpr, CoreFVs.exprFreeVars,
+ CoreSyn.isEvaldUnfolding CoreSyn.maybeUnfoldingTemplate)
+<p><li>
+ CoreLint( CoreUtils ) <br>
+ OccurAnal (CoreUtils.exprIsTrivial) <br>
+ CoreTidy (CoreUtils.exprArity ) <br>
+<p><li>
+ CoreUnfold (OccurAnal.occurAnalyseGlobalExpr)
+<p><li>
+ Subst (CoreUnfold.Unfolding, CoreFVs) <br>
+ Generics (CoreUnfold.mkTopUnfolding)
+<p><li>
+ Rules (CoreUnfold.Unfolding, PprCore.pprTidyIdRules)
+<p><li>
+ MkId (CoreUnfold.mkUnfolding, Subst, Rules.addRule)
+<p><li>
+ PrelInfo (MkId) <br>
+ HscTypes( Rules.RuleBase )
+</ul></tt>
+
+<p><li> <strong>That is the end of the infrastructure. Now we get the
+ main layer of mdoules that perform useful work.</strong>
+
+<tt><ul>
+<p><li>
+ CoreTidy (HscTypes.PersistentCompilerState)
+</ul></tt>
+</ul>
+
+
+
+
+
+ <p><small>
+<!-- hhmts start -->
+Last modified: Wed Aug 22 16:46:33 GMT Daylight Time 2001
+<!-- hhmts end -->
+ </small>
+ </body>
+</html>
+
+
+
+
+