1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
<!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>
|