-uniqAway :: VarSet -> Var -> Var
--- Give the Var a new unique, different to any in the VarSet
-uniqAway set var
- | not (var `elemVarSet` set) = var -- Nothing to do
-
- | otherwise
- = try 1 (deriveUnique (getUnique var) (hashUniqSet set))
- where
- try n uniq | uniq `elemUniqSet_Directly` set = try ((n+1)::Int) (incrUnique uniq)
-#ifdef DEBUG
- | opt_PprStyle_Debug && n > 3
- = pprTrace "uniqAway:" (ppr n <+> text "tries" <+> ppr var)
- setVarUnique var uniq
-#endif
- | otherwise = setVarUnique var uniq