--- /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>
+ TypeRep (loop DataCon.DataCon, loop Subst.substTyWith)
+<p><li>
+ Type (loop PprType.pprType, loop Subst.substTyWith)
+<p><li>
+ FieldLabel(Type) <br>
+ TysPrim(Type) <br>
+<p><li>
+ Literal (TysPrim, PprType) <br>
+ DataCon (loop PprType, loop Subst.substTyWith, FieldLabel.FieldLabel)
+<p><li>
+ TysWiredIn (loop MkId.mkDataConIds)
+<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) <br>
+ 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>
+
+HsSyn stuff
+<ul>
+<li> HsPat.hs-boot
+<li> HsExpr.hs-boot (loop HsPat.LPat)
+<li> HsTypes (loop HsExpr.HsSplice)
+<li> HsBinds (HsTypes.LHsType, loop HsPat.LPat, HsExpr.pprFunBind and others)
+ HsLit (HsTypes.SyntaxName)
+<li> HsPat (HsBinds, HsLit)
+ HsDecls (HsBinds)
+<li> HsExpr (HsDecls, HsPat)
+</ul>
+
+
+
+<h2>Library stuff: base package</h2>
+
+<ul>
+<li> GHC.Base
+<li> Data.Tuple (GHC.Base), GHC.Ptr (GHC.Base)
+<li> GHC.Enum (Data.Tuple)
+<li> GHC.Show (GHC.Enum)
+<li> GHC.Num (GHC.Show)
+<li> GHC.ST (GHC.Num), GHC.Real (GHC.Num)
+<li> GHC.Arr (GHC.ST) GHC.STRef (GHC.ST)
+<li> GHC.IOBase (GHC.Arr)
+<li> Data.Bits (GHC.Real)
+<li> Data.HashTable (Data.Bits, Control.Monad)
+<li> Data.Typeable (GHC.IOBase, Data.HashTable)
+<li> GHC.Weak (Data.Typeable, GHC.IOBase)
+</ul>
+
+
+ <p><small>
+<!-- hhmts start -->
+Last modified: Wed Aug 22 16:46:33 GMT Daylight Time 2001
+<!-- hhmts end -->
+ </small>
+ </body>
+</html>
+
+
+
+
+