[remove all mention of SC from code, print whole programs rather than an Eized version, make case branches vertically aligned
John Meacham <john@repetae.net>**20060207044426] hunk ./E/LambdaLift.hs 1
-module E.LambdaLift(lambdaLiftE)  where
+module E.LambdaLift(lambdaLift)  where
hunk ./E/LambdaLift.hs 11
-import DataConstructors
hunk ./E/LambdaLift.hs 14
+import E.Program
hunk ./E/LambdaLift.hs 26
--- super combinators
-data SC = SC { scMain :: TVr, scCombinators ::  [(TVr,[TVr],E)] }
-    deriving(Eq,Show)
-
-scToE :: SC -> E
-scToE (SC v ds) = ELetRec ds' (EVar v) where
-    ds' = sortLetDecls [ (t,foldr ELam e as) |  (t,as,e) <- ds]
-
-eToSC :: DataTable -> E -> SC
-eToSC _ (ELetRec ds (EVar v)) = SC v ds' where
-    ds' = [ (a,b,c) | (a,(c,b)) <- [ (t,fromLam e) | (t,e) <- ds ]]
-eToSC dt (ELetRec ds e) = SC tvr ((tvr,as,e'):ds') where
-    (e',as) = fromLam e
-    tvr = (tVr num (typeInfer dt e))
-    --num = -2
-    Just num = List.find (`notElem` [ n  | (TVr { tvrIdent = n },_) <- ds ]) [200000,200002 ..]
-    ds' = [ (a,b,c) | (a,(c,b)) <- [ (t,fromLam e) | (t,e) <- ds ]]
-eToSC dt v = SC tvr [(tvr,as,e')] where
-    (e',as) = fromLam v
-    tvr = (tVr num (typeInfer dt v))
-    num = 200000
--- eToSC (ELetRec ds v) = error $ "eToSC: " ++ show v
hunk ./E/LambdaLift.hs 27
+{-
hunk ./E/LambdaLift.hs 36
+-}
hunk ./E/LambdaLift.hs 49
-lambdaLift :: Stats -> DataTable -> SC -> IO SC
-lambdaLift stats dataTable sc = do
-    let SC m cs = sc -- flattenSC sc
+lambdaLift :: Stats -> Program -> IO Program
+lambdaLift stats prog@Program { progDataTable = dataTable, progCombinators = cs } = do
hunk ./E/LambdaLift.hs 182
-    return $ SC m ncs
+    return $ prog { progCombinators =  ncs }
hunk ./E/LambdaLift.hs 195
+{-
hunk ./E/LambdaLift.hs 200
-
+-}
hunk ./E/Show.hs 179
-                group ( nest 4 ( keyword "case" <+> scrut <+> keyword "of" <$>  (align $ sep (alts'))) )
+                group ( nest 4 ( keyword "case" <+> scrut <+> keyword "of" <$>  (align $ vcat (alts'))) )
hunk ./Main.hs 423
-    wdump FD.LambdacubeBeforeLift $ printCheckName dataTable lc
+    wdump FD.LambdacubeBeforeLift $ printProgram prog -- printCheckName dataTable lc
hunk ./Main.hs 425
-    lc <- mangle dataTable (return ()) True "LambdaLift" (lambdaLiftE finalStats dataTable) lc
-    lc <- mangle dataTable (return ()) True  "FixupLets..." (\x -> atomizeApps mempty finalStats x >>= coalesceLets finalStats)  lc
+    prog <- lambdaLift finalStats prog
+
+    --lc <- mangle dataTable (return ()) True "LambdaLift" (lambdaLiftE finalStats dataTable) lc
+
+    lc <- mangle dataTable (return ()) True  "FixupLets..." (\x -> atomizeApps mempty finalStats x >>= coalesceLets finalStats)  (programE prog)
hunk ./Main.hs 447
-    wdump FD.Lambdacube $ printCheckName dataTable (programE prog)
+    wdump FD.Lambdacube $ printProgram prog -- printCheckName dataTable (programE prog)
hunk ./Main.hs 647
+printProgram prog@Program {progCombinators = cs, progDataTable = dataTable } = do
+    sequence_ $ intersperse (putErrLn "") [ printCheckName'' dataTable v (foldr ELam e as) | (v,as,e) <- cs]
+    putErrLn $ "Entry: " ++ pprint (progMainEntry prog)
hunk ./Main.hs 651
+printCheckName'' :: DataTable -> TVr -> E -> IO ()
+printCheckName'' dataTable tvr e = do
+    let ty = case inferType dataTable [] e of
+            Left err -> vcat $ map text (intersperse "---" $ tail err)
+            Right ty -> pprint ty
+    putErrLn (render $ hang 4 (pprint tvr <+> text "::" <+> ty))
+    putErrLn (render $ hang 4 (pprint tvr <+> equals <+> pprint e))
hunk ./Makefile 66
-helloworld: jhc
+helloworld: test/HelloWorld.hs jhc
hunk ./Makefile 68
-calendar: jhc
+calendar: test/Calendar.hs jhc
hunk ./Makefile 70
-primes: jhc
+primes: test/Primes.hs jhc