The GHC Commentary - The Basics

The directory 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.

Ids

An Id (defined in Id.lhs essentially records information about value and data constructor identifiers -- to be precise, in the case of data constructors, two Ids are used to represent the worker and wrapper functions for the data constructor, respectively. The information maintained in the Id abstraction includes among other items strictness, occurrence, specialisation, and unfolding information.

Due to the way Ids are used for data constructors, all Ids are represented as variables, which contain a varInfo field of abstract type IdInfo.IdInfo. This is where the information about Ids is really stored. The following is a (currently, partial) list of the various items in an IdInfo:

Occurence information
The OccInfo data type is defined in the module BasicTypes.lhs. Apart from the trivial NoOccInfo, it distinguishes between variables that do not occur at all (IAmDead), occur just once (OneOcc), or a loop breakers (IAmALoopBreaker).

Last modified: Wed Aug 8 19:23:01 EST 2001