@@ -140,6 +140,8 @@ dumpState ist ps@(PS nm (h:hs) _ _ tm _ _ _ _ _ _ problems i _ _ ctxy _ _ _ _) =
140140 prettyPs bnd [] = empty
141141 prettyPs bnd ((n@(MN _ r), _) : bs)
142142 | r == txt "rewrite_rule" = prettyPs ((n, False):bnd) bs
143+ prettyPs bnd ((n@(MN _ _), _) : bs)
144+ | not (n `elem` freeEnvNames bs) = prettyPs bnd bs
143145 prettyPs bnd ((n, Let t v) : bs) =
144146 line <> bindingOf n False <+> text "=" <+> tPretty bnd v <+> colon <+>
145147 align (tPretty bnd t) <> prettyPs ((n, False):bnd) bs
@@ -168,6 +170,9 @@ dumpState ist ps@(PS nm (h:hs) _ _ tm _ _ _ _ _ _ problems i _ _ ctxy _ _ _ _) =
168170 text "---------- Other goals: ----------" <$$>
169171 nest nestingSize (align . cat . punctuate (text ",") . map (flip bindingOf False) $ hs)
170172
173+ freeEnvNames :: Env -> [Name]
174+ freeEnvNames = foldl (++) [] . map (\(n, b) -> freeNames (Bind n b Erased))
175+
171176lifte :: ElabState [PDecl] -> ElabD a -> Idris a
172177lifte st e = do (v, _) <- elabStep st e
173178 return v