[saved cleanups
John Meacham <john@repetae.net>**20120117054544
 Ignore-this: b3abf61f24ac1402a2bd175d2db7cf8a
] hunk ./Makefile.am 52
-GHCLANG= -XViewPatterns -XUndecidableInstances -XOverlappingInstances -fglasgow-exts -XRecordWildCards -XRecursiveDo -XTupleSections
+GHCLANG= -XTypeFamilies -XViewPatterns -XUndecidableInstances -XOverlappingInstances -fglasgow-exts -XRecordWildCards -XRecursiveDo -XTupleSections
hunk ./src/E/Main.hs 9
+import Control.Monad.Reader
hunk ./src/E/Main.hs 15
+import Data.List
hunk ./src/E/Main.hs 19
-import E.Diff
hunk ./src/E/Main.hs 28
-import E.Subst(subst)
hunk ./src/E/Main.hs 49
-import Data.List
hunk ./src/E/Main.hs 524
-        e <- g e
-        return (tv t,e)
+        e <- return $ runReader (g e) Set.empty
+        tt <- return $ runReader (boxify (tvrType t)) Set.empty
+        return (t {tvrType = tt},e)
hunk ./src/E/Main.hs 529
-        emapEG g (return . boxify) e -- (\e -> do putStrLn ("box: " ++ pprint e) ; return $ boxify e) e
-    boxify t | Just e <- followAlias (progDataTable prog) t = boxify e
-    boxify (EPi t e) = EPi t { tvrType = boxify (tvrType t) } (boxify e)
-    boxify v@EVar {} | canBeBox v = mktBox (getType v)
-    boxify (ELit lc) = ELit lc { litArgs = map boxify (litArgs lc) }
+        emapEG g (boxify) e -- (\e -> do putStrLn ("box: " ++ pprint e) ; return $ boxify e) e
+--    boxify t | Just e <- followAlias (progDataTable prog) t = boxify e
+    boxify (EPi t e) = local (Set.insert (tvrIdent t)) $ do
+        nt <- boxify $ tvrType t
+        ne <- boxify e
+        return $ EPi t { tvrType = nt } ne
+    boxify v@(EVar vr) | canBeBox v = do
+        s <- ask
+        if tvrIdent vr `Set.member` s then return v else return $ mktBox (tvrType vr)
+    boxify (ELit lc) = do
+        na <- mapM boxify (litArgs lc)
+        return $ ELit lc { litArgs = na }
hunk ./src/E/Main.hs 542
-    boxify (EAp (ELam t b) e) = boxify (subst t e b)
+--    boxify (EAp (ELam t b) e) = boxify (subst t e b)
hunk ./src/E/Main.hs 544
-    boxify (EAp a b) = EAp (boxify a) (boxify b)
-    boxify s@ESort {} = s
+    boxify (EAp a b) = liftM2 eAp (boxify a) (boxify b)
+    boxify s@ESort {} = return s
hunk ./src/Grin/Devolve.hs 77
-data Written = Written {
-    wPotentialRoots :: Set.Set Val,
-    wIsAllocing  :: Bool
-    }
-
hunk ./src/Grin/Devolve.hs 82
-
hunk ./src/Grin/Devolve.hs 96
+--    f (BaseOp Promote vs :>>= rest) = f (Return vs :>>= rest)
+--    f (BaseOp Demote vs :>>= rest) = f (Return vs :>>= rest)
hunk ./src/Grin/Main.hs 21
+import Grin.Whiz(normalizeGrin')
hunk ./src/Grin/Main.hs 76
+ --   x <- return $ normalizeGrin x
+--    x <- return $ twiddleGrin x
hunk ./src/Util/GMap.hs 1
+{-# OPTIONS -XTypeFamilies #-}
hunk ./src/Util/SetLike.hs 1
+{-# OPTIONS -XTypeFamilies #-}