From c9fdbbd3467f5f18f1cb03cc6a0c08190c039a15 Mon Sep 17 00:00:00 2001 From: chak Date: Tue, 8 Jan 2002 07:29:07 +0000 Subject: [PATCH] [project @ 2002-01-08 07:29:07 by chak] Some docu covering VarSet, NameSet, VarEnv, and NameEnv. --- ghc/docs/comm/index.html | 4 +- ghc/docs/comm/the-beast/basicTypes.html | 82 +++++++++++++++++++++++++++++-- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/ghc/docs/comm/index.html b/ghc/docs/comm/index.html index 9b4d45c..ab038e7 100644 --- a/ghc/docs/comm/index.html +++ b/ghc/docs/comm/index.html @@ -6,7 +6,7 @@ -

The Glasgow Haskell Compiler (GHC) Commentary [v0.6]

+

The Glasgow Haskell Compiler (GHC) Commentary [v0.7]

-Last modified: Mon Nov 26 19:23:12 EST 2001 +Last modified: Tue Jan 8 18:23:25 EST 2002 diff --git a/ghc/docs/comm/the-beast/basicTypes.html b/ghc/docs/comm/the-beast/basicTypes.html index 2295db5..5c102cf 100644 --- a/ghc/docs/comm/the-beast/basicTypes.html +++ b/ghc/docs/comm/the-beast/basicTypes.html @@ -12,7 +12,11 @@ href="http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/ghc/compiler/basicTypes/">fptools/ghc/compiler/basicTypes/ 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 Vars, Ids, and + TyVars is provided elsewhere. + +

Elementary Types

Ids

@@ -44,9 +48,81 @@ (IAmALoopBreaker). -

+

Sets, Finite Maps, and Environments

+

+ Sets of variables, or more generally names, which are needed throughout + the compiler, are provided by the modules VarSet.lhs + and NameSet.lhs, + 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 VarEnv.lhs + and NameEnv.lhs. + +

The Module VarSet

+

+ The Module VarSet provides the types VarSet, + IdSet, and TyVarSet, which are synonyms in the + current implementation, as Var, Id, and + TyVar 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. +

+ The implementation is based on UniqSets, + which in turn are simply UniqFMs + (i.e., finite maps with uniques as keys) that map each unique to the + variable that it represents. + +

The Module NameSet

+

+ The Module NameSet provides the same functionality as + VarSet only for Names. + As for the difference between Names and Vars, + a Var is built from a Name plus additional + information (mostly importantly type information). + +

The Module VarEnv

+

+ The module VarEnv provides the types VarEnv, + IdEnv, and TyVarEnv, which are again + synonyms. The provided base functionality is similar to + VarSet with the main difference that a type VarEnv + T associates a value of type T with each variable in + the environment, thus effectively implementing a finite map from + variables to values of type T. +

+ The implementation of VarEnv is also by UniqFM, + which entails the slightly surprising implication that it is + not possible to retrieve the domain of a variable environment. + In other words, there is no function corresponding to + VarSet.varSetElems :: VarSet -> [Var] in + VarEnv. This is because the UniqFM used to + implement VarEnv 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). +

+ In addition to plain variable environments, the module also contains + special substitution environments - the type SubstEnv - + that associates variables with a special purpose type + SubstResult. + +

The Module NameEnv

+

+ The type NameEnv.NameEnv is like VarEnv only + for Names. + +


-Last modified: Wed Aug 8 19:23:01 EST 2001 +Last modified: Tue Jan 8 18:29:52 EST 2002 -- 1.7.10.4