[don't include empty substitutions in simplifier, replace variable of case of variable with the default binding when possible
John Meacham <john@repetae.net>**20060420030530] hunk ./E/SSimplify.hs 291
-insertSuspSubst t e env = cacheSubst env { envSubst = minsert (tvrIdent t) (susp e (envSubst env)) (envSubst env) }
+insertSuspSubst t e env = insertSuspSubst' (tvrIdent t) e env
+
hunk ./E/SSimplify.hs 294
+insertSuspSubst' 0 _e env = env
hunk ./E/SSimplify.hs 298
-insertDoneSubst t e env = cacheSubst env { envSubst = minsert (tvrIdent t) (Done e) (envSubst env) }
+insertDoneSubst t e env = insertDoneSubst' (tvrIdent t) e env
+
hunk ./E/SSimplify.hs 301
+insertDoneSubst' 0 _e env = env
hunk ./E/SSimplify.hs 304
+
+insertInScope :: Id -> Binding -> Env -> Env
+insertInScope 0 _b env = env
+insertInScope t b env = cacheSubst env { envInScope = minsert t b (envInScope env) }
+
hunk ./E/SSimplify.hs 455
-        e' <- f e (insertDoneSubst v (EVar v') . envInScope_u (minsert (tvrIdent v') NotKnown) $ inb) --        minsert (tvrIdent v) (Done $ EVar v') sub)
+        e' <- f e (insertDoneSubst v (EVar v') . insertInScope (tvrIdent v') NotKnown $ inb) --        minsert (tvrIdent v) (Done $ EVar v') sub)
hunk ./E/SSimplify.hs 509
-            g x = doCase x t b' as' d' (cacheSubst $ envInScope_u (minsert (tvrIdent b) NotKnown) inb)
+            g x = doCase x t b' as' d' (insertInScope (tvrIdent b) NotKnown inb)
hunk ./E/SSimplify.hs 539
-        d' <- f d (insertDoneSubst b (EVar b') (envInScope_u  (minsert (tvrIdent b') (isBoundTo Many e)) inb)) -- minsert (tvrIdent b) (Done (EVar b')) sub) (envInScope_u  (minsert (tvrIdent b') (isBoundTo Many e)) inb)
+        d' <- f d (insertDoneSubst b (EVar b') (insertInScope (tvrIdent b') (isBoundTo Many e) inb))
hunk ./E/SSimplify.hs 556
-        let ids = insertDoneSubst b (EVar b')
+        let ids = case e of
+                EVar v -> insertDoneSubst b (EVar b') . insertInScope (tvrIdent v) (isBoundTo Many (EVar b'))
+                _ -> insertDoneSubst b (EVar b')
hunk ./E/SSimplify.hs 561
-                newinb = fromList [ (n,na) | EVar (TVr { tvrIdent = n }) <- [e,EVar b']]
+                newinb = fromList [ (n,na) | EVar (TVr { tvrIdent = n }) <- [EVar b']]
hunk ./E/SSimplify.hs 575
-            mins (EVar v) e = envInScope_u (minsert (tvrIdent v) (isBoundTo Many e))
-            mins _ _ = id
+            --mins (EVar v) e = envInScope_u (minsert (tvrIdent v) (isBoundTo Many e))
+            mins _ e = insertInScope (tvrIdent b') (isBoundTo Many e)
+            --mins _ _ = id
hunk ./E/SSimplify.hs 708
-                w rs (cacheSubst $ envInScope_u (minsert (tvrIdent t') (isBoundTo n e')) inb)  ((t',e'):ds)
+                w rs (insertInScope (tvrIdent t') (isBoundTo n e') inb)  ((t',e'):ds)