ghc-7.6.3: The GHC API

Safe HaskellNone

NameSet

Contents

Synopsis

Names set type

Manipulating these sets

foldNameSet :: (Name -> b -> b) -> b -> NameSet -> bSource

intersectsNameSet :: NameSet -> NameSet -> BoolSource

True if there is a non-empty intersection. s1 intersectsNameSet s2 doesn't compute s2 if s1 is empty

Free variables

Manipulating sets of free variables

Defs and uses

type Defs = NameSetSource

A set of names that are defined somewhere

type Uses = NameSetSource

A set of names that are used somewhere

type DefUse = (Maybe Defs, Uses)Source

(Just ds, us) => The use of any member of the ds implies that all the us are used too. Also, us may mention ds.

Nothing => Nothing is defined in this group, but nevertheless all the uses are essential. Used for instance declarations, for example

type DefUses = [DefUse]Source

A number of DefUses in dependency order: earlier Defs scope over later Uses In a single (def, use) pair, the defs also scope over the uses

Manipulating defs and uses

findUses :: DefUses -> Uses -> UsesSource

Given some DefUses and some Uses, find all the uses, transitively. The result is a superset of the input Uses; and includes things defined in the input DefUses (but only if they are used)

duUses :: DefUses -> UsesSource

Collect all Uses, regardless of whether the group is itself used, but remove Defs on the way

allUses :: DefUses -> UsesSource

Just like duUses, but Defs are not eliminated from the Uses returned