Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Facilities for determining which names are used in some syntactic
construct. The most important interface is the FreeIn
class and
its instances, but for reasons related to the Haskell type system,
some constructs have specialised functions.
Synopsis
- data Names
- namesIntMap :: Names -> IntMap VName
- nameIn :: VName -> Names -> Bool
- oneName :: VName -> Names
- namesFromList :: [VName] -> Names
- namesToList :: Names -> [VName]
- namesIntersection :: Names -> Names -> Names
- namesIntersect :: Names -> Names -> Bool
- namesSubtract :: Names -> Names -> Names
- mapNames :: (VName -> VName) -> Names -> Names
- class FreeIn a where
- freeIn :: FreeIn a => a -> Names
- freeInStmsAndRes :: (FreeIn (Op lore), FreeIn (LetDec lore), FreeIn (LParamInfo lore), FreeIn (FParamInfo lore), FreeDec (BodyDec lore), FreeDec (ExpDec lore)) => Stms lore -> Result -> FV
- boundInBody :: Body lore -> Names
- boundByStm :: Stm lore -> Names
- boundByStms :: Stms lore -> Names
- boundByLambda :: Lambda lore -> [VName]
- class FreeIn dec => FreeDec dec where
- precomputed :: dec -> FV -> FV
- data FV
- fvBind :: Names -> FV -> FV
- fvName :: VName -> FV
- fvNames :: Names -> FV
Free names
A set of names. Note that the Ord
instance is a dummy that
treats everything as EQ
if ==
, and otherwise LT
.
Instances
Eq Names Source # | |
Ord Names Source # | |
Show Names Source # | |
Semigroup Names Source # | |
Monoid Names Source # | |
Pretty Names Source # | |
FreeDec Names Source # | |
Defined in Futhark.IR.Prop.Names | |
FreeIn Names Source # | |
Substitute Names Source # | |
Defined in Futhark.Transform.Substitute | |
Rename Names Source # | |
AliasesOf Names Source # | |
MonadState Names (TypeM lore) Source # | |
namesIntMap :: Names -> IntMap VName Source #
Retrieve the data structure underlying the names representation.
namesFromList :: [VName] -> Names Source #
Construct a name set from a list. Slow.
namesToList :: Names -> [VName] Source #
Turn a name set into a list of names. Slow.
Class
A class indicating that we can obtain free variable information from values of this type.
Nothing
Instances
Specialised Functions
freeInStmsAndRes :: (FreeIn (Op lore), FreeIn (LetDec lore), FreeIn (LParamInfo lore), FreeIn (FParamInfo lore), FreeDec (BodyDec lore), FreeDec (ExpDec lore)) => Stms lore -> Result -> FV Source #
Return the set of variable names that are free in the given statements and result. Filters away the names that are bound by the statements.
Bound Names
boundByStm :: Stm lore -> Names Source #
The names bound by a binding.
boundByStms :: Stms lore -> Names Source #
The names bound by the bindings.
boundByLambda :: Lambda lore -> [VName] Source #
The names of the lambda parameters plus the index parameter.
Efficient computation
class FreeIn dec => FreeDec dec where Source #
Either return precomputed free names stored in the attribute, or the freshly computed names. Relies on lazy evaluation to avoid the work.
Nothing
precomputed :: dec -> FV -> FV Source #
Instances
FreeDec () Source # | |
Defined in Futhark.IR.Prop.Names precomputed :: () -> FV -> FV Source # | |
FreeDec Names Source # | |
Defined in Futhark.IR.Prop.Names | |
FreeDec AliasDec Source # | |
Defined in Futhark.IR.Aliases | |
FreeDec ExpWisdom Source # | |
Defined in Futhark.Optimise.Simplify.Lore | |
FreeDec a => FreeDec [a] Source # | |
Defined in Futhark.IR.Prop.Names precomputed :: [a] -> FV -> FV Source # | |
FreeDec a => FreeDec (Maybe a) Source # | |
Defined in Futhark.IR.Prop.Names | |
(FreeDec a, FreeIn b) => FreeDec (a, b) Source # | |
Defined in Futhark.IR.Prop.Names precomputed :: (a, b) -> FV -> FV Source # |