| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
GHC.Stg.Subst
Synopsis
- data Subst = Subst InScopeSet IdSubstEnv
- type IdSubstEnv = IdEnv Id
- emptySubst :: Subst
- mkEmptySubst :: InScopeSet -> Subst
- substBndr :: Id -> Subst -> (Id, Subst)
- substBndrs :: Traversable f => f Id -> Subst -> (f Id, Subst)
- lookupIdSubst :: HasCallStack => Id -> Subst -> Id
- noWarnLookupIdSubst :: HasCallStack => Id -> Subst -> Id
- extendInScope :: Id -> Subst -> Subst
- extendSubst :: Id -> Id -> Subst -> Subst
Documentation
A renaming substitution from Ids to Ids. Like RnEnv2, but not
maintaining pairs of substitutions. Like Subst, but
with the domain being Ids instead of entire CoreExpr.
Constructors
| Subst InScopeSet IdSubstEnv |
type IdSubstEnv = IdEnv Id #
emptySubst :: Subst #
emptySubst =mkEmptySubstemptyInScopeSet
mkEmptySubst :: InScopeSet -> Subst #
Constructs a new Subst assuming the variables in the given InScopeSet
are in scope.
substBndr :: Id -> Subst -> (Id, Subst) #
Substitutes an Id for another one according to the Subst given in a way
that avoids shadowing the InScopeSet, returning the result and an updated
Subst that should be used by subsequent substitutions.
substBndrs :: Traversable f => f Id -> Subst -> (f Id, Subst) #
substBndrs = runState . traverse (state . substBndr)
lookupIdSubst :: HasCallStack => Id -> Subst -> Id #
Substitutes an occurrence of an identifier for its counterpart recorded
in the Subst.
noWarnLookupIdSubst :: HasCallStack => Id -> Subst -> Id #
Substitutes an occurrence of an identifier for its counterpart recorded
in the Subst. Does not generate a debug warning if the identifier to
to substitute wasn't in scope.