ghc-8.8.1: The GHC API
Safe HaskellNone
LanguageHaskell2010

NameSet

Synopsis

Names set type

Manipulating these sets

intersectsNameSet :: NameSet -> NameSet -> Bool Source #

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

nameSetElemsStable :: NameSet -> [Name] Source #

Get the elements of a NameSet with some stable ordering. This only works for Names that originate in the source code or have been tidied. See Note [Deterministic UniqFM] to learn about nondeterminism

Free variables

Manipulating sets of free variables

Defs and uses

type Defs = NameSet Source #

A set of names that are defined somewhere

type Uses = NameSet Source #

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 -> Uses Source #

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 -> Uses Source #

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

allUses :: DefUses -> Uses Source #

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