href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/basicTypes/"><code>fptools/ghc/compiler/basicTypes/</code></a>
contains modules that define some of the essential types definition for
the compiler - such as, identifiers, variables, modules, and unique
- names.
+ names. Some of those are discussed in the following. Some more
+ detailed information on <code>Var</code>s, <code>Id</code>s, and
+ <code>TyVar</code>s is provided <a href="vars.html">elsewhere.</a>
+
+ <h2>Elementary Types</h2>
<h4><code>Id</code>s</h4>
<p>
(<code>IAmALoopBreaker</code>).
</dl>
- <p><small>
+ <h2>Sets, Finite Maps, and Environments</h2>
+ <p>
+ Sets of variables, or more generally names, which are needed throughout
+ the compiler, are provided by the modules <a
+ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/basicTypes/VarSet.lhs"><code>VarSet.lhs</code></a>
+ and <a
+ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/basicTypes/NameSet.lhs"><code>NameSet.lhs</code></a>,
+ respectively. Moreover, frequently maps from variables (or names) to
+ other data is needed. For example, a substitution is represented by a
+ finite map from variable names to expressions. Jobs like this are
+ solved by means of variable and name environments implemented by the
+ modules <a
+ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/basicTypes/VarEnv.lhs"><code>VarEnv.lhs</code></a>
+ and <a
+ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/basicTypes/NameEnv.lhs"><code>NameEnv.lhs</code></a>.
+
+ <h4>The Module <code>VarSet</code></h4>
+ <p>
+ The Module <code>VarSet</code> provides the types <code>VarSet</code>,
+ <code>IdSet</code>, and <code>TyVarSet</code>, which are synonyms in the
+ current implementation, as <code>Var</code>, <code>Id</code>, and
+ <code>TyVar</code> are synonyms. The module provides all the operations
+ that one would expect including the creating of sets from individual
+ variables and lists of variables, union and intersection operations,
+ element checks, deletion, filter, fold, and map functions.
+ <p>
+ The implementation is based on <a
+ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/utils/UniqSet.lhs"><code>UniqSet</code></a>s,
+ which in turn are simply <a href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/utils/UniqFM.lhs"><code>UniqFM</code></a>s
+ (i.e., finite maps with uniques as keys) that map each unique to the
+ variable that it represents.
+
+ <h4>The Module <code>NameSet</code></h4>
+ <p>
+ The Module <code>NameSet</code> provides the same functionality as
+ <code>VarSet</code> only for <a
+ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/basicTypes/Name.lhs"><code>Name<code></a>s.
+ As for the difference between <code>Name</code>s and <code>Var</code>s,
+ a <code>Var</code> is built from a <code>Name</code> plus additional
+ information (mostly importantly type information).
+
+ <h4>The Module <code>VarEnv</code></h4>
+ <p>
+ The module <code>VarEnv</code> provides the types <code>VarEnv</code>,
+ <code>IdEnv</code>, and <code>TyVarEnv</code>, which are again
+ synonyms. The provided base functionality is similar to
+ <code>VarSet</code> with the main difference that a type <code>VarEnv
+ T</code> associates a value of type <code>T</code> with each variable in
+ the environment, thus effectively implementing a finite map from
+ variables to values of type <code>T</code>.
+ <p>
+ The implementation of <code>VarEnv</code> is also by <a
+ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/utils/UniqFM.lhs"><code>UniqFM</code></a>,
+ which entails the slightly surprising implication that it is
+ <em>not</em> possible to retrieve the domain of a variable environment.
+ In other words, there is no function corresponding to
+ <code>VarSet.varSetElems :: VarSet -> [Var]</code> in
+ <code>VarEnv</code>. This is because the <code>UniqFM</code> used to
+ implement <code>VarEnv</code> stores only the unique corresponding to a
+ variable in the environment, but not the entire variable (and there is
+ no mapping from uniques to variables).
+ <p>
+ In addition to plain variable environments, the module also contains
+ special substitution environments - the type <code>SubstEnv</code> -
+ that associates variables with a special purpose type
+ <code>SubstResult</code>.
+
+ <h4>The Module <code>NameEnv</code></h4>
+ <p>
+ The type <code>NameEnv.NameEnv</code> is like <code>VarEnv</code> only
+ for <code>Name</code>s.
+
+ <p><hr><small>
<!-- hhmts start -->
-Last modified: Wed Aug 8 19:23:01 EST 2001
+Last modified: Tue Jan 8 18:29:52 EST 2002
<!-- hhmts end -->
</small>
</body>