[rename values lifted to top level to suitable global names in lambda lifter
John Meacham <john@repetae.net>**20061011104535] hunk ./E/LambdaLift.hs 18
+import E.Annotate
hunk ./E/LambdaLift.hs 116
+    fm <- newIORef mempty
hunk ./E/LambdaLift.hs 119
-            let ((v',cs'),stat) = runReader (runStatT $ execUniqT 1 $ runWriterT (f v)) S { funcName = mkFuncName (tvrIdent n), topVars = wp,isStrict = True, declEnv = [] }
+            let ((v',(cs',rm)),stat) = runReader (runStatT $ execUniqT 1 $ runWriterT (f v)) S { funcName = mkFuncName (tvrIdent n), topVars = wp,isStrict = True, declEnv = [] }
hunk ./E/LambdaLift.hs 122
+            modifyIORef fm (rm `mappend`)
hunk ./E/LambdaLift.hs 210
+        tellCombinator c = tell ([c],mempty)
+        tellCombinators c = tell (c,mempty)
hunk ./E/LambdaLift.hs 218
-            tell [(t,ls,e'')]
+            t <- globalName t
+            tellCombinator (t,ls,e'')
hunk ./E/LambdaLift.hs 228
-                tell [(t,ls,e'')]
+                t <- globalName t
+                tellCombinator (t,ls,e'')
hunk ./E/LambdaLift.hs 231
+        globalName tvr | even (tvrIdent tvr) = do
+            TVr { tvrIdent = t } <- newName Unknown
+            let ntvr = tvr { tvrIdent = t }
+            tell ([],msingleton (tvrIdent tvr) (Just $ EVar ntvr))
+            return ntvr
+        globalName tvr = return tvr
hunk ./E/LambdaLift.hs 248
-            tell [(tvr,fs ++ ls,e'')]
+            tellCombinator (tvr,fs ++ ls,e'')
hunk ./E/LambdaLift.hs 268
-            tell [ (t,ls,substLet rs' e) | (t,ls,e) <- concat ts]
+            tellCombinators [ (t,ls,substLet rs' e) | (t,ls,e) <- concat ts]
hunk ./E/LambdaLift.hs 277
-    return $ prog { progCombinators =  ncs, progStats = progStats prog `mappend` nstat }
+    nz <- readIORef fm
+    annotateProgram nz (\_ nfo -> return nfo) (\_ nfo -> return nfo) (\_ nfo -> return nfo) prog { progCombinators =  ncs, progStats = progStats prog `mappend` nstat }