module VarEnv (
VarEnv, IdEnv, TyVarEnv, CoVarEnv, TyCoVarEnv,
emptyVarEnv, unitVarEnv, mkVarEnv, mkVarEnv_Directly,
elemVarEnv, disjointVarEnv,
extendVarEnv, extendVarEnv_C, extendVarEnv_Acc, extendVarEnv_Directly,
extendVarEnvList,
plusVarEnv, plusVarEnv_C, plusVarEnv_CD, plusMaybeVarEnv_C,
plusVarEnvList, alterVarEnv,
delVarEnvList, delVarEnv, delVarEnv_Directly,
minusVarEnv, intersectsVarEnv,
lookupVarEnv, lookupVarEnv_NF, lookupWithDefaultVarEnv,
mapVarEnv, zipVarEnv,
modifyVarEnv, modifyVarEnv_Directly,
isEmptyVarEnv,
elemVarEnvByKey, lookupVarEnv_Directly,
filterVarEnv, filterVarEnv_Directly, restrictVarEnv,
partitionVarEnv,
DVarEnv, DIdEnv, DTyVarEnv,
emptyDVarEnv, mkDVarEnv,
dVarEnvElts,
extendDVarEnv, extendDVarEnv_C,
extendDVarEnvList,
lookupDVarEnv, elemDVarEnv,
isEmptyDVarEnv, foldDVarEnv,
mapDVarEnv, filterDVarEnv,
modifyDVarEnv,
alterDVarEnv,
plusDVarEnv, plusDVarEnv_C,
unitDVarEnv,
delDVarEnv,
delDVarEnvList,
minusDVarEnv,
partitionDVarEnv,
anyDVarEnv,
InScopeSet,
emptyInScopeSet, mkInScopeSet, delInScopeSet,
extendInScopeSet, extendInScopeSetList, extendInScopeSetSet,
getInScopeVars, lookupInScope, lookupInScope_Directly,
unionInScope, elemInScopeSet, uniqAway,
varSetInScope,
RnEnv2,
mkRnEnv2, rnBndr2, rnBndrs2, rnBndr2_var,
rnOccL, rnOccR, inRnEnvL, inRnEnvR, rnOccL_maybe, rnOccR_maybe,
rnBndrL, rnBndrR, nukeRnEnvL, nukeRnEnvR, rnSwap,
delBndrL, delBndrR, delBndrsL, delBndrsR,
addRnInScopeSet,
rnEtaL, rnEtaR,
rnInScope, rnInScopeSet, lookupRnInScope,
rnEnvL, rnEnvR,
TidyEnv,
emptyTidyEnv, mkEmptyTidyEnv
) where
import GhcPrelude
import OccName
import Var
import VarSet
import UniqSet
import UniqFM
import UniqDFM
import Unique
import Util
import Maybes
import Outputable
data InScopeSet = InScope VarSet {-# UNPACK #-} !Int
instance Outputable InScopeSet where
ppr :: InScopeSet -> SDoc
ppr (InScope s :: VarSet
s _) =
String -> SDoc
text "InScope" SDoc -> SDoc -> SDoc
<+>
SDoc -> SDoc
braces ([SDoc] -> SDoc
fsep ((Var -> SDoc) -> [Var] -> [SDoc]
forall a b. (a -> b) -> [a] -> [b]
map (Name -> SDoc
forall a. Outputable a => a -> SDoc
ppr (Name -> SDoc) -> (Var -> Name) -> Var -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Var -> Name
Var.varName) (VarSet -> [Var]
forall elt. UniqSet elt -> [elt]
nonDetEltsUniqSet VarSet
s)))
emptyInScopeSet :: InScopeSet
emptyInScopeSet :: InScopeSet
emptyInScopeSet = VarSet -> Int -> InScopeSet
InScope VarSet
emptyVarSet 1
getInScopeVars :: InScopeSet -> VarSet
getInScopeVars :: InScopeSet -> VarSet
getInScopeVars (InScope vs :: VarSet
vs _) = VarSet
vs
mkInScopeSet :: VarSet -> InScopeSet
mkInScopeSet :: VarSet -> InScopeSet
mkInScopeSet in_scope :: VarSet
in_scope = VarSet -> Int -> InScopeSet
InScope VarSet
in_scope 1
extendInScopeSet :: InScopeSet -> Var -> InScopeSet
extendInScopeSet :: InScopeSet -> Var -> InScopeSet
extendInScopeSet (InScope in_scope :: VarSet
in_scope n :: Int
n) v :: Var
v
= VarSet -> Int -> InScopeSet
InScope (VarSet -> Var -> VarSet
extendVarSet VarSet
in_scope Var
v) (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
extendInScopeSetList :: InScopeSet -> [Var] -> InScopeSet
extendInScopeSetList :: InScopeSet -> [Var] -> InScopeSet
extendInScopeSetList (InScope in_scope :: VarSet
in_scope n :: Int
n) vs :: [Var]
vs
= VarSet -> Int -> InScopeSet
InScope ((VarSet -> Var -> VarSet) -> VarSet -> [Var] -> VarSet
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (\s :: VarSet
s v :: Var
v -> VarSet -> Var -> VarSet
extendVarSet VarSet
s Var
v) VarSet
in_scope [Var]
vs)
(Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ [Var] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Var]
vs)
extendInScopeSetSet :: InScopeSet -> VarSet -> InScopeSet
extendInScopeSetSet :: InScopeSet -> VarSet -> InScopeSet
extendInScopeSetSet (InScope in_scope :: VarSet
in_scope n :: Int
n) vs :: VarSet
vs
= VarSet -> Int -> InScopeSet
InScope (VarSet
in_scope VarSet -> VarSet -> VarSet
`unionVarSet` VarSet
vs) (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ VarSet -> Int
forall a. UniqSet a -> Int
sizeUniqSet VarSet
vs)
delInScopeSet :: InScopeSet -> Var -> InScopeSet
delInScopeSet :: InScopeSet -> Var -> InScopeSet
delInScopeSet (InScope in_scope :: VarSet
in_scope n :: Int
n) v :: Var
v = VarSet -> Int -> InScopeSet
InScope (VarSet
in_scope VarSet -> Var -> VarSet
`delVarSet` Var
v) Int
n
elemInScopeSet :: Var -> InScopeSet -> Bool
elemInScopeSet :: Var -> InScopeSet -> Bool
elemInScopeSet v :: Var
v (InScope in_scope :: VarSet
in_scope _) = Var
v Var -> VarSet -> Bool
`elemVarSet` VarSet
in_scope
lookupInScope :: InScopeSet -> Var -> Maybe Var
lookupInScope :: InScopeSet -> Var -> Maybe Var
lookupInScope (InScope in_scope :: VarSet
in_scope _) v :: Var
v = VarSet -> Var -> Maybe Var
lookupVarSet VarSet
in_scope Var
v
lookupInScope_Directly :: InScopeSet -> Unique -> Maybe Var
lookupInScope_Directly :: InScopeSet -> Unique -> Maybe Var
lookupInScope_Directly (InScope in_scope :: VarSet
in_scope _) uniq :: Unique
uniq
= VarSet -> Unique -> Maybe Var
lookupVarSet_Directly VarSet
in_scope Unique
uniq
unionInScope :: InScopeSet -> InScopeSet -> InScopeSet
unionInScope :: InScopeSet -> InScopeSet -> InScopeSet
unionInScope (InScope s1 :: VarSet
s1 _) (InScope s2 :: VarSet
s2 n2 :: Int
n2)
= VarSet -> Int -> InScopeSet
InScope (VarSet
s1 VarSet -> VarSet -> VarSet
`unionVarSet` VarSet
s2) Int
n2
varSetInScope :: VarSet -> InScopeSet -> Bool
varSetInScope :: VarSet -> InScopeSet -> Bool
varSetInScope vars :: VarSet
vars (InScope s1 :: VarSet
s1 _) = VarSet
vars VarSet -> VarSet -> Bool
`subVarSet` VarSet
s1
uniqAway :: InScopeSet -> Var -> Var
uniqAway :: InScopeSet -> Var -> Var
uniqAway in_scope :: InScopeSet
in_scope var :: Var
var
| Var
var Var -> InScopeSet -> Bool
`elemInScopeSet` InScopeSet
in_scope = InScopeSet -> Var -> Var
uniqAway' InScopeSet
in_scope Var
var
| Bool
otherwise = Var
var
uniqAway' :: InScopeSet -> Var -> Var
uniqAway' :: InScopeSet -> Var -> Var
uniqAway' (InScope set :: VarSet
set n :: Int
n) var :: Var
var
= Int -> Var
try 1
where
orig_unique :: Unique
orig_unique = Var -> Unique
forall a. Uniquable a => a -> Unique
getUnique Var
var
try :: Int -> Var
try k :: Int
k
| Bool
debugIsOn Bool -> Bool -> Bool
&& (Int
k Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 1000)
= String -> SDoc -> Var
forall a. HasCallStack => String -> SDoc -> a
pprPanic "uniqAway loop:" SDoc
msg
| Unique
uniq Unique -> VarSet -> Bool
`elemVarSetByKey` VarSet
set = Int -> Var
try (Int
k Int -> Int -> Int
forall a. Num a => a -> a -> a
+ 1)
| Int
k Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> 3
= String -> SDoc -> (Var -> Unique -> Var) -> Var -> Unique -> Var
forall a. String -> SDoc -> a -> a
pprTraceDebug "uniqAway:" SDoc
msg
Var -> Unique -> Var
setVarUnique Var
var Unique
uniq
| Bool
otherwise = Var -> Unique -> Var
setVarUnique Var
var Unique
uniq
where
msg :: SDoc
msg = Int -> SDoc
forall a. Outputable a => a -> SDoc
ppr Int
k SDoc -> SDoc -> SDoc
<+> String -> SDoc
text "tries" SDoc -> SDoc -> SDoc
<+> Var -> SDoc
forall a. Outputable a => a -> SDoc
ppr Var
var SDoc -> SDoc -> SDoc
<+> Int -> SDoc
int Int
n
uniq :: Unique
uniq = Unique -> Int -> Unique
deriveUnique Unique
orig_unique (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
k)
data RnEnv2
= RV2 { RnEnv2 -> VarEnv Var
envL :: VarEnv Var
, RnEnv2 -> VarEnv Var
envR :: VarEnv Var
, RnEnv2 -> InScopeSet
in_scope :: InScopeSet }
mkRnEnv2 :: InScopeSet -> RnEnv2
mkRnEnv2 :: InScopeSet -> RnEnv2
mkRnEnv2 vars :: InScopeSet
vars = RV2 :: VarEnv Var -> VarEnv Var -> InScopeSet -> RnEnv2
RV2 { envL :: VarEnv Var
envL = VarEnv Var
forall a. VarEnv a
emptyVarEnv
, envR :: VarEnv Var
envR = VarEnv Var
forall a. VarEnv a
emptyVarEnv
, in_scope :: InScopeSet
in_scope = InScopeSet
vars }
addRnInScopeSet :: RnEnv2 -> VarSet -> RnEnv2
addRnInScopeSet :: RnEnv2 -> VarSet -> RnEnv2
addRnInScopeSet env :: RnEnv2
env vs :: VarSet
vs
| VarSet -> Bool
isEmptyVarSet VarSet
vs = RnEnv2
env
| Bool
otherwise = RnEnv2
env { in_scope :: InScopeSet
in_scope = InScopeSet -> VarSet -> InScopeSet
extendInScopeSetSet (RnEnv2 -> InScopeSet
in_scope RnEnv2
env) VarSet
vs }
rnInScope :: Var -> RnEnv2 -> Bool
rnInScope :: Var -> RnEnv2 -> Bool
rnInScope x :: Var
x env :: RnEnv2
env = Var
x Var -> InScopeSet -> Bool
`elemInScopeSet` RnEnv2 -> InScopeSet
in_scope RnEnv2
env
rnInScopeSet :: RnEnv2 -> InScopeSet
rnInScopeSet :: RnEnv2 -> InScopeSet
rnInScopeSet = RnEnv2 -> InScopeSet
in_scope
rnEnvL :: RnEnv2 -> VarEnv Var
rnEnvL :: RnEnv2 -> VarEnv Var
rnEnvL = RnEnv2 -> VarEnv Var
envL
rnEnvR :: RnEnv2 -> VarEnv Var
rnEnvR :: RnEnv2 -> VarEnv Var
rnEnvR = RnEnv2 -> VarEnv Var
envR
rnBndrs2 :: RnEnv2 -> [Var] -> [Var] -> RnEnv2
rnBndrs2 :: RnEnv2 -> [Var] -> [Var] -> RnEnv2
rnBndrs2 env :: RnEnv2
env bsL :: [Var]
bsL bsR :: [Var]
bsR = (RnEnv2 -> Var -> Var -> RnEnv2)
-> RnEnv2 -> [Var] -> [Var] -> RnEnv2
forall acc a b. (acc -> a -> b -> acc) -> acc -> [a] -> [b] -> acc
foldl2 RnEnv2 -> Var -> Var -> RnEnv2
rnBndr2 RnEnv2
env [Var]
bsL [Var]
bsR
rnBndr2 :: RnEnv2 -> Var -> Var -> RnEnv2
rnBndr2 :: RnEnv2 -> Var -> Var -> RnEnv2
rnBndr2 env :: RnEnv2
env bL :: Var
bL bR :: Var
bR = (RnEnv2, Var) -> RnEnv2
forall a b. (a, b) -> a
fst ((RnEnv2, Var) -> RnEnv2) -> (RnEnv2, Var) -> RnEnv2
forall a b. (a -> b) -> a -> b
$ RnEnv2 -> Var -> Var -> (RnEnv2, Var)
rnBndr2_var RnEnv2
env Var
bL Var
bR
rnBndr2_var :: RnEnv2 -> Var -> Var -> (RnEnv2, Var)
rnBndr2_var :: RnEnv2 -> Var -> Var -> (RnEnv2, Var)
rnBndr2_var (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
envL, envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
envR, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) bL :: Var
bL bR :: Var
bR
= (RV2 :: VarEnv Var -> VarEnv Var -> InScopeSet -> RnEnv2
RV2 { envL :: VarEnv Var
envL = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envL Var
bL Var
new_b
, envR :: VarEnv Var
envR = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envR Var
bR Var
new_b
, in_scope :: InScopeSet
in_scope = InScopeSet -> Var -> InScopeSet
extendInScopeSet InScopeSet
in_scope Var
new_b }, Var
new_b)
where
new_b :: Var
new_b | Bool -> Bool
not (Var
bL Var -> InScopeSet -> Bool
`elemInScopeSet` InScopeSet
in_scope) = Var
bL
| Bool -> Bool
not (Var
bR Var -> InScopeSet -> Bool
`elemInScopeSet` InScopeSet
in_scope) = Var
bR
| Bool
otherwise = InScopeSet -> Var -> Var
uniqAway' InScopeSet
in_scope Var
bL
rnBndrL :: RnEnv2 -> Var -> (RnEnv2, Var)
rnBndrL :: RnEnv2 -> Var -> (RnEnv2, Var)
rnBndrL (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
envL, envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
envR, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) bL :: Var
bL
= (RV2 :: VarEnv Var -> VarEnv Var -> InScopeSet -> RnEnv2
RV2 { envL :: VarEnv Var
envL = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envL Var
bL Var
new_b
, envR :: VarEnv Var
envR = VarEnv Var
envR
, in_scope :: InScopeSet
in_scope = InScopeSet -> Var -> InScopeSet
extendInScopeSet InScopeSet
in_scope Var
new_b }, Var
new_b)
where
new_b :: Var
new_b = InScopeSet -> Var -> Var
uniqAway InScopeSet
in_scope Var
bL
rnBndrR :: RnEnv2 -> Var -> (RnEnv2, Var)
rnBndrR :: RnEnv2 -> Var -> (RnEnv2, Var)
rnBndrR (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
envL, envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
envR, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) bR :: Var
bR
= (RV2 :: VarEnv Var -> VarEnv Var -> InScopeSet -> RnEnv2
RV2 { envR :: VarEnv Var
envR = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envR Var
bR Var
new_b
, envL :: VarEnv Var
envL = VarEnv Var
envL
, in_scope :: InScopeSet
in_scope = InScopeSet -> Var -> InScopeSet
extendInScopeSet InScopeSet
in_scope Var
new_b }, Var
new_b)
where
new_b :: Var
new_b = InScopeSet -> Var -> Var
uniqAway InScopeSet
in_scope Var
bR
rnEtaL :: RnEnv2 -> Var -> (RnEnv2, Var)
rnEtaL :: RnEnv2 -> Var -> (RnEnv2, Var)
rnEtaL (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
envL, envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
envR, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) bL :: Var
bL
= (RV2 :: VarEnv Var -> VarEnv Var -> InScopeSet -> RnEnv2
RV2 { envL :: VarEnv Var
envL = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envL Var
bL Var
new_b
, envR :: VarEnv Var
envR = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envR Var
new_b Var
new_b
, in_scope :: InScopeSet
in_scope = InScopeSet -> Var -> InScopeSet
extendInScopeSet InScopeSet
in_scope Var
new_b }, Var
new_b)
where
new_b :: Var
new_b = InScopeSet -> Var -> Var
uniqAway InScopeSet
in_scope Var
bL
rnEtaR :: RnEnv2 -> Var -> (RnEnv2, Var)
rnEtaR :: RnEnv2 -> Var -> (RnEnv2, Var)
rnEtaR (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
envL, envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
envR, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) bR :: Var
bR
= (RV2 :: VarEnv Var -> VarEnv Var -> InScopeSet -> RnEnv2
RV2 { envL :: VarEnv Var
envL = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envL Var
new_b Var
new_b
, envR :: VarEnv Var
envR = VarEnv Var -> Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv Var
envR Var
bR Var
new_b
, in_scope :: InScopeSet
in_scope = InScopeSet -> Var -> InScopeSet
extendInScopeSet InScopeSet
in_scope Var
new_b }, Var
new_b)
where
new_b :: Var
new_b = InScopeSet -> Var -> Var
uniqAway InScopeSet
in_scope Var
bR
delBndrL, delBndrR :: RnEnv2 -> Var -> RnEnv2
delBndrL :: RnEnv2 -> Var -> RnEnv2
delBndrL rn :: RnEnv2
rn@(RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
env, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) v :: Var
v
= RnEnv2
rn { envL :: VarEnv Var
envL = VarEnv Var
env VarEnv Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> VarEnv a
`delVarEnv` Var
v, in_scope :: InScopeSet
in_scope = InScopeSet
in_scope InScopeSet -> Var -> InScopeSet
`extendInScopeSet` Var
v }
delBndrR :: RnEnv2 -> Var -> RnEnv2
delBndrR rn :: RnEnv2
rn@(RV2 { envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
env, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) v :: Var
v
= RnEnv2
rn { envR :: VarEnv Var
envR = VarEnv Var
env VarEnv Var -> Var -> VarEnv Var
forall a. VarEnv a -> Var -> VarEnv a
`delVarEnv` Var
v, in_scope :: InScopeSet
in_scope = InScopeSet
in_scope InScopeSet -> Var -> InScopeSet
`extendInScopeSet` Var
v }
delBndrsL, delBndrsR :: RnEnv2 -> [Var] -> RnEnv2
delBndrsL :: RnEnv2 -> [Var] -> RnEnv2
delBndrsL rn :: RnEnv2
rn@(RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
env, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) v :: [Var]
v
= RnEnv2
rn { envL :: VarEnv Var
envL = VarEnv Var
env VarEnv Var -> [Var] -> VarEnv Var
forall a. VarEnv a -> [Var] -> VarEnv a
`delVarEnvList` [Var]
v, in_scope :: InScopeSet
in_scope = InScopeSet
in_scope InScopeSet -> [Var] -> InScopeSet
`extendInScopeSetList` [Var]
v }
delBndrsR :: RnEnv2 -> [Var] -> RnEnv2
delBndrsR rn :: RnEnv2
rn@(RV2 { envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
env, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope }) v :: [Var]
v
= RnEnv2
rn { envR :: VarEnv Var
envR = VarEnv Var
env VarEnv Var -> [Var] -> VarEnv Var
forall a. VarEnv a -> [Var] -> VarEnv a
`delVarEnvList` [Var]
v, in_scope :: InScopeSet
in_scope = InScopeSet
in_scope InScopeSet -> [Var] -> InScopeSet
`extendInScopeSetList` [Var]
v }
rnOccL, rnOccR :: RnEnv2 -> Var -> Var
rnOccL :: RnEnv2 -> Var -> Var
rnOccL (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
env }) v :: Var
v = VarEnv Var -> Var -> Maybe Var
forall a. VarEnv a -> Var -> Maybe a
lookupVarEnv VarEnv Var
env Var
v Maybe Var -> Var -> Var
forall a. Maybe a -> a -> a
`orElse` Var
v
rnOccR :: RnEnv2 -> Var -> Var
rnOccR (RV2 { envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
env }) v :: Var
v = VarEnv Var -> Var -> Maybe Var
forall a. VarEnv a -> Var -> Maybe a
lookupVarEnv VarEnv Var
env Var
v Maybe Var -> Var -> Var
forall a. Maybe a -> a -> a
`orElse` Var
v
rnOccL_maybe, rnOccR_maybe :: RnEnv2 -> Var -> Maybe Var
rnOccL_maybe :: RnEnv2 -> Var -> Maybe Var
rnOccL_maybe (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
env }) v :: Var
v = VarEnv Var -> Var -> Maybe Var
forall a. VarEnv a -> Var -> Maybe a
lookupVarEnv VarEnv Var
env Var
v
rnOccR_maybe :: RnEnv2 -> Var -> Maybe Var
rnOccR_maybe (RV2 { envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
env }) v :: Var
v = VarEnv Var -> Var -> Maybe Var
forall a. VarEnv a -> Var -> Maybe a
lookupVarEnv VarEnv Var
env Var
v
inRnEnvL, inRnEnvR :: RnEnv2 -> Var -> Bool
inRnEnvL :: RnEnv2 -> Var -> Bool
inRnEnvL (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
env }) v :: Var
v = Var
v Var -> VarEnv Var -> Bool
forall a. Var -> VarEnv a -> Bool
`elemVarEnv` VarEnv Var
env
inRnEnvR :: RnEnv2 -> Var -> Bool
inRnEnvR (RV2 { envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
env }) v :: Var
v = Var
v Var -> VarEnv Var -> Bool
forall a. Var -> VarEnv a -> Bool
`elemVarEnv` VarEnv Var
env
lookupRnInScope :: RnEnv2 -> Var -> Var
lookupRnInScope :: RnEnv2 -> Var -> Var
lookupRnInScope env :: RnEnv2
env v :: Var
v = InScopeSet -> Var -> Maybe Var
lookupInScope (RnEnv2 -> InScopeSet
in_scope RnEnv2
env) Var
v Maybe Var -> Var -> Var
forall a. Maybe a -> a -> a
`orElse` Var
v
nukeRnEnvL, nukeRnEnvR :: RnEnv2 -> RnEnv2
nukeRnEnvL :: RnEnv2 -> RnEnv2
nukeRnEnvL env :: RnEnv2
env = RnEnv2
env { envL :: VarEnv Var
envL = VarEnv Var
forall a. VarEnv a
emptyVarEnv }
nukeRnEnvR :: RnEnv2 -> RnEnv2
nukeRnEnvR env :: RnEnv2
env = RnEnv2
env { envR :: VarEnv Var
envR = VarEnv Var
forall a. VarEnv a
emptyVarEnv }
rnSwap :: RnEnv2 -> RnEnv2
rnSwap :: RnEnv2 -> RnEnv2
rnSwap (RV2 { envL :: RnEnv2 -> VarEnv Var
envL = VarEnv Var
envL, envR :: RnEnv2 -> VarEnv Var
envR = VarEnv Var
envR, in_scope :: RnEnv2 -> InScopeSet
in_scope = InScopeSet
in_scope })
= RV2 :: VarEnv Var -> VarEnv Var -> InScopeSet -> RnEnv2
RV2 { envL :: VarEnv Var
envL = VarEnv Var
envR, envR :: VarEnv Var
envR = VarEnv Var
envL, in_scope :: InScopeSet
in_scope = InScopeSet
in_scope }
type TidyEnv = (TidyOccEnv, VarEnv Var)
emptyTidyEnv :: TidyEnv
emptyTidyEnv :: TidyEnv
emptyTidyEnv = (TidyOccEnv
emptyTidyOccEnv, VarEnv Var
forall a. VarEnv a
emptyVarEnv)
mkEmptyTidyEnv :: TidyOccEnv -> TidyEnv
mkEmptyTidyEnv :: TidyOccEnv -> TidyEnv
mkEmptyTidyEnv occ_env :: TidyOccEnv
occ_env = (TidyOccEnv
occ_env, VarEnv Var
forall a. VarEnv a
emptyVarEnv)
type VarEnv elt = UniqFM elt
type IdEnv elt = VarEnv elt
type TyVarEnv elt = VarEnv elt
type TyCoVarEnv elt = VarEnv elt
type CoVarEnv elt = VarEnv elt
emptyVarEnv :: VarEnv a
mkVarEnv :: [(Var, a)] -> VarEnv a
mkVarEnv_Directly :: [(Unique, a)] -> VarEnv a
zipVarEnv :: [Var] -> [a] -> VarEnv a
unitVarEnv :: Var -> a -> VarEnv a
alterVarEnv :: (Maybe a -> Maybe a) -> VarEnv a -> Var -> VarEnv a
extendVarEnv :: VarEnv a -> Var -> a -> VarEnv a
extendVarEnv_C :: (a->a->a) -> VarEnv a -> Var -> a -> VarEnv a
extendVarEnv_Acc :: (a->b->b) -> (a->b) -> VarEnv b -> Var -> a -> VarEnv b
extendVarEnv_Directly :: VarEnv a -> Unique -> a -> VarEnv a
plusVarEnv :: VarEnv a -> VarEnv a -> VarEnv a
plusVarEnvList :: [VarEnv a] -> VarEnv a
extendVarEnvList :: VarEnv a -> [(Var, a)] -> VarEnv a
lookupVarEnv_Directly :: VarEnv a -> Unique -> Maybe a
filterVarEnv_Directly :: (Unique -> a -> Bool) -> VarEnv a -> VarEnv a
delVarEnv_Directly :: VarEnv a -> Unique -> VarEnv a
partitionVarEnv :: (a -> Bool) -> VarEnv a -> (VarEnv a, VarEnv a)
restrictVarEnv :: VarEnv a -> VarSet -> VarEnv a
delVarEnvList :: VarEnv a -> [Var] -> VarEnv a
delVarEnv :: VarEnv a -> Var -> VarEnv a
minusVarEnv :: VarEnv a -> VarEnv b -> VarEnv a
intersectsVarEnv :: VarEnv a -> VarEnv a -> Bool
plusVarEnv_C :: (a -> a -> a) -> VarEnv a -> VarEnv a -> VarEnv a
plusVarEnv_CD :: (a -> a -> a) -> VarEnv a -> a -> VarEnv a -> a -> VarEnv a
plusMaybeVarEnv_C :: (a -> a -> Maybe a) -> VarEnv a -> VarEnv a -> VarEnv a
mapVarEnv :: (a -> b) -> VarEnv a -> VarEnv b
modifyVarEnv :: (a -> a) -> VarEnv a -> Var -> VarEnv a
isEmptyVarEnv :: VarEnv a -> Bool
lookupVarEnv :: VarEnv a -> Var -> Maybe a
filterVarEnv :: (a -> Bool) -> VarEnv a -> VarEnv a
lookupVarEnv_NF :: VarEnv a -> Var -> a
lookupWithDefaultVarEnv :: VarEnv a -> a -> Var -> a
elemVarEnv :: Var -> VarEnv a -> Bool
elemVarEnvByKey :: Unique -> VarEnv a -> Bool
disjointVarEnv :: VarEnv a -> VarEnv a -> Bool
elemVarEnv :: Var -> VarEnv a -> Bool
elemVarEnv = Var -> VarEnv a -> Bool
forall key elt. Uniquable key => key -> UniqFM elt -> Bool
elemUFM
elemVarEnvByKey :: Unique -> VarEnv a -> Bool
elemVarEnvByKey = Unique -> VarEnv a -> Bool
forall elt. Unique -> UniqFM elt -> Bool
elemUFM_Directly
disjointVarEnv :: VarEnv a -> VarEnv a -> Bool
disjointVarEnv = VarEnv a -> VarEnv a -> Bool
forall elt1 elt2. UniqFM elt1 -> UniqFM elt2 -> Bool
disjointUFM
alterVarEnv :: (Maybe a -> Maybe a) -> VarEnv a -> Var -> VarEnv a
alterVarEnv = (Maybe a -> Maybe a) -> VarEnv a -> Var -> VarEnv a
forall key elt.
Uniquable key =>
(Maybe elt -> Maybe elt) -> UniqFM elt -> key -> UniqFM elt
alterUFM
extendVarEnv :: VarEnv a -> Var -> a -> VarEnv a
extendVarEnv = VarEnv a -> Var -> a -> VarEnv a
forall key elt.
Uniquable key =>
UniqFM elt -> key -> elt -> UniqFM elt
addToUFM
extendVarEnv_C :: (a -> a -> a) -> VarEnv a -> Var -> a -> VarEnv a
extendVarEnv_C = (a -> a -> a) -> VarEnv a -> Var -> a -> VarEnv a
forall key elt.
Uniquable key =>
(elt -> elt -> elt) -> UniqFM elt -> key -> elt -> UniqFM elt
addToUFM_C
extendVarEnv_Acc :: (a -> b -> b) -> (a -> b) -> VarEnv b -> Var -> a -> VarEnv b
extendVarEnv_Acc = (a -> b -> b) -> (a -> b) -> VarEnv b -> Var -> a -> VarEnv b
forall key elt elts.
Uniquable key =>
(elt -> elts -> elts)
-> (elt -> elts) -> UniqFM elts -> key -> elt -> UniqFM elts
addToUFM_Acc
extendVarEnv_Directly :: VarEnv a -> Unique -> a -> VarEnv a
extendVarEnv_Directly = VarEnv a -> Unique -> a -> VarEnv a
forall elt. UniqFM elt -> Unique -> elt -> UniqFM elt
addToUFM_Directly
extendVarEnvList :: VarEnv a -> [(Var, a)] -> VarEnv a
extendVarEnvList = VarEnv a -> [(Var, a)] -> VarEnv a
forall key elt.
Uniquable key =>
UniqFM elt -> [(key, elt)] -> UniqFM elt
addListToUFM
plusVarEnv_C :: (a -> a -> a) -> VarEnv a -> VarEnv a -> VarEnv a
plusVarEnv_C = (a -> a -> a) -> VarEnv a -> VarEnv a -> VarEnv a
forall elt.
(elt -> elt -> elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt
plusUFM_C
plusVarEnv_CD :: (a -> a -> a) -> VarEnv a -> a -> VarEnv a -> a -> VarEnv a
plusVarEnv_CD = (a -> a -> a) -> VarEnv a -> a -> VarEnv a -> a -> VarEnv a
forall elt.
(elt -> elt -> elt)
-> UniqFM elt -> elt -> UniqFM elt -> elt -> UniqFM elt
plusUFM_CD
plusMaybeVarEnv_C :: (a -> a -> Maybe a) -> VarEnv a -> VarEnv a -> VarEnv a
plusMaybeVarEnv_C = (a -> a -> Maybe a) -> VarEnv a -> VarEnv a -> VarEnv a
forall elt.
(elt -> elt -> Maybe elt) -> UniqFM elt -> UniqFM elt -> UniqFM elt
plusMaybeUFM_C
delVarEnvList :: VarEnv a -> [Var] -> VarEnv a
delVarEnvList = VarEnv a -> [Var] -> VarEnv a
forall key elt. Uniquable key => UniqFM elt -> [key] -> UniqFM elt
delListFromUFM
delVarEnv :: VarEnv a -> Var -> VarEnv a
delVarEnv = VarEnv a -> Var -> VarEnv a
forall key elt. Uniquable key => UniqFM elt -> key -> UniqFM elt
delFromUFM
minusVarEnv :: VarEnv a -> VarEnv b -> VarEnv a
minusVarEnv = VarEnv a -> VarEnv b -> VarEnv a
forall elt1 elt2. UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1
minusUFM
intersectsVarEnv :: VarEnv a -> VarEnv a -> Bool
intersectsVarEnv e1 :: VarEnv a
e1 e2 :: VarEnv a
e2 = Bool -> Bool
not (VarEnv a -> Bool
forall a. VarEnv a -> Bool
isEmptyVarEnv (VarEnv a
e1 VarEnv a -> VarEnv a -> VarEnv a
forall elt1 elt2. UniqFM elt1 -> UniqFM elt2 -> UniqFM elt1
`intersectUFM` VarEnv a
e2))
plusVarEnv :: VarEnv a -> VarEnv a -> VarEnv a
plusVarEnv = VarEnv a -> VarEnv a -> VarEnv a
forall elt. UniqFM elt -> UniqFM elt -> UniqFM elt
plusUFM
plusVarEnvList :: [VarEnv a] -> VarEnv a
plusVarEnvList = [VarEnv a] -> VarEnv a
forall elt. [UniqFM elt] -> UniqFM elt
plusUFMList
lookupVarEnv :: VarEnv a -> Var -> Maybe a
lookupVarEnv = VarEnv a -> Var -> Maybe a
forall key elt. Uniquable key => UniqFM elt -> key -> Maybe elt
lookupUFM
filterVarEnv :: (a -> Bool) -> VarEnv a -> VarEnv a
filterVarEnv = (a -> Bool) -> VarEnv a -> VarEnv a
forall elt. (elt -> Bool) -> UniqFM elt -> UniqFM elt
filterUFM
lookupWithDefaultVarEnv :: VarEnv a -> a -> Var -> a
lookupWithDefaultVarEnv = VarEnv a -> a -> Var -> a
forall key elt. Uniquable key => UniqFM elt -> elt -> key -> elt
lookupWithDefaultUFM
mapVarEnv :: (a -> b) -> VarEnv a -> VarEnv b
mapVarEnv = (a -> b) -> VarEnv a -> VarEnv b
forall elt1 elt2. (elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2
mapUFM
mkVarEnv :: [(Var, a)] -> VarEnv a
mkVarEnv = [(Var, a)] -> VarEnv a
forall key elt. Uniquable key => [(key, elt)] -> UniqFM elt
listToUFM
mkVarEnv_Directly :: [(Unique, a)] -> VarEnv a
mkVarEnv_Directly= [(Unique, a)] -> VarEnv a
forall elt. [(Unique, elt)] -> UniqFM elt
listToUFM_Directly
emptyVarEnv :: VarEnv a
emptyVarEnv = VarEnv a
forall a. VarEnv a
emptyUFM
unitVarEnv :: Var -> a -> VarEnv a
unitVarEnv = Var -> a -> VarEnv a
forall key elt. Uniquable key => key -> elt -> UniqFM elt
unitUFM
isEmptyVarEnv :: VarEnv a -> Bool
isEmptyVarEnv = VarEnv a -> Bool
forall a. VarEnv a -> Bool
isNullUFM
lookupVarEnv_Directly :: VarEnv a -> Unique -> Maybe a
lookupVarEnv_Directly = VarEnv a -> Unique -> Maybe a
forall elt. UniqFM elt -> Unique -> Maybe elt
lookupUFM_Directly
filterVarEnv_Directly :: (Unique -> a -> Bool) -> VarEnv a -> VarEnv a
filterVarEnv_Directly = (Unique -> a -> Bool) -> VarEnv a -> VarEnv a
forall elt. (Unique -> elt -> Bool) -> UniqFM elt -> UniqFM elt
filterUFM_Directly
delVarEnv_Directly :: VarEnv a -> Unique -> VarEnv a
delVarEnv_Directly = VarEnv a -> Unique -> VarEnv a
forall elt. UniqFM elt -> Unique -> UniqFM elt
delFromUFM_Directly
partitionVarEnv :: (a -> Bool) -> VarEnv a -> (VarEnv a, VarEnv a)
partitionVarEnv = (a -> Bool) -> VarEnv a -> (VarEnv a, VarEnv a)
forall elt. (elt -> Bool) -> UniqFM elt -> (UniqFM elt, UniqFM elt)
partitionUFM
restrictVarEnv :: VarEnv a -> VarSet -> VarEnv a
restrictVarEnv env :: VarEnv a
env vs :: VarSet
vs = (Unique -> a -> Bool) -> VarEnv a -> VarEnv a
forall elt. (Unique -> elt -> Bool) -> UniqFM elt -> UniqFM elt
filterVarEnv_Directly Unique -> a -> Bool
forall p. Unique -> p -> Bool
keep VarEnv a
env
where
keep :: Unique -> p -> Bool
keep u :: Unique
u _ = Unique
u Unique -> VarSet -> Bool
`elemVarSetByKey` VarSet
vs
zipVarEnv :: [Var] -> [a] -> VarEnv a
zipVarEnv tyvars :: [Var]
tyvars tys :: [a]
tys = [(Var, a)] -> VarEnv a
forall a. [(Var, a)] -> VarEnv a
mkVarEnv (String -> [Var] -> [a] -> [(Var, a)]
forall a b. String -> [a] -> [b] -> [(a, b)]
zipEqual "zipVarEnv" [Var]
tyvars [a]
tys)
lookupVarEnv_NF :: VarEnv a -> Var -> a
lookupVarEnv_NF env :: VarEnv a
env id :: Var
id = case VarEnv a -> Var -> Maybe a
forall a. VarEnv a -> Var -> Maybe a
lookupVarEnv VarEnv a
env Var
id of
Just xx :: a
xx -> a
xx
Nothing -> String -> a
forall a. String -> a
panic "lookupVarEnv_NF: Nothing"
modifyVarEnv :: (a -> a) -> VarEnv a -> Var -> VarEnv a
modifyVarEnv mangle_fn :: a -> a
mangle_fn env :: VarEnv a
env key :: Var
key
= case (VarEnv a -> Var -> Maybe a
forall a. VarEnv a -> Var -> Maybe a
lookupVarEnv VarEnv a
env Var
key) of
Nothing -> VarEnv a
env
Just xx :: a
xx -> VarEnv a -> Var -> a -> VarEnv a
forall a. VarEnv a -> Var -> a -> VarEnv a
extendVarEnv VarEnv a
env Var
key (a -> a
mangle_fn a
xx)
modifyVarEnv_Directly :: (a -> a) -> UniqFM a -> Unique -> UniqFM a
modifyVarEnv_Directly :: (a -> a) -> UniqFM a -> Unique -> UniqFM a
modifyVarEnv_Directly mangle_fn :: a -> a
mangle_fn env :: UniqFM a
env key :: Unique
key
= case (UniqFM a -> Unique -> Maybe a
forall elt. UniqFM elt -> Unique -> Maybe elt
lookupUFM_Directly UniqFM a
env Unique
key) of
Nothing -> UniqFM a
env
Just xx :: a
xx -> UniqFM a -> Unique -> a -> UniqFM a
forall elt. UniqFM elt -> Unique -> elt -> UniqFM elt
addToUFM_Directly UniqFM a
env Unique
key (a -> a
mangle_fn a
xx)
type DVarEnv elt = UniqDFM elt
type DIdEnv elt = DVarEnv elt
type DTyVarEnv elt = DVarEnv elt
emptyDVarEnv :: DVarEnv a
emptyDVarEnv :: DVarEnv a
emptyDVarEnv = DVarEnv a
forall elt. UniqDFM elt
emptyUDFM
dVarEnvElts :: DVarEnv a -> [a]
dVarEnvElts :: DVarEnv a -> [a]
dVarEnvElts = DVarEnv a -> [a]
forall elt. UniqDFM elt -> [elt]
eltsUDFM
mkDVarEnv :: [(Var, a)] -> DVarEnv a
mkDVarEnv :: [(Var, a)] -> DVarEnv a
mkDVarEnv = [(Var, a)] -> DVarEnv a
forall key elt. Uniquable key => [(key, elt)] -> UniqDFM elt
listToUDFM
extendDVarEnv :: DVarEnv a -> Var -> a -> DVarEnv a
extendDVarEnv :: DVarEnv a -> Var -> a -> DVarEnv a
extendDVarEnv = DVarEnv a -> Var -> a -> DVarEnv a
forall key elt.
Uniquable key =>
UniqDFM elt -> key -> elt -> UniqDFM elt
addToUDFM
minusDVarEnv :: DVarEnv a -> DVarEnv a' -> DVarEnv a
minusDVarEnv :: DVarEnv a -> DVarEnv a' -> DVarEnv a
minusDVarEnv = DVarEnv a -> DVarEnv a' -> DVarEnv a
forall elt1 elt2. UniqDFM elt1 -> UniqDFM elt2 -> UniqDFM elt1
minusUDFM
lookupDVarEnv :: DVarEnv a -> Var -> Maybe a
lookupDVarEnv :: DVarEnv a -> Var -> Maybe a
lookupDVarEnv = DVarEnv a -> Var -> Maybe a
forall key elt. Uniquable key => UniqDFM elt -> key -> Maybe elt
lookupUDFM
foldDVarEnv :: (a -> b -> b) -> b -> DVarEnv a -> b
foldDVarEnv :: (a -> b -> b) -> b -> DVarEnv a -> b
foldDVarEnv = (a -> b -> b) -> b -> DVarEnv a -> b
forall elt a. (elt -> a -> a) -> a -> UniqDFM elt -> a
foldUDFM
mapDVarEnv :: (a -> b) -> DVarEnv a -> DVarEnv b
mapDVarEnv :: (a -> b) -> DVarEnv a -> DVarEnv b
mapDVarEnv = (a -> b) -> DVarEnv a -> DVarEnv b
forall elt1 elt2. (elt1 -> elt2) -> UniqDFM elt1 -> UniqDFM elt2
mapUDFM
filterDVarEnv :: (a -> Bool) -> DVarEnv a -> DVarEnv a
filterDVarEnv :: (a -> Bool) -> DVarEnv a -> DVarEnv a
filterDVarEnv = (a -> Bool) -> DVarEnv a -> DVarEnv a
forall elt. (elt -> Bool) -> UniqDFM elt -> UniqDFM elt
filterUDFM
alterDVarEnv :: (Maybe a -> Maybe a) -> DVarEnv a -> Var -> DVarEnv a
alterDVarEnv :: (Maybe a -> Maybe a) -> DVarEnv a -> Var -> DVarEnv a
alterDVarEnv = (Maybe a -> Maybe a) -> DVarEnv a -> Var -> DVarEnv a
forall key elt.
Uniquable key =>
(Maybe elt -> Maybe elt) -> UniqDFM elt -> key -> UniqDFM elt
alterUDFM
plusDVarEnv :: DVarEnv a -> DVarEnv a -> DVarEnv a
plusDVarEnv :: DVarEnv a -> DVarEnv a -> DVarEnv a
plusDVarEnv = DVarEnv a -> DVarEnv a -> DVarEnv a
forall elt. UniqDFM elt -> UniqDFM elt -> UniqDFM elt
plusUDFM
plusDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> DVarEnv a -> DVarEnv a
plusDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> DVarEnv a -> DVarEnv a
plusDVarEnv_C = (a -> a -> a) -> DVarEnv a -> DVarEnv a -> DVarEnv a
forall elt.
(elt -> elt -> elt) -> UniqDFM elt -> UniqDFM elt -> UniqDFM elt
plusUDFM_C
unitDVarEnv :: Var -> a -> DVarEnv a
unitDVarEnv :: Var -> a -> DVarEnv a
unitDVarEnv = Var -> a -> DVarEnv a
forall key elt. Uniquable key => key -> elt -> UniqDFM elt
unitUDFM
delDVarEnv :: DVarEnv a -> Var -> DVarEnv a
delDVarEnv :: DVarEnv a -> Var -> DVarEnv a
delDVarEnv = DVarEnv a -> Var -> DVarEnv a
forall key elt. Uniquable key => UniqDFM elt -> key -> UniqDFM elt
delFromUDFM
delDVarEnvList :: DVarEnv a -> [Var] -> DVarEnv a
delDVarEnvList :: DVarEnv a -> [Var] -> DVarEnv a
delDVarEnvList = DVarEnv a -> [Var] -> DVarEnv a
forall key elt.
Uniquable key =>
UniqDFM elt -> [key] -> UniqDFM elt
delListFromUDFM
isEmptyDVarEnv :: DVarEnv a -> Bool
isEmptyDVarEnv :: DVarEnv a -> Bool
isEmptyDVarEnv = DVarEnv a -> Bool
forall elt. UniqDFM elt -> Bool
isNullUDFM
elemDVarEnv :: Var -> DVarEnv a -> Bool
elemDVarEnv :: Var -> DVarEnv a -> Bool
elemDVarEnv = Var -> DVarEnv a -> Bool
forall key elt. Uniquable key => key -> UniqDFM elt -> Bool
elemUDFM
extendDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> Var -> a -> DVarEnv a
extendDVarEnv_C :: (a -> a -> a) -> DVarEnv a -> Var -> a -> DVarEnv a
extendDVarEnv_C = (a -> a -> a) -> DVarEnv a -> Var -> a -> DVarEnv a
forall key elt.
Uniquable key =>
(elt -> elt -> elt) -> UniqDFM elt -> key -> elt -> UniqDFM elt
addToUDFM_C
modifyDVarEnv :: (a -> a) -> DVarEnv a -> Var -> DVarEnv a
modifyDVarEnv :: (a -> a) -> DVarEnv a -> Var -> DVarEnv a
modifyDVarEnv mangle_fn :: a -> a
mangle_fn env :: DVarEnv a
env key :: Var
key
= case (DVarEnv a -> Var -> Maybe a
forall a. DVarEnv a -> Var -> Maybe a
lookupDVarEnv DVarEnv a
env Var
key) of
Nothing -> DVarEnv a
env
Just xx :: a
xx -> DVarEnv a -> Var -> a -> DVarEnv a
forall a. DVarEnv a -> Var -> a -> DVarEnv a
extendDVarEnv DVarEnv a
env Var
key (a -> a
mangle_fn a
xx)
partitionDVarEnv :: (a -> Bool) -> DVarEnv a -> (DVarEnv a, DVarEnv a)
partitionDVarEnv :: (a -> Bool) -> DVarEnv a -> (DVarEnv a, DVarEnv a)
partitionDVarEnv = (a -> Bool) -> DVarEnv a -> (DVarEnv a, DVarEnv a)
forall elt.
(elt -> Bool) -> UniqDFM elt -> (UniqDFM elt, UniqDFM elt)
partitionUDFM
extendDVarEnvList :: DVarEnv a -> [(Var, a)] -> DVarEnv a
extendDVarEnvList :: DVarEnv a -> [(Var, a)] -> DVarEnv a
extendDVarEnvList = DVarEnv a -> [(Var, a)] -> DVarEnv a
forall key elt.
Uniquable key =>
UniqDFM elt -> [(key, elt)] -> UniqDFM elt
addListToUDFM
anyDVarEnv :: (a -> Bool) -> DVarEnv a -> Bool
anyDVarEnv :: (a -> Bool) -> DVarEnv a -> Bool
anyDVarEnv = (a -> Bool) -> DVarEnv a -> Bool
forall elt. (elt -> Bool) -> UniqDFM elt -> Bool
anyUDFM