From e1ec3aa05d7d955f8e574616b2044958bd1168f3 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 25 Oct 2023 08:09:25 -0700 Subject: [PATCH 01/68] collision example --- IR.log | 2308 +++++++++++++++++ benchmarks/AddImport.c | 93 + benchmarks/Addone.c | 76 + benchmarks/Addtwo.c | 76 + gibbon-compiler/IR.log | 3 + gibbon-compiler/examples/Addone.hs | 10 + gibbon-compiler/examples/Addtwo.hs | 10 + gibbon-compiler/examples/addimport.hs | 7 + .../src/Gibbon/Passes/ModuleRename.hs | 423 +++ 9 files changed, 3006 insertions(+) create mode 100644 IR.log create mode 100644 benchmarks/AddImport.c create mode 100644 benchmarks/Addone.c create mode 100644 benchmarks/Addtwo.c create mode 100644 gibbon-compiler/IR.log create mode 100644 gibbon-compiler/examples/Addone.hs create mode 100644 gibbon-compiler/examples/Addtwo.hs create mode 100644 gibbon-compiler/examples/addimport.hs create mode 100644 gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs diff --git a/IR.log b/IR.log new file mode 100644 index 000000000..5baf44ccb --- /dev/null +++ b/IR.log @@ -0,0 +1,2308 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 +cleaned: +module Addimport where + import Addone + import Addtwo + + + main :: Tree + main = Addtwo.add1 2 (Addtwo.add1 (Node (Leaf 1) (Leaf 2))) + +parsed: +ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 8 64, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 4 5 4 5,SrcSpan ".hs" 7 5 7 5,SrcSpan ".hs" 8 5 8 5,SrcSpan ".hs" 8 64 8 64]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 23, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 18 2 23]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 17, srcInfoPoints = []}) "Addimport") Nothing Nothing)) [] [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 18, srcInfoPoints = [SrcSpan ".hs" 3 5 3 11]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 12 3 18, srcInfoPoints = []}) "Addone", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing},ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 5 4 18, srcInfoPoints = [SrcSpan ".hs" 4 5 4 11]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 12 4 18, srcInfoPoints = []}) "Addtwo", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}] [TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 5 7 17, srcInfoPoints = [SrcSpan ".hs" 7 10 7 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 5 7 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 64, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 10 8 64, srcInfoPoints = [SrcSpan ".hs" 8 10 8 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 64, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 25, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) (Qual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) "Addtwo") (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) "add1"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 25, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 25, srcInfoPoints = []}) 2 "2"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 26 8 64, srcInfoPoints = [SrcSpan ".hs" 8 26 8 27,SrcSpan ".hs" 8 63 8 64]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 63, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) (Qual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) "Addtwo") (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 39 8 63, srcInfoPoints = [SrcSpan ".hs" 8 39 8 40,SrcSpan ".hs" 8 62 8 63]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 62, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 53, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 45 8 53, srcInfoPoints = [SrcSpan ".hs" 8 45 8 46,SrcSpan ".hs" 8 52 8 53]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 52, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 51 8 52, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 51 8 52, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 54 8 62, srcInfoPoints = [SrcSpan ".hs" 8 54 8 55,SrcSpan ".hs" 8 61 8 62]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 61, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 60 8 61, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 60 8 61, srcInfoPoints = []}) 2 "2")))))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) + +cleaned: +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) + + +parsed: +ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 12 0, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 5 5 5 5,SrcSpan ".hs" 6 5 6 5,SrcSpan ".hs" 10 5 10 5,SrcSpan ".hs" 11 5 11 5,SrcSpan ".hs" 12 1 12 0]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 20, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 15 2 20]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Addone") Nothing Nothing)) [] [] [DataDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 42, srcInfoPoints = [SrcSpan ".hs" 3 15 3 16,SrcSpan ".hs" 3 26 3 27]}) (DataType (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 9, srcInfoPoints = []})) Nothing (DHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) "Tree")) [QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 21, srcInfoPoints = []}) "Leaf") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) "Int"))]),QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 32, srcInfoPoints = []}) "Node") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) "Tree")),TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) "Tree"))])] [],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 25, srcInfoPoints = [SrcSpan ".hs" 5 10 5 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 9, srcInfoPoints = []}) "add1"] (TyFun (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 25, srcInfoPoints = [SrcSpan ".hs" 5 18 5 20]}) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) "Tree"))) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) "Tree")))),FunBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) [Match (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 6 9, srcInfoPoints = []}) "add1") [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) "t")] (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 12 8 51, srcInfoPoints = [SrcSpan ".hs" 6 12 6 13]}) (Case (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 14 8 51, srcInfoPoints = [SrcSpan ".hs" 6 14 6 18,SrcSpan ".hs" 6 21 6 23,SrcSpan ".hs" 7 13 7 13,SrcSpan ".hs" 8 13 8 13,SrcSpan ".hs" 10 5 10 0]}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) "t"))) [Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 39, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 19, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Leaf")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) "x")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 24 7 39, srcInfoPoints = [SrcSpan ".hs" 7 24 7 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) "Leaf"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 32 7 39, srcInfoPoints = [SrcSpan ".hs" 7 32 7 33,SrcSpan ".hs" 7 38 7 39]}) (InfixApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 38, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) "x"))) (QVarOp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (Symbol (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) "+"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) 1 "1")))))) Nothing,Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 51, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 23, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) "Node")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) "x1"),PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) "x2")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 51, srcInfoPoints = [SrcSpan ".hs" 8 24 8 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 51, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 41, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 32 8 41, srcInfoPoints = [SrcSpan ".hs" 8 32 8 33,SrcSpan ".hs" 8 40 8 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 40, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) "x1")))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 42 8 51, srcInfoPoints = [SrcSpan ".hs" 8 42 8 43,SrcSpan ".hs" 8 50 8 51]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 50, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) "x2"))))))) Nothing])) Nothing],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 17, srcInfoPoints = [SrcSpan ".hs" 10 10 10 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 41, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 10 11 41, srcInfoPoints = [SrcSpan ".hs" 11 10 11 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 41, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 17 11 41, srcInfoPoints = [SrcSpan ".hs" 11 17 11 18,SrcSpan ".hs" 11 40 11 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 40, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 31, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 23 11 31, srcInfoPoints = [SrcSpan ".hs" 11 23 11 24,SrcSpan ".hs" 11 30 11 31]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 30, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 32 11 40, srcInfoPoints = [SrcSpan ".hs" 11 32 11 33,SrcSpan ".hs" 11 39 11 40]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) 2 "2")))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) + +cleaned: +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) + + +parsed: +ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 12 0, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 5 5 5 5,SrcSpan ".hs" 6 5 6 5,SrcSpan ".hs" 10 5 10 5,SrcSpan ".hs" 11 5 11 5,SrcSpan ".hs" 12 1 12 0]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 20, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 15 2 20]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Addone") Nothing Nothing)) [] [] [DataDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 42, srcInfoPoints = [SrcSpan ".hs" 3 15 3 16,SrcSpan ".hs" 3 26 3 27]}) (DataType (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 9, srcInfoPoints = []})) Nothing (DHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) "Tree")) [QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 21, srcInfoPoints = []}) "Leaf") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) "Int"))]),QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 32, srcInfoPoints = []}) "Node") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) "Tree")),TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) "Tree"))])] [],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 25, srcInfoPoints = [SrcSpan ".hs" 5 10 5 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 9, srcInfoPoints = []}) "add1"] (TyFun (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 25, srcInfoPoints = [SrcSpan ".hs" 5 18 5 20]}) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) "Tree"))) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) "Tree")))),FunBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) [Match (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 6 9, srcInfoPoints = []}) "add1") [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) "t")] (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 12 8 51, srcInfoPoints = [SrcSpan ".hs" 6 12 6 13]}) (Case (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 14 8 51, srcInfoPoints = [SrcSpan ".hs" 6 14 6 18,SrcSpan ".hs" 6 21 6 23,SrcSpan ".hs" 7 13 7 13,SrcSpan ".hs" 8 13 8 13,SrcSpan ".hs" 10 5 10 0]}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) "t"))) [Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 39, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 19, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Leaf")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) "x")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 24 7 39, srcInfoPoints = [SrcSpan ".hs" 7 24 7 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) "Leaf"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 32 7 39, srcInfoPoints = [SrcSpan ".hs" 7 32 7 33,SrcSpan ".hs" 7 38 7 39]}) (InfixApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 38, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) "x"))) (QVarOp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (Symbol (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) "+"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) 1 "1")))))) Nothing,Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 51, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 23, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) "Node")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) "x1"),PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) "x2")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 51, srcInfoPoints = [SrcSpan ".hs" 8 24 8 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 51, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 41, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 32 8 41, srcInfoPoints = [SrcSpan ".hs" 8 32 8 33,SrcSpan ".hs" 8 40 8 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 40, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) "x1")))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 42 8 51, srcInfoPoints = [SrcSpan ".hs" 8 42 8 43,SrcSpan ".hs" 8 50 8 51]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 50, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) "x2"))))))) Nothing])) Nothing],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 17, srcInfoPoints = [SrcSpan ".hs" 10 10 10 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 41, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 10 11 41, srcInfoPoints = [SrcSpan ".hs" 11 10 11 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 41, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 17 11 41, srcInfoPoints = [SrcSpan ".hs" 11 17 11 18,SrcSpan ".hs" 11 40 11 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 40, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 31, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 23 11 31, srcInfoPoints = [SrcSpan ".hs" 11 23 11 24,SrcSpan ".hs" 11 30 11 31]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 30, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 32 11 40, srcInfoPoints = [SrcSpan ".hs" 11 32 11 33,SrcSpan ".hs" 11 39 11 40]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) 2 "2")))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) + +config: Config {input = Unspecified, mode = ToExe, benchInput = Nothing, arrayInput = Nothing, verbosity = 4, cc = "gcc", optc = " -O3 -flto ", cfile = Nothing, exefile = Nothing, backend = C, dynflags = DynFlags {generalFlags = fromList [], debugFlags = fromList []}, srcFile = Nothing} + + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(Tree, + DDef {tyName = "Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], + fundefs = [(add1, + FunDef {funName = "add1", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "add1" [] [VarE "x1"], + AppE "add1" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing} + + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0 = + case t_0 of + Leaf x_1::$2 -> + (Leaf $1 x_1 + 1) + Node x1_2::$4 x2_3::$5 -> + (Node $3 (add1 [] x1_2) (add1 [] x2_3)) + + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::$2 -> + (Leaf $1 x_1_5 + 1) + Node x1_2_6::$4 x2_3_7::$5 -> + (Node $3 (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, bindLambdas +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, monomorphize +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, specLambdas +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, desugarL0 +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::() -> + (Leaf () x_1_5 + 1) + Node x1_2_6::() x2_3_7::() -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17::() -> + let y_18 :: Int = x_17 in + (Leaf () y_18) + Node x_19::() x_20::() -> + let y_21 :: (Packed Tree []) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree []) = (_copy_Tree [] x_20) in + (Node () y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24::() -> + let y_25 :: Int = x_24 in + (Leaf () y_25) + Node x_26::() x_27::() -> + let y_28 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_27) in + (Node () y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: forall. ((Packed Tree []) -> ()) +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31::() -> + () + Node x_33::() x_34::() -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: forall. ((Packed Tree []) -> ()) +_print_Tree arg_37 = + case arg_37 of + Leaf x_38::() -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43::() x_44::() -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, floatOutCase +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::() -> + (Leaf () x_1_5 + 1) + Node x1_2_6::() x2_3_7::() -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17::() -> + let y_18 :: Int = x_17 in + (Leaf () y_18) + Node x_19::() x_20::() -> + let y_21 :: (Packed Tree []) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree []) = (_copy_Tree [] x_20) in + (Node () y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24::() -> + let y_25 :: Int = x_24 in + (Leaf () y_25) + Node x_26::() x_27::() -> + let y_28 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_27) in + (Node () y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: forall. ((Packed Tree []) -> ()) +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31::() -> + () + Node x_33::() x_34::() -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: forall. ((Packed Tree []) -> ()) +_print_Tree arg_37 = + case arg_37 of + Leaf x_38::() -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43::() x_44::() -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, toL1 +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, benchMainExp +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, simplify +Removed unused functions: [Var "add1"] +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55 = + case arg_16_55 of + Leaf x_17_56 -> + let y_18_57 :: Int = x_17_56 in + (Leaf y_18_57) + Node x_19_58 x_20_59 -> + let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in + let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in + (Node y_21_60 y_22_61) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62 = + case arg_23_62 of + Leaf x_24_63 -> + let y_25_64 :: Int = x_24_63 in + (Leaf y_25_64) + Node x_26_65 x_27_66 -> + let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in + let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in + (Node y_28_67 y_29_68) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69 = + case arg_30_69 of + Leaf x_31_70 -> + () + Node x_33_71 x_34_72 -> + let y_35_73 :: () = (_traverse_Tree [] x_33_71) in + let y_36_74 :: () = (_traverse_Tree [] x_34_72) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75 = + case arg_37_75 of + Leaf x_38_76 -> + let wildcard_40_77 :: () = printsym("(Leaf") in + let wildcard_42_78 :: () = printsym(" ") in + let y_39_79 :: () = printint(x_38_76) in + let wildcard_41_80 :: () = printsym(")") in + () + Node x_43_81 x_44_82 -> + let wildcard_47_83 :: () = printsym("(Node") in + let wildcard_50_84 :: () = printsym(" ") in + let y_45_85 :: () = (_print_Tree [] x_43_81) in + let wildcard_49_86 :: () = printsym(" ") in + let y_46_87 :: () = (_print_Tree [] x_44_82) in + let wildcard_48_88 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55 = + case arg_16_55 of + Leaf x_17_56 -> + let y_18_57 :: Int = x_17_56 in + (Leaf y_18_57) + Node x_19_58 x_20_59 -> + let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in + let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in + (Node y_21_60 y_22_61) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62 = + case arg_23_62 of + Leaf x_24_63 -> + let y_25_64 :: Int = x_24_63 in + (Leaf y_25_64) + Node x_26_65 x_27_66 -> + let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in + let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in + (Node y_28_67 y_29_68) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69 = + case arg_30_69 of + Leaf x_31_70 -> + () + Node x_33_71 x_34_72 -> + let y_35_73 :: () = (_traverse_Tree [] x_33_71) in + let y_36_74 :: () = (_traverse_Tree [] x_34_72) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75 = + case arg_37_75 of + Leaf x_38_76 -> + let wildcard_40_77 :: () = printsym("(Leaf") in + let wildcard_42_78 :: () = printsym(" ") in + let y_39_79 :: () = printint(x_38_76) in + let wildcard_41_80 :: () = printsym(")") in + () + Node x_43_81 x_44_82 -> + let wildcard_47_83 :: () = printsym("(Node") in + let wildcard_50_84 :: () = printsym(" ") in + let y_45_85 :: () = (_print_Tree [] x_43_81) in + let wildcard_49_86 :: () = printsym(" ") in + let y_46_87 :: () = (_print_Tree [] x_44_82) in + let wildcard_48_88 :: () = printsym(")") in + () + + + [compiler] Running pass, flatten +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55 = + case arg_16_55 of + Leaf x_17_56 -> + let y_18_57 :: Int = x_17_56 in + (Leaf y_18_57) + Node x_19_58 x_20_59 -> + let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in + let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in + (Node y_21_60 y_22_61) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62 = + case arg_23_62 of + Leaf x_24_63 -> + let y_25_64 :: Int = x_24_63 in + (Leaf y_25_64) + Node x_26_65 x_27_66 -> + let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in + let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in + (Node y_28_67 y_29_68) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69 = + case arg_30_69 of + Leaf x_31_70 -> + () + Node x_33_71 x_34_72 -> + let y_35_73 :: () = (_traverse_Tree [] x_33_71) in + let y_36_74 :: () = (_traverse_Tree [] x_34_72) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75 = + case arg_37_75 of + Leaf x_38_76 -> + let wildcard_40_77 :: () = printsym("(Leaf") in + let wildcard_42_78 :: () = printsym(" ") in + let y_39_79 :: () = printint(x_38_76) in + let wildcard_41_80 :: () = printsym(")") in + () + Node x_43_81 x_44_82 -> + let wildcard_47_83 :: () = printsym("(Node") in + let wildcard_50_84 :: () = printsym(" ") in + let y_45_85 :: () = (_print_Tree [] x_43_81) in + let wildcard_49_86 :: () = printsym(" ") in + let y_46_87 :: () = (_print_Tree [] x_44_82) in + let wildcard_48_88 :: () = printsym(")") in + () + + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + let y_18_57_91 :: Int = x_17_56_90 in + (Leaf y_18_57_91) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + let y_25_64_98 :: Int = x_24_63_97 in + (Leaf y_25_64_98) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, inlineTriv +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, directL3 +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, unariser +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.flatten +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, lower +Pass output: +================================================================================ +Prog {infoTable = [("Tree", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), + (126, " ")], + fundefs = [FunDecl {funName = "_copy_Tree", + funArgs = [(arg_16_55_89, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), + (tail_128, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_16_55_89"], + bod = Switch "switch_131" + (VarTriv "tag_127") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_56_90, + IntTy)], + ptr = "tail_128", + bod = LetAllocT {lhs = "tailift_129", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_17_56_90")], + bod = RetValsT [VarTriv "tailift_129"]}}), + (1, + LetUnpackT {binds = [(x_19_58_92, + CursorTy), + (x_20_59_93, + CursorTy)], + ptr = "tail_128", + bod = LetCallT {async = False, + binds = [(y_21_60_94, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_19_58_92"], + bod = LetCallT {async = False, + binds = [(y_22_61_95, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_20_59_93"], + bod = LetAllocT {lhs = "tailift_130", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_21_60_94"), + (CursorTy, + VarTriv "y_22_61_95")], + bod = RetValsT [VarTriv "tailift_130"]}}}})]) + (Just ErrT "Unknown tag in: tag_127")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Tree", + funArgs = [(arg_23_62_96, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), + (tail_133, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_23_62_96"], + bod = Switch "switch_136" + (VarTriv "tag_132") + (IntAlts [(0, + LetUnpackT {binds = [(x_24_63_97, + IntTy)], + ptr = "tail_133", + bod = LetAllocT {lhs = "tailift_134", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_24_63_97")], + bod = RetValsT [VarTriv "tailift_134"]}}), + (1, + LetUnpackT {binds = [(x_26_65_99, + CursorTy), + (x_27_66_100, + CursorTy)], + ptr = "tail_133", + bod = LetCallT {async = False, + binds = [(y_28_67_101, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_26_65_99"], + bod = LetCallT {async = False, + binds = [(y_29_68_102, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_27_66_100"], + bod = LetAllocT {lhs = "tailift_135", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_28_67_101"), + (CursorTy, + VarTriv "y_29_68_102")], + bod = RetValsT [VarTriv "tailift_135"]}}}})]) + (Just ErrT "Unknown tag in: tag_132")}, + isPure = True}, + FunDecl {funName = "_traverse_Tree", + funArgs = [(arg_30_69_103, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), + (tail_138, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_30_69_103"], + bod = Switch "switch_139" + (VarTriv "tag_137") + (IntAlts [(0, + LetUnpackT {binds = [(x_31_70_104, + IntTy)], + ptr = "tail_138", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_33_71_105, + CursorTy), + (x_34_72_106, + CursorTy)], + ptr = "tail_138", + bod = LetCallT {async = False, + binds = [(y_35_73_107, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_33_71_105"], + bod = LetCallT {async = False, + binds = [(y_36_74_108, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_34_72_106"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_137")}, + isPure = True}, + FunDecl {funName = "_print_Tree", + funArgs = [(arg_37_75_109, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), + (tail_141, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_37_75_109"], + bod = Switch "switch_142" + (VarTriv "tag_140") + (IntAlts [(0, + LetUnpackT {binds = [(x_38_76_110, + IntTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_40_77_111, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 125], + bod = LetPrimCallT {binds = [(wildcard_42_78_112, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetPrimCallT {binds = [(y_39_79_113, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_38_76_110"], + bod = LetPrimCallT {binds = [(wildcard_41_80_114, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_43_81_115, + CursorTy), + (x_44_82_116, + CursorTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_47_83_117, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 124], + bod = LetPrimCallT {binds = [(wildcard_50_84_118, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_45_85_119, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_43_81_115"], + bod = LetPrimCallT {binds = [(wildcard_49_86_120, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_46_87_121, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_44_82_116"], + bod = LetPrimCallT {binds = [(wildcard_48_88_122, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_140")}, + isPure = True}], + mainExp = Nothing} + + [compiler] Running pass, lateInlineTriv +Pass output: +================================================================================ +Prog {infoTable = [("Tree", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), + (126, " ")], + fundefs = [FunDecl {funName = "_copy_Tree", + funArgs = [(arg_16_55_89, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), + (tail_128, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_16_55_89"], + bod = Switch "switch_131" + (VarTriv "tag_127") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_56_90, + IntTy)], + ptr = "tail_128", + bod = LetAllocT {lhs = "tailift_129", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_17_56_90")], + bod = RetValsT [VarTriv "tailift_129"]}}), + (1, + LetUnpackT {binds = [(x_19_58_92, + CursorTy), + (x_20_59_93, + CursorTy)], + ptr = "tail_128", + bod = LetCallT {async = False, + binds = [(y_21_60_94, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_19_58_92"], + bod = LetCallT {async = False, + binds = [(y_22_61_95, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_20_59_93"], + bod = LetAllocT {lhs = "tailift_130", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_21_60_94"), + (CursorTy, + VarTriv "y_22_61_95")], + bod = RetValsT [VarTriv "tailift_130"]}}}})]) + (Just ErrT "Unknown tag in: tag_127")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Tree", + funArgs = [(arg_23_62_96, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), + (tail_133, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_23_62_96"], + bod = Switch "switch_136" + (VarTriv "tag_132") + (IntAlts [(0, + LetUnpackT {binds = [(x_24_63_97, + IntTy)], + ptr = "tail_133", + bod = LetAllocT {lhs = "tailift_134", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_24_63_97")], + bod = RetValsT [VarTriv "tailift_134"]}}), + (1, + LetUnpackT {binds = [(x_26_65_99, + CursorTy), + (x_27_66_100, + CursorTy)], + ptr = "tail_133", + bod = LetCallT {async = False, + binds = [(y_28_67_101, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_26_65_99"], + bod = LetCallT {async = False, + binds = [(y_29_68_102, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_27_66_100"], + bod = LetAllocT {lhs = "tailift_135", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_28_67_101"), + (CursorTy, + VarTriv "y_29_68_102")], + bod = RetValsT [VarTriv "tailift_135"]}}}})]) + (Just ErrT "Unknown tag in: tag_132")}, + isPure = True}, + FunDecl {funName = "_traverse_Tree", + funArgs = [(arg_30_69_103, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), + (tail_138, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_30_69_103"], + bod = Switch "switch_139" + (VarTriv "tag_137") + (IntAlts [(0, + LetUnpackT {binds = [(x_31_70_104, + IntTy)], + ptr = "tail_138", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_33_71_105, + CursorTy), + (x_34_72_106, + CursorTy)], + ptr = "tail_138", + bod = LetCallT {async = False, + binds = [(y_35_73_107, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_33_71_105"], + bod = LetCallT {async = False, + binds = [(y_36_74_108, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_34_72_106"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_137")}, + isPure = True}, + FunDecl {funName = "_print_Tree", + funArgs = [(arg_37_75_109, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), + (tail_141, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_37_75_109"], + bod = Switch "switch_142" + (VarTriv "tag_140") + (IntAlts [(0, + LetUnpackT {binds = [(x_38_76_110, + IntTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_40_77_111, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 125], + bod = LetPrimCallT {binds = [(wildcard_42_78_112, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetPrimCallT {binds = [(y_39_79_113, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_38_76_110"], + bod = LetPrimCallT {binds = [(wildcard_41_80_114, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_43_81_115, + CursorTy), + (x_44_82_116, + CursorTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_47_83_117, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 124], + bod = LetPrimCallT {binds = [(wildcard_50_84_118, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_45_85_119, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_43_81_115"], + bod = LetPrimCallT {binds = [(wildcard_49_86_120, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_46_87_121, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_44_82_116"], + bod = LetPrimCallT {binds = [(wildcard_48_88_122, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_140")}, + isPure = True}], + mainExp = Nothing} + + [compiler] Running pass, rearrangeFree +Pass output: +================================================================================ +Prog {infoTable = [("Tree", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), + (126, " ")], + fundefs = [FunDecl {funName = "_copy_Tree", + funArgs = [(arg_16_55_89, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), + (tail_128, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_16_55_89"], + bod = Switch "switch_131" + (VarTriv "tag_127") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_56_90, + IntTy)], + ptr = "tail_128", + bod = LetAllocT {lhs = "tailift_129", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_17_56_90")], + bod = RetValsT [VarTriv "tailift_129"]}}), + (1, + LetUnpackT {binds = [(x_19_58_92, + CursorTy), + (x_20_59_93, + CursorTy)], + ptr = "tail_128", + bod = LetCallT {async = False, + binds = [(y_21_60_94, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_19_58_92"], + bod = LetCallT {async = False, + binds = [(y_22_61_95, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_20_59_93"], + bod = LetAllocT {lhs = "tailift_130", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_21_60_94"), + (CursorTy, + VarTriv "y_22_61_95")], + bod = RetValsT [VarTriv "tailift_130"]}}}})]) + (Just ErrT "Unknown tag in: tag_127")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Tree", + funArgs = [(arg_23_62_96, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), + (tail_133, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_23_62_96"], + bod = Switch "switch_136" + (VarTriv "tag_132") + (IntAlts [(0, + LetUnpackT {binds = [(x_24_63_97, + IntTy)], + ptr = "tail_133", + bod = LetAllocT {lhs = "tailift_134", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_24_63_97")], + bod = RetValsT [VarTriv "tailift_134"]}}), + (1, + LetUnpackT {binds = [(x_26_65_99, + CursorTy), + (x_27_66_100, + CursorTy)], + ptr = "tail_133", + bod = LetCallT {async = False, + binds = [(y_28_67_101, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_26_65_99"], + bod = LetCallT {async = False, + binds = [(y_29_68_102, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_27_66_100"], + bod = LetAllocT {lhs = "tailift_135", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_28_67_101"), + (CursorTy, + VarTriv "y_29_68_102")], + bod = RetValsT [VarTriv "tailift_135"]}}}})]) + (Just ErrT "Unknown tag in: tag_132")}, + isPure = True}, + FunDecl {funName = "_traverse_Tree", + funArgs = [(arg_30_69_103, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), + (tail_138, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_30_69_103"], + bod = Switch "switch_139" + (VarTriv "tag_137") + (IntAlts [(0, + LetUnpackT {binds = [(x_31_70_104, + IntTy)], + ptr = "tail_138", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_33_71_105, + CursorTy), + (x_34_72_106, + CursorTy)], + ptr = "tail_138", + bod = LetCallT {async = False, + binds = [(y_35_73_107, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_33_71_105"], + bod = LetCallT {async = False, + binds = [(y_36_74_108, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_34_72_106"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_137")}, + isPure = True}, + FunDecl {funName = "_print_Tree", + funArgs = [(arg_37_75_109, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), + (tail_141, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_37_75_109"], + bod = Switch "switch_142" + (VarTriv "tag_140") + (IntAlts [(0, + LetUnpackT {binds = [(x_38_76_110, + IntTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_40_77_111, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 125], + bod = LetPrimCallT {binds = [(wildcard_42_78_112, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetPrimCallT {binds = [(y_39_79_113, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_38_76_110"], + bod = LetPrimCallT {binds = [(wildcard_41_80_114, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_43_81_115, + CursorTy), + (x_44_82_116, + CursorTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_47_83_117, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 124], + bod = LetPrimCallT {binds = [(wildcard_50_84_118, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_45_85_119, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_43_81_115"], + bod = LetPrimCallT {binds = [(wildcard_49_86_120, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_46_87_121, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_44_82_116"], + bod = LetPrimCallT {binds = [(wildcard_48_88_122, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_140")}, + isPure = True}], + mainExp = Nothing} + + [compiler] Final C codegen: 8787 characters. +================================================================================ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +typedef struct GibIntGibIntProd_struct { + GibInt field0; + GibInt field1; + } GibIntGibIntProd; +typedef struct GibIntGibCursorGibCursorProd_struct { + GibInt field0; + GibCursor field1; + GibCursor field2; + } GibIntGibCursorGibCursorProd; +typedef struct GibPackedTagGibCursorProd_struct { + GibPackedTag field0; + GibCursor field1; + } GibPackedTagGibCursorProd; +typedef struct GibCursorProd_struct { + GibCursor field0; + } GibCursorProd; +typedef struct GibCursorGibCursorProd_struct { + GibCursor field0; + GibCursor field1; + } GibCursorGibCursorProd; +GibCursor _copy_Tree(GibCursor arg_16_55_89); +GibCursor _copy_without_ptrs_Tree(GibCursor arg_23_62_96); +unsigned char _traverse_Tree(GibCursor arg_30_69_103); +unsigned char _print_Tree(GibCursor arg_37_75_109); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + Tree_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(8); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[1]; + + error = gib_info_table_insert_packed_dcon(Tree_T, 0, 8, 0, 1, 0, field_tys, + 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Tree_T, 0); + exit(1); + } + error = gib_info_table_insert_packed_dcon(Tree_T, 1, 0, 2, 0, 0, field_tys, + 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Tree_T, 1); + exit(1); + } + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ + gib_add_symbol(123, ")"); + gib_add_symbol(124, "(Node"); + gib_add_symbol(125, "(Leaf"); + gib_add_symbol(126, " "); +} +GibCursor _copy_Tree(GibCursor arg_16_55_89) +{ + GibPackedTag tag_127 = *(GibPackedTag *) arg_16_55_89; + GibCursor tail_128 = arg_16_55_89 + sizeof(GibInt); + + + switch_131: + ; + switch (tag_127) { + + case 0: + { + GibInt x_17_56_90 = ((GibIntProd *) tail_128)->field0; + GibPtr tailift_129 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_129)->field0 = 0; + ((GibIntGibIntProd *) tailift_129)->field1 = x_17_56_90; + return tailift_129; + break; + } + + case 1: + { + GibCursor x_19_58_92 = + ((GibCursorGibCursorProd *) tail_128)->field0; + GibCursor x_20_59_93 = + ((GibCursorGibCursorProd *) tail_128)->field1; + GibCursor y_21_60_94 = _copy_Tree(x_19_58_92); + GibCursor y_22_61_95 = _copy_Tree(x_20_59_93); + GibPtr tailift_130 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_130)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_130)->field1 = y_21_60_94; + ((GibIntGibCursorGibCursorProd *) tailift_130)->field2 = y_22_61_95; + return tailift_130; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_127"); + exit(1); + } + } +} +GibCursor _copy_without_ptrs_Tree(GibCursor arg_23_62_96) +{ + GibPackedTag tag_132 = *(GibPackedTag *) arg_23_62_96; + GibCursor tail_133 = arg_23_62_96 + sizeof(GibInt); + + + switch_136: + ; + switch (tag_132) { + + case 0: + { + GibInt x_24_63_97 = ((GibIntProd *) tail_133)->field0; + GibPtr tailift_134 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_134)->field0 = 0; + ((GibIntGibIntProd *) tailift_134)->field1 = x_24_63_97; + return tailift_134; + break; + } + + case 1: + { + GibCursor x_26_65_99 = + ((GibCursorGibCursorProd *) tail_133)->field0; + GibCursor x_27_66_100 = + ((GibCursorGibCursorProd *) tail_133)->field1; + GibCursor y_28_67_101 = _copy_without_ptrs_Tree(x_26_65_99); + GibCursor y_29_68_102 = _copy_without_ptrs_Tree(x_27_66_100); + GibPtr tailift_135 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_135)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_135)->field1 = + y_28_67_101; + ((GibIntGibCursorGibCursorProd *) tailift_135)->field2 = + y_29_68_102; + return tailift_135; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_132"); + exit(1); + } + } +} +unsigned char _traverse_Tree(GibCursor arg_30_69_103) +{ + GibPackedTag tag_137 = *(GibPackedTag *) arg_30_69_103; + GibCursor tail_138 = arg_30_69_103 + sizeof(GibInt); + + + switch_139: + ; + switch (tag_137) { + + case 0: + { + GibInt x_31_70_104 = ((GibIntProd *) tail_138)->field0; + + return 0; + break; + } + + case 1: + { + GibCursor x_33_71_105 = + ((GibCursorGibCursorProd *) tail_138)->field0; + GibCursor x_34_72_106 = + ((GibCursorGibCursorProd *) tail_138)->field1; + unsigned char y_35_73_107 = _traverse_Tree(x_33_71_105); + unsigned char y_36_74_108 = _traverse_Tree(x_34_72_106); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_137"); + exit(1); + } + } +} +unsigned char _print_Tree(GibCursor arg_37_75_109) +{ + GibPackedTag tag_140 = *(GibPackedTag *) arg_37_75_109; + GibCursor tail_141 = arg_37_75_109 + sizeof(GibInt); + + + switch_142: + ; + switch (tag_140) { + + case 0: + { + GibInt x_38_76_110 = ((GibIntProd *) tail_141)->field0; + unsigned char wildcard_40_77_111 = gib_print_symbol(125); + unsigned char wildcard_42_78_112 = gib_print_symbol(126); + unsigned char y_39_79_113 = printf("%ld", x_38_76_110); + unsigned char wildcard_41_80_114 = gib_print_symbol(123); + + return 0; + break; + } + + case 1: + { + GibCursor x_43_81_115 = + ((GibCursorGibCursorProd *) tail_141)->field0; + GibCursor x_44_82_116 = + ((GibCursorGibCursorProd *) tail_141)->field1; + unsigned char wildcard_47_83_117 = gib_print_symbol(124); + unsigned char wildcard_50_84_118 = gib_print_symbol(126); + unsigned char y_45_85_119 = _print_Tree(x_43_81_115); + unsigned char wildcard_49_86_120 = gib_print_symbol(126); + unsigned char y_46_87_121 = _print_Tree(x_44_82_116); + unsigned char wildcard_48_88_122 = gib_print_symbol(123); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_140"); + exit(1); + } + } +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + int exit_1 = gib_exit(); + + return exit_1; +} + +Compiling RTS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +make: Nothing to be done for 'all'. + + + + +Compiling the program +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng + + + +In file included from /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.c:3:0: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] + #warning "Simple write barrier is disabled." + ^~~~~~~ + + diff --git a/benchmarks/AddImport.c b/benchmarks/AddImport.c new file mode 100644 index 000000000..59ad8c64e --- /dev/null +++ b/benchmarks/AddImport.c @@ -0,0 +1,93 @@ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +GibInt add1(GibInt x_1_10_13); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(7); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[0]; + + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ } +GibInt add1(GibInt x_1_10_13) +{ + GibInt flt_15 = x_1_10_13 + 1; + + return flt_15; +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + GibInt fltAppE_11_12 = add1(0); + GibInt tmp_app_14 = add1(fltAppE_11_12); + + printf("%ld", tmp_app_14); + printf("\n"); + return 0; + + int exit_1 = gib_exit(); + + return exit_1; +} \ No newline at end of file diff --git a/benchmarks/Addone.c b/benchmarks/Addone.c new file mode 100644 index 000000000..bb458c5cc --- /dev/null +++ b/benchmarks/Addone.c @@ -0,0 +1,76 @@ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(7); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[0]; + + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ } +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + int exit_1 = gib_exit(); + + return exit_1; +} \ No newline at end of file diff --git a/benchmarks/Addtwo.c b/benchmarks/Addtwo.c new file mode 100644 index 000000000..bb458c5cc --- /dev/null +++ b/benchmarks/Addtwo.c @@ -0,0 +1,76 @@ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(7); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[0]; + + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ } +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + int exit_1 = gib_exit(); + + return exit_1; +} \ No newline at end of file diff --git a/gibbon-compiler/IR.log b/gibbon-compiler/IR.log new file mode 100644 index 000000000..359ac2ee4 --- /dev/null +++ b/gibbon-compiler/IR.log @@ -0,0 +1,3 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 +gibbon: /home/timmy/git/gibbon/gibbon-compiler/./examples/addone.hs: openFile: does not exist (No such file or directory) diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs new file mode 100644 index 000000000..d8060f609 --- /dev/null +++ b/gibbon-compiler/examples/Addone.hs @@ -0,0 +1,10 @@ +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs new file mode 100644 index 000000000..d8060f609 --- /dev/null +++ b/gibbon-compiler/examples/Addtwo.hs @@ -0,0 +1,10 @@ +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs new file mode 100644 index 000000000..008bce52d --- /dev/null +++ b/gibbon-compiler/examples/addimport.hs @@ -0,0 +1,7 @@ +module Addimport where + import Addone + import Addtwo + + + main :: Tree + main = Addtwo.add1 2 (Addtwo.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs new file mode 100644 index 000000000..d72d735df --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -0,0 +1,423 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} + +-- | Unique names. + +module Gibbon.Passes.ModuleRename (renameNames) where + +import Gibbon.Pretty + +import Control.Exception +import Data.Foldable ( foldrM ) +import Prelude hiding (exp) +import qualified Data.List as L +import qualified Data.Map as M + +import Gibbon.Common +import Gibbon.L0.Syntax +import qualified Gibbon.L1.Syntax as L1 + +-------------------------------------------------------------------------------- + +type VarEnv = M.Map Var Var +type TyVarEnv t = M.Map TyVar t + +renameNames :: Prog0 -> PassM Prog0 +renameNames (Prog defs funs main) = + let _ = dbgPrintLn 2 (show defs) + in + do main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- freshExp M.empty M.empty m + return $ Just (m',ty) + defs' <- traverse freshDDef defs + funs' <- M.mapKeys cleanFunName <$> traverse freshFun funs + return $ Prog defs' funs' main' + +freshDDef :: DDef Ty0 -> PassM (DDef Ty0) +freshDDef DDef{tyName,tyArgs,dataCons} = do + rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tyArgs + let env :: TyVarEnv Ty0 + env = M.fromList $ zip tyArgs (map TyVar rigid_tyvars) + dataCons' <- mapM (\(dcon,vs) -> (dcon,) <$> mapM (go (sdoc (dcon,vs)) rigid_tyvars env) vs) dataCons + pure (DDef tyName rigid_tyvars dataCons') + where + go :: String -> [TyVar] -> TyVarEnv Ty0 -> (t, Ty0) -> PassM (t, Ty0) + go msg bound env (b, ty) = do + (_, ty') <- freshTy env ty + let free_tvs = tyVarsInTy ty' L.\\ bound + if free_tvs == [] + then pure (b, ty') + else error $ "freshDDef: Unbound type variables " ++ sdoc free_tvs + ++ " in the constructor:\n" ++ msg + +freshFun :: FunDef Exp0 -> PassM (FunDef Exp0) +freshFun (FunDef nam nargs funty bod meta) = + do nargs' <- mapM gensym nargs + let msubst = (M.fromList $ zip nargs nargs') + (tvenv, funty') <- freshTyScheme funty + funty'' <- freshDictTyScheme msubst funty' + bod' <- freshExp msubst tvenv bod + let nam' = cleanFunName nam + pure $ FunDef nam' nargs' funty'' bod' meta + +-- +freshTyScheme :: TyScheme -> PassM (TyVarEnv Ty0, TyScheme) +freshTyScheme (ForAll tvs ty) = do + rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tvs + let env = M.fromList $ zip tvs (map TyVar rigid_tyvars) + (env', ty') <- freshTy env ty + pure (env', ForAll rigid_tyvars ty') + +freshTy :: TyVarEnv Ty0 -> Ty0 -> PassM (TyVarEnv Ty0, Ty0) +freshTy env ty = + case ty of + IntTy -> pure (env, ty) + CharTy -> pure (env, ty) + FloatTy -> pure (env, ty) + SymTy0 -> pure (env, ty) + BoolTy -> pure (env, ty) + ArenaTy -> pure (env, ty) + SymSetTy -> pure (env, ty) + SymHashTy -> pure (env, ty) + TyVar tv -> case M.lookup tv env of + Nothing -> do tv' <- newTyVar + pure (env, TyVar tv') + Just tv' -> pure (env, tv') + MetaTv{} -> pure (env, ty) + ProdTy tys -> do (env', tys') <- freshTys env tys + pure (env', ProdTy tys') + SymDictTy v t -> do (env', t') <- freshTy env t + pure (env', SymDictTy v t') + PDictTy k v -> do (env', k') <- freshTy env k + (env'', v') <- freshTy env' v + pure (env'', PDictTy k' v') + ArrowTy tys t -> do (env', tys') <- freshTys env tys + (env'', [t']) <- freshTys env' [t] + pure (env'', ArrowTy tys' t') + PackedTy tycon tys -> do (env', tys') <- freshTys env tys + pure (env', PackedTy tycon tys') + VectorTy el_t -> do (env', el_t') <- freshTy env el_t + pure (env', VectorTy el_t') + ListTy el_t -> do (env', el_t') <- freshTy env el_t + pure (env', ListTy el_t') + IntHashTy -> pure (env, ty) + +freshTys :: TyVarEnv (TyOf Exp0) -> [Ty0] -> PassM (TyVarEnv (TyOf Exp0), [Ty0]) +freshTys env tys = + foldrM + (\t (env', acc) -> do + (env'', t') <- freshTy env' t + pure (env' <> env'', t' : acc)) + (env, []) + tys + +freshDictTy :: Monad m => M.Map Var Var -> Ty0 -> m Ty0 +freshDictTy m ty = + case ty of + IntTy -> pure ty + CharTy -> pure ty + FloatTy -> pure ty + SymTy0 -> pure ty + BoolTy -> pure ty + ArenaTy -> pure ty + TyVar _tv -> pure ty + MetaTv{} -> pure ty + ProdTy tys -> + do tys' <- mapM (freshDictTy m) tys + pure (ProdTy tys') + SymDictTy (Just v) t -> + do t' <- freshDictTy m t + case M.lookup v m of + Just v' -> pure $ SymDictTy (Just v') t' + Nothing -> pure ty + SymDictTy Nothing t -> + do t' <- freshDictTy m t + pure $ SymDictTy Nothing t' + PDictTy k v -> + do k' <- freshDictTy m k + v' <- freshDictTy m v + pure $ PDictTy k' v' + ArrowTy tys t -> + do tys' <- mapM (freshDictTy m) tys + t' <- freshDictTy m t + pure $ ArrowTy tys' t' + PackedTy tycon tys -> + do tys' <- mapM (freshDictTy m) tys + pure $ PackedTy tycon tys' + VectorTy el_t -> + do el_t' <- freshDictTy m el_t + pure $ VectorTy el_t' + ListTy el_t -> + do el_t' <- freshDictTy m el_t + pure $ ListTy el_t' + SymSetTy -> pure ty + SymHashTy -> pure ty + IntHashTy -> pure ty + +freshDictTyScheme :: Monad m => + M.Map Var Var -> TyScheme -> m TyScheme +freshDictTyScheme m (ForAll tvs ty) = + do ty' <- freshDictTy m ty + pure $ ForAll tvs ty' + +freshExp :: VarEnv -> TyVarEnv Ty0 -> Exp0 -> PassM Exp0 +freshExp venv tvenv exp = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + + VarE v -> + case M.lookup v venv of + Nothing -> return $ VarE (cleanFunName v) + Just v' -> return $ VarE (cleanFunName v') + + AppE v locs ls -> assert ([] == locs) $ do + ls' <- mapM go ls + case M.lookup v venv of + Nothing -> return $ AppE (cleanFunName v) [] ls' + Just v' -> return $ AppE (cleanFunName v') [] ls' + + PrimAppE p es -> do + es' <- mapM go es + return $ PrimAppE p es' + + LetE (v,_locs,ty, e1) e2 -> do + let user_tvs = filter isUserTv $ tyVarsInTy ty + rigid_tyvars <- mapM (\(UserTv w) -> + case M.lookup (UserTv w) tvenv of + Just (TyVar tv) -> pure tv + Just oth -> error $ "freshExp: UserTv bound to: " ++ sdoc oth + Nothing -> BoundTv <$> gensym w) + user_tvs + let env = M.fromList $ zip user_tvs (map TyVar rigid_tyvars) + tvenv' = env <> tvenv + + (_tvenv'', ty') <- freshTy tvenv' ty + e1' <- freshExp venv tvenv' e1 + v' <- gensym (cleanFunName v) + e2' <- freshExp (M.insert v v' venv) tvenv e2 + ty'' <- case ty' of + SymDictTy (Just w) ty2 -> case M.lookup w venv of + Nothing -> return ty' + Just w' -> return $ SymDictTy (Just w') ty2 + _ -> return ty' + return $ LetE (v',[],ty'',e1') e2' + + IfE e1 e2 e3 -> do + e1' <- go e1 + e2' <- go e2 + e3' <- go e3 + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- go e + return $ ProjE i e' + + MkProdE es -> do + es' <- mapM go es + return $ MkProdE es' + + CaseE e mp -> do + e' <- go e + mp' <- mapM (\(c,prs,ae) -> do + let (args,locs) = unzip prs + args' <- mapM gensym args + let venv' = M.fromList (zip args args') `M.union` venv + ae' <- freshExp venv' tvenv ae + return (c, zip args' locs, ae')) mp + return $ CaseE e' mp' + + DataConE loc c es -> do + es' <- mapM go es + return $ DataConE loc c es' + + TimeIt e t b -> do + e' <- go e + return $ TimeIt e' t b + + WithArenaE v e -> do + v' <- gensym v + e' <- freshExp (M.insert v v' venv) tvenv e + return $ WithArenaE v' e' + + SpawnE v locs ls -> assert ([] == locs) $ do + ls' <- mapM go ls + case M.lookup v venv of + Nothing -> return $ SpawnE (cleanFunName v) [] ls' + Just v' -> return $ SpawnE (cleanFunName v') [] ls' + + SyncE -> pure SyncE + + MapE (v,t,b) e -> do + b' <- go b + e' <- go e + return $ MapE (v,t,b') e' + + FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do + e1' <- go e1 + e2' <- go e2 + e3' <- go e3 + return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' + + -- Ext ext -> Ext <$> gFreshenExp venv tvenv ext + + Ext ext -> + case ext of + LambdaE args bod -> do + (venv', vs, ts) <- foldrM + (\(v,t) (acc1, acc2, acc3) -> do + v' <- gensym v + let acc1' = M.insert v v' acc1 + (_tvenv', t') <- freshTy tvenv t + pure (acc1', v':acc2, t': acc3)) + (venv,[],[]) args + Ext <$> (LambdaE (zip vs ts) <$> (freshExp venv' tvenv bod)) + FunRefE tyapps f -> + case M.lookup f venv of + Nothing -> pure $ Ext $ FunRefE tyapps (cleanFunName f) + Just f' -> pure $ Ext $ FunRefE tyapps (cleanFunName f') + PolyAppE{} -> error "freshExp: TODO, PolyAppE." + + BenchE fn tyapps args b -> do + args' <- mapM go args + pure $ Ext (BenchE (cleanFunName fn) tyapps args' b) + + ParE0 ls -> Ext <$> ParE0 <$> mapM go ls + L p e -> Ext <$> (L p) <$> go e + PrintPacked ty arg -> do + (tvenv', ty') <- freshTy tvenv ty + arg' <- freshExp venv tvenv' arg + pure $ Ext $ PrintPacked ty' arg' + CopyPacked ty arg -> do + (tvenv', ty') <- freshTy tvenv ty + arg' <- freshExp venv tvenv' arg + pure $ Ext $ CopyPacked ty' arg' + TravPacked ty arg -> do + (tvenv', ty') <- freshTy tvenv ty + arg' <- freshExp venv tvenv' arg + pure $ Ext $ TravPacked ty' arg' + LinearExt{} -> error $ "freshenExp: a linear types extension wasn't desugared: " ++ sdoc exp + + where go = freshExp venv tvenv + + +-- copy-paste. + +freshNames1 :: L1.Prog1 -> PassM L1.Prog1 +freshNames1 (L1.Prog defs funs main) = + do main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- freshExp1 M.empty m + return $ Just (m',ty) + funs' <- traverse freshFun1 funs + return $ L1.Prog defs funs' main' + +freshFun1 :: L1.FunDef1 -> PassM L1.FunDef1 +freshFun1 (FunDef nam nargs (targ,ty) bod meta) = do + nargs' <- mapM gensym nargs + let msubst = (M.fromList $ zip nargs nargs') + bod' <- freshExp1 msubst bod + -- let nam' = cleanFunName nam + return $ FunDef nam nargs' (targ,ty) bod' meta + + +freshExp1 :: VarEnv -> L1.Exp1 -> PassM L1.Exp1 +freshExp1 vs exp = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + + VarE v -> + case M.lookup v vs of + Nothing -> return $ VarE v + Just v' -> return $ VarE v' + + AppE v locs ls -> assert ([] == locs) $ do + ls' <- mapM (freshExp1 vs) ls + case M.lookup v vs of + Nothing -> return $ AppE (cleanFunName v) [] ls' + Just v' -> return $ AppE (cleanFunName v') [] ls' + + PrimAppE p es -> do + es' <- mapM (freshExp1 vs) es + return $ PrimAppE p es' + + LetE (v,locs,t, e1) e2 -> assert ([]==locs) $ do + e1' <- freshExp1 vs e1 + v' <- gensym v + e2' <- freshExp1 (M.insert v v' vs) e2 + return $ LetE (v',[],t,e1') e2' + + IfE e1 e2 e3 -> do + e1' <- freshExp1 vs e1 + e2' <- freshExp1 vs e2 + e3' <- freshExp1 vs e3 + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- freshExp1 vs e + return $ ProjE i e' + + MkProdE es -> do + es' <- mapM (freshExp1 vs) es + return $ MkProdE es' + + CaseE e mp -> do + e' <- freshExp1 vs e + -- Here we freshen locations: + mp' <- mapM (\(c,prs,ae) -> + let (args,_) = unzip prs in + do + args' <- mapM gensym args + let vs' = (M.fromList $ zip args args') `M.union` vs + ae' <- freshExp1 vs' ae + return (c, map (,()) args', ae')) mp + return $ CaseE e' mp' + + DataConE () c es -> do + es' <- mapM (freshExp1 vs) es + return $ DataConE () c es' + + TimeIt e t b -> do + e' <- freshExp1 vs e + return $ TimeIt e' t b + + SpawnE v locs ls -> assert ([] == locs) $ do + ls' <- mapM (freshExp1 vs) ls + case M.lookup v vs of + Nothing -> return $ SpawnE (cleanFunName v) [] ls' + Just v' -> return $ SpawnE (cleanFunName v') [] ls' + + SyncE -> pure SyncE + + MapE (v,t,b) e -> do + b' <- freshExp1 vs b + e' <- freshExp1 vs e + return $ MapE (v,t,b') e' + + FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do + e1' <- freshExp1 vs e1 + e2' <- freshExp1 vs e2 + e3' <- freshExp1 vs e3 + return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' + + WithArenaE{} -> error "freshExp1: WithArenaE not handled." + + Ext (L1.BenchE fn tyapps args b) -> do + args' <- mapM (freshExp1 vs) args + pure $ Ext (L1.BenchE (cleanFunName fn) tyapps args' b) + + Ext (L1.StartOfPkdCursor cur) -> do + case M.lookup cur vs of + Nothing -> return $ Ext $ L1.StartOfPkdCursor cur + Just v' -> return $ Ext $ L1.StartOfPkdCursor v' + + Ext (L1.AddFixed v i) -> do + case M.lookup v vs of + Nothing -> return $ Ext $ L1.AddFixed v i + Just v' -> return $ Ext $ L1.AddFixed v' i From 4e81af39202f74ae9af62dbed5db5bcf9de45d51 Mon Sep 17 00:00:00 2001 From: timmy Date: Fri, 27 Oct 2023 10:58:02 -0700 Subject: [PATCH 02/68] repeatable module import collisions --- gibbon-compiler/examples/Addone.hs | 4 ++-- gibbon-compiler/examples/Addtwo.hs | 4 ++-- gibbon-compiler/examples/addimport.hs | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs index d8060f609..4f0a37bec 100644 --- a/gibbon-compiler/examples/Addone.hs +++ b/gibbon-compiler/examples/Addone.hs @@ -1,8 +1,8 @@ module Addone where data Tree = Leaf Int | Node Tree Tree - add1 :: Tree -> Tree - add1 t = case t of + add/1 :: Tree -> Tree + add/1 t = case t of Leaf x -> Leaf (x + 1) Node x1 x2 -> Node (add1 x1) (add1 x2) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs index d8060f609..fe8682516 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/Addtwo.hs @@ -1,7 +1,7 @@ -module Addone where +module Addtwo where data Tree = Leaf Int | Node Tree Tree - add1 :: Tree -> Tree + add/1 :: Tree -> Tree add1 t = case t of Leaf x -> Leaf (x + 1) Node x1 x2 -> Node (add1 x1) (add1 x2) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index 008bce52d..f366dff69 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,7 +1,5 @@ module Addimport where import Addone - import Addtwo - main :: Tree - main = Addtwo.add1 2 (Addtwo.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + main = Addone.add1 2 (Addone.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file From a2deafbc5de2202e4374bb4cb3e2fc5e38418578 Mon Sep 17 00:00:00 2001 From: timmy Date: Mon, 6 Nov 2023 06:38:57 -0800 Subject: [PATCH 03/68] declaration renaming works --- gibbon-compiler/build.log | 8 +++ gibbon-compiler/compile.log | 7 +++ gibbon-compiler/examples/add1.hs | 7 ++- gibbon-compiler/ir.log | 62 +++++++++++++++++++ gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 16 +++-- gibbon-compiler/src/Gibbon/Language/Syntax.hs | 1 + 6 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 gibbon-compiler/build.log create mode 100644 gibbon-compiler/compile.log create mode 100644 gibbon-compiler/ir.log diff --git a/gibbon-compiler/build.log b/gibbon-compiler/build.log new file mode 100644 index 000000000..cb9f8de35 --- /dev/null +++ b/gibbon-compiler/build.log @@ -0,0 +1,8 @@ +Build profile: -w ghc-9.2.8 -O1 +In order, the following will be built (use -v for more details): + - gibbon-0.3 (lib) (file src/Gibbon/Language/Syntax.hs changed) + - gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) + - gibbon-0.3 (exe:gibbon) (dependency rebuilt) +Preprocessing library for gibbon-0.3.. +Building library for gibbon-0.3.. +[16 of 61] Compiling Gibbon.NewL2.Syntax ( src/Gibbon/NewL2/Syntax.hs, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.o, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.dyn_o ) [Gibbon.Language.Syntax changed] diff --git a/gibbon-compiler/compile.log b/gibbon-compiler/compile.log new file mode 100644 index 000000000..7db011525 --- /dev/null +++ b/gibbon-compiler/compile.log @@ -0,0 +1,7 @@ +Build profile: -w ghc-9.2.8 -O1 +In order, the following will be built (use -v for more details): + - gibbon-0.3 (lib) (file src/Gibbon/HaskellFrontend.hs changed) + - gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) + - gibbon-0.3 (exe:gibbon) (dependency rebuilt) +Preprocessing library for gibbon-0.3.. +Building library for gibbon-0.3.. diff --git a/gibbon-compiler/examples/add1.hs b/gibbon-compiler/examples/add1.hs index b31d41695..d7bf4a5b7 100644 --- a/gibbon-compiler/examples/add1.hs +++ b/gibbon-compiler/examples/add1.hs @@ -1,9 +1,10 @@ +module Add where data Tree = Leaf Int | Node Tree Tree add1 :: Tree -> Tree add1 t = case t of Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) + Node x1 x2 -> Node (Add.add1 x1) (Add.add1 x2) -main :: Tree -main = add1 (Node (Leaf 1) (Leaf 2)) +gibbon_main :: Tree +gibbon_main = Add.add1 (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log new file mode 100644 index 000000000..654f12b2f --- /dev/null +++ b/gibbon-compiler/ir.log @@ -0,0 +1,62 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(Tree, + DDef {tyName = "Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], + fundefs = [(add1, + FunDef {funName = "Add.add1", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Add.add1" [] [VarE "x1"], + AppE "Add.add1" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (AppE "Add.add1" + [] + [DataConE (MetaTv $6) + "Node" + [DataConE (MetaTv $7) "Leaf" [LitE 1], + DataConE (MetaTv $8) "Leaf" [LitE 2]]], + MetaTv $9)} + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +Add_add1 t_10 = + case t_10 of + Leaf x_11::$2 -> + (Leaf $1 x_11 + 1) + Node x1_12::$4 x2_13::$5 -> + (Node $3 (Add_add1 [] x1_12) (Add_add1 [] x2_13)) + +gibbon_main :: $9 +gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) + + [compiler] Running pass, typecheck +gibbon: L0.Typecheck: + Unknown function: Add_add1 in Var "Add_add1" +CallStack (from HasCallStack): + error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 88a5730b0..b8bf23e6c 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,7 +200,9 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = + funs' = M.map (\funDef -> funDef {funName = toVar (mod_name ++ "." ++ (fromVar (funName funDef))) }) funs -- can insert function name here + --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here + funs'' = foldr (\v acc -> M.update @@ -208,18 +210,18 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports Just (fn {funMeta = funMeta {funInline = Inline}})) v acc) - funs + funs' inlines - funs'' = + funs''' = foldr (\v acc -> M.update (\fn -> Just (addLayoutMetaData fn optimizeDcons)) v acc) - funs' + funs'' (P.map fst (S.toList optimizeDcons)) - funs''' = + funs'''' = foldr (\k acc -> M.update @@ -234,7 +236,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports })) k acc) - funs'' + funs''' (M.keys userOrderings') imported_progs' <- mapM id imported_progs let (defs0, funs0) = @@ -1575,6 +1577,7 @@ desugarFun :: desugarFun type_syns toplevel env decl = case decl of FunBind _ [Match _ fname pats (UnGuardedRhs _ bod) _where] -> do + -- where it sets the name ^^ could pass in module name here let fname_str = nameToStr fname fname_var = toVar (fname_str) (vars, arg_tys, bindss) <- @@ -1588,6 +1591,7 @@ desugarFun type_syns toplevel env decl = let funty = ArrowTy arg_tys ret_ty pure $ (ForAll [] funty) Just ty -> pure ty + -- where it parses expressions \/\/ could parse module calls here bod' <- desugarExp type_syns toplevel bod pure $ (fname_var, args, unCurryTopTy fun_ty, (mkLets binds bod')) _ -> diff --git a/gibbon-compiler/src/Gibbon/Language/Syntax.hs b/gibbon-compiler/src/Gibbon/Language/Syntax.hs index b0f7bde91..4948c916c 100644 --- a/gibbon-compiler/src/Gibbon/Language/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/Language/Syntax.hs @@ -313,6 +313,7 @@ data FunMeta = FunMeta { funRec :: FunRec , funInline :: FunInline + --, funModule :: String -- Whether the transitive closure of this function can trigger GC. , funCanTriggerGC :: Bool , funOptLayout :: FunOptimizeLayout From 7ff377a3886d0bb0c801cce962ac23556a23a574 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 8 Nov 2023 09:08:02 -0800 Subject: [PATCH 04/68] module rename can modify function callsites and function decalrations, next up is actual resolution logic --- gibbon-compiler/gibbon.cabal | 1 + gibbon-compiler/ir.log | 27 +- gibbon-compiler/src/Gibbon/Compiler.hs | 2 + gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 5 +- .../src/Gibbon/Passes/ModuleRename.hs | 419 ++---------------- 5 files changed, 70 insertions(+), 384 deletions(-) diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index 3013493f4..07892070d 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -60,6 +60,7 @@ library Gibbon.NewL2.FromOldL2 -- compiler passes, roughly in the order they're run + Gibbon.Passes.ModuleRename Gibbon.Passes.Freshen Gibbon.Passes.Flatten Gibbon.Passes.InlineTriv diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index 654f12b2f..e6d9a648d 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -9,7 +9,7 @@ Prog {ddefs = [(Tree, ("Node", [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], fundefs = [(add1, - FunDef {funName = "Add.add1", + FunDef {funName = "*Add*add1", funArgs = [t], funTy = ForAll [] (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), @@ -38,25 +38,42 @@ Prog {ddefs = [(Tree, DataConE (MetaTv $8) "Leaf" [LitE 2]]], MetaTv $9)} + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +*Add*add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +*Add*add1 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 1) + Node x1::$4 x2::$5 -> + (Node $3 (timmy-Add.add1 [] x1) (timmy-Add.add1 [] x2)) + +gibbon_main :: $9 +gibbon_main = (Add.add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) + [compiler] Running pass, freshen Pass output: ================================================================================ data Tree = Leaf Int | Node (Packed Tree []) (Packed Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -Add_add1 t_10 = +_Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +_Add_add1 t_10 = case t_10 of Leaf x_11::$2 -> (Leaf $1 x_11 + 1) Node x1_12::$4 x2_13::$5 -> - (Node $3 (Add_add1 [] x1_12) (Add_add1 [] x2_13)) + (Node $3 (timmy_Add_add1 [] x1_12) (timmy_Add_add1 [] x2_13)) gibbon_main :: $9 gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, typecheck gibbon: L0.Typecheck: - Unknown function: Add_add1 in Var "Add_add1" + Unknown function: timmy_Add_add1 in Var "_Add_add1" CallStack (from HasCallStack): error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 3014d1d38..60377fbff 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -58,6 +58,7 @@ import qualified Gibbon.L0.Specialize2 as L0 import qualified Gibbon.L1.Typecheck as L1 import qualified Gibbon.L2.Typecheck as L2 import qualified Gibbon.L3.Typecheck as L3 +import Gibbon.Passes.ModuleRename (moduleRename) import Gibbon.Passes.Freshen (freshNames) import Gibbon.Passes.Flatten (flattenL1, flattenL2, flattenL3) import Gibbon.Passes.InlineTriv (inlineTriv) @@ -603,6 +604,7 @@ passes config@Config{dynflags} l0 = do opt_layout_global = gopt Opt_Layout_Global dynflags use_solver = gopt Opt_Layout_Use_Solver dynflags tcProg3 = L3.tcProg isPacked + l0 <- go "renameModules" moduleRename l0 l0 <- go "freshen" freshNames l0 l0 <- goE0 "typecheck" L0.tcProg l0 l0 <- goE0 "bindLambdas" L0.bindLambdas l0 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index b8bf23e6c..76997367b 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,7 +200,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = M.map (\funDef -> funDef {funName = toVar (mod_name ++ "." ++ (fromVar (funName funDef))) }) funs -- can insert function name here + funs' = M.map (\funDef -> funDef {funName = toVar ("*" ++ mod_name ++ "*" ++ (fromVar (funName funDef))) }) funs -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = foldr @@ -749,8 +749,10 @@ desugarExp type_syns toplevel e = -- | (qnameToStr f) == "error" -> pure $ PrimAppE (ErrorP (litToString lit Paren _ e2 -> desugarExp type_syns toplevel e2 H.Var _ qv -> do + -- where the expression name is parsed (for all expressions) let str = qnameToStr qv v = (toVar str) + -- v = (toVar ("timmy-" ++ str)) if str == "alloc_pdict" then do kty <- newMetaTy @@ -1567,6 +1569,7 @@ desugarExp type_syns toplevel e = pure $ PrimAppE SubP [LitE 0, e1'] _ -> error ("desugarExp: Unsupported expression: " ++ prettyPrint e) +-- parse function declarations desugarFun :: (Show a, Pretty a) => TypeSynEnv diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index d72d735df..8184e1cd6 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -3,7 +3,7 @@ -- | Unique names. -module Gibbon.Passes.ModuleRename (renameNames) where +module Gibbon.Passes.ModuleRename (moduleRename) where import Gibbon.Pretty @@ -22,402 +22,65 @@ import qualified Gibbon.L1.Syntax as L1 type VarEnv = M.Map Var Var type TyVarEnv t = M.Map TyVar t -renameNames :: Prog0 -> PassM Prog0 -renameNames (Prog defs funs main) = +moduleRename :: Prog0 -> PassM Prog0 +moduleRename (Prog defs funs main) = let _ = dbgPrintLn 2 (show defs) in - do main' <- case main of - Nothing -> return Nothing - Just (m,ty) -> do m' <- freshExp M.empty M.empty m - return $ Just (m',ty) - defs' <- traverse freshDDef defs - funs' <- M.mapKeys cleanFunName <$> traverse freshFun funs - return $ Prog defs' funs' main' + do --main' <- case main of + -- Nothing -> return Nothing + -- Just (m,ty) -> do m' <- freshExp M.empty M.empty m + -- return $ Just (m',ty) + --defs' <- traverse freshDDef defs + --funs' <- *traverse map* resolveFunModuleNames funs + funs' <- traverse (\v -> resolveModsInFuns v defs funs) funs + return $ Prog defs funs' main freshDDef :: DDef Ty0 -> PassM (DDef Ty0) -freshDDef DDef{tyName,tyArgs,dataCons} = do - rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tyArgs - let env :: TyVarEnv Ty0 - env = M.fromList $ zip tyArgs (map TyVar rigid_tyvars) - dataCons' <- mapM (\(dcon,vs) -> (dcon,) <$> mapM (go (sdoc (dcon,vs)) rigid_tyvars env) vs) dataCons - pure (DDef tyName rigid_tyvars dataCons') - where - go :: String -> [TyVar] -> TyVarEnv Ty0 -> (t, Ty0) -> PassM (t, Ty0) - go msg bound env (b, ty) = do - (_, ty') <- freshTy env ty - let free_tvs = tyVarsInTy ty' L.\\ bound - if free_tvs == [] - then pure (b, ty') - else error $ "freshDDef: Unbound type variables " ++ sdoc free_tvs - ++ " in the constructor:\n" ++ msg +freshDDef DDef{tyName,tyArgs,dataCons} = + do pure $ DDef tyName tyArgs dataCons -freshFun :: FunDef Exp0 -> PassM (FunDef Exp0) -freshFun (FunDef nam nargs funty bod meta) = - do nargs' <- mapM gensym nargs - let msubst = (M.fromList $ zip nargs nargs') - (tvenv, funty') <- freshTyScheme funty - funty'' <- freshDictTyScheme msubst funty' - bod' <- freshExp msubst tvenv bod - let nam' = cleanFunName nam - pure $ FunDef nam' nargs' funty'' bod' meta +resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> FunDefs Exp0 -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defs funs = + do + bod' <- resolveModInBod funs bod + pure $ FunDef nam nargs funty bod' meta --- -freshTyScheme :: TyScheme -> PassM (TyVarEnv Ty0, TyScheme) -freshTyScheme (ForAll tvs ty) = do - rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tvs - let env = M.fromList $ zip tvs (map TyVar rigid_tyvars) - (env', ty') <- freshTy env ty - pure (env', ForAll rigid_tyvars ty') - -freshTy :: TyVarEnv Ty0 -> Ty0 -> PassM (TyVarEnv Ty0, Ty0) -freshTy env ty = - case ty of - IntTy -> pure (env, ty) - CharTy -> pure (env, ty) - FloatTy -> pure (env, ty) - SymTy0 -> pure (env, ty) - BoolTy -> pure (env, ty) - ArenaTy -> pure (env, ty) - SymSetTy -> pure (env, ty) - SymHashTy -> pure (env, ty) - TyVar tv -> case M.lookup tv env of - Nothing -> do tv' <- newTyVar - pure (env, TyVar tv') - Just tv' -> pure (env, tv') - MetaTv{} -> pure (env, ty) - ProdTy tys -> do (env', tys') <- freshTys env tys - pure (env', ProdTy tys') - SymDictTy v t -> do (env', t') <- freshTy env t - pure (env', SymDictTy v t') - PDictTy k v -> do (env', k') <- freshTy env k - (env'', v') <- freshTy env' v - pure (env'', PDictTy k' v') - ArrowTy tys t -> do (env', tys') <- freshTys env tys - (env'', [t']) <- freshTys env' [t] - pure (env'', ArrowTy tys' t') - PackedTy tycon tys -> do (env', tys') <- freshTys env tys - pure (env', PackedTy tycon tys') - VectorTy el_t -> do (env', el_t') <- freshTy env el_t - pure (env', VectorTy el_t') - ListTy el_t -> do (env', el_t') <- freshTy env el_t - pure (env', ListTy el_t') - IntHashTy -> pure (env, ty) - -freshTys :: TyVarEnv (TyOf Exp0) -> [Ty0] -> PassM (TyVarEnv (TyOf Exp0), [Ty0]) -freshTys env tys = - foldrM - (\t (env', acc) -> do - (env'', t') <- freshTy env' t - pure (env' <> env'', t' : acc)) - (env, []) - tys - -freshDictTy :: Monad m => M.Map Var Var -> Ty0 -> m Ty0 -freshDictTy m ty = - case ty of - IntTy -> pure ty - CharTy -> pure ty - FloatTy -> pure ty - SymTy0 -> pure ty - BoolTy -> pure ty - ArenaTy -> pure ty - TyVar _tv -> pure ty - MetaTv{} -> pure ty - ProdTy tys -> - do tys' <- mapM (freshDictTy m) tys - pure (ProdTy tys') - SymDictTy (Just v) t -> - do t' <- freshDictTy m t - case M.lookup v m of - Just v' -> pure $ SymDictTy (Just v') t' - Nothing -> pure ty - SymDictTy Nothing t -> - do t' <- freshDictTy m t - pure $ SymDictTy Nothing t' - PDictTy k v -> - do k' <- freshDictTy m k - v' <- freshDictTy m v - pure $ PDictTy k' v' - ArrowTy tys t -> - do tys' <- mapM (freshDictTy m) tys - t' <- freshDictTy m t - pure $ ArrowTy tys' t' - PackedTy tycon tys -> - do tys' <- mapM (freshDictTy m) tys - pure $ PackedTy tycon tys' - VectorTy el_t -> - do el_t' <- freshDictTy m el_t - pure $ VectorTy el_t' - ListTy el_t -> - do el_t' <- freshDictTy m el_t - pure $ ListTy el_t' - SymSetTy -> pure ty - SymHashTy -> pure ty - IntHashTy -> pure ty - -freshDictTyScheme :: Monad m => - M.Map Var Var -> TyScheme -> m TyScheme -freshDictTyScheme m (ForAll tvs ty) = - do ty' <- freshDictTy m ty - pure $ ForAll tvs ty' - -freshExp :: VarEnv -> TyVarEnv Ty0 -> Exp0 -> PassM Exp0 -freshExp venv tvenv exp = +resolveModInBod :: FunDefs Exp0 -> Exp0 -> PassM Exp0 +resolveModInBod funs exp = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c FloatE i -> return $ FloatE i LitSymE v -> return $ LitSymE v - - VarE v -> - case M.lookup v venv of - Nothing -> return $ VarE (cleanFunName v) - Just v' -> return $ VarE (cleanFunName v') - - AppE v locs ls -> assert ([] == locs) $ do - ls' <- mapM go ls - case M.lookup v venv of - Nothing -> return $ AppE (cleanFunName v) [] ls' - Just v' -> return $ AppE (cleanFunName v') [] ls' - - PrimAppE p es -> do - es' <- mapM go es - return $ PrimAppE p es' + --VarE v -> return $ VarE (varAppend (toVar "seen-") v) + VarE v -> return $ VarE v + AppE v locs ls -> return $ AppE (varAppend (toVar "timmy-") v) locs ls + PrimAppE p es -> return $ PrimAppE p es LetE (v,_locs,ty, e1) e2 -> do - let user_tvs = filter isUserTv $ tyVarsInTy ty - rigid_tyvars <- mapM (\(UserTv w) -> - case M.lookup (UserTv w) tvenv of - Just (TyVar tv) -> pure tv - Just oth -> error $ "freshExp: UserTv bound to: " ++ sdoc oth - Nothing -> BoundTv <$> gensym w) - user_tvs - let env = M.fromList $ zip user_tvs (map TyVar rigid_tyvars) - tvenv' = env <> tvenv - - (_tvenv'', ty') <- freshTy tvenv' ty - e1' <- freshExp venv tvenv' e1 - v' <- gensym (cleanFunName v) - e2' <- freshExp (M.insert v v' venv) tvenv e2 - ty'' <- case ty' of - SymDictTy (Just w) ty2 -> case M.lookup w venv of - Nothing -> return ty' - Just w' -> return $ SymDictTy (Just w') ty2 - _ -> return ty' - return $ LetE (v',[],ty'',e1') e2' - - IfE e1 e2 e3 -> do - e1' <- go e1 - e2' <- go e2 - e3' <- go e3 - return $ IfE e1' e2' e3' + e1' <- resolveModInBod funs e1 + e2' <- resolveModInBod funs e2 + return $ LetE (v, [], ty, e1') e2' - ProjE i e -> do - e' <- go e - return $ ProjE i e' - - MkProdE es -> do - es' <- mapM go es - return $ MkProdE es' + IfE e1 e2 e3 -> return $ IfE e1 e2 e3 + ProjE i e -> return $ ProjE i e + MkProdE es -> return $ MkProdE es CaseE e mp -> do - e' <- go e + e' <- resolveModInBod funs e mp' <- mapM (\(c,prs,ae) -> do - let (args,locs) = unzip prs - args' <- mapM gensym args - let venv' = M.fromList (zip args args') `M.union` venv - ae' <- freshExp venv' tvenv ae - return (c, zip args' locs, ae')) mp + ae' <- resolveModInBod funs ae + return (c, prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- mapM go es + es' <- traverse (\v -> resolveModInBod funs v) es return $ DataConE loc c es' - TimeIt e t b -> do - e' <- go e - return $ TimeIt e' t b - - WithArenaE v e -> do - v' <- gensym v - e' <- freshExp (M.insert v v' venv) tvenv e - return $ WithArenaE v' e' - - SpawnE v locs ls -> assert ([] == locs) $ do - ls' <- mapM go ls - case M.lookup v venv of - Nothing -> return $ SpawnE (cleanFunName v) [] ls' - Just v' -> return $ SpawnE (cleanFunName v') [] ls' - - SyncE -> pure SyncE - - MapE (v,t,b) e -> do - b' <- go b - e' <- go e - return $ MapE (v,t,b') e' - - FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do - e1' <- go e1 - e2' <- go e2 - e3' <- go e3 - return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' - - -- Ext ext -> Ext <$> gFreshenExp venv tvenv ext - - Ext ext -> - case ext of - LambdaE args bod -> do - (venv', vs, ts) <- foldrM - (\(v,t) (acc1, acc2, acc3) -> do - v' <- gensym v - let acc1' = M.insert v v' acc1 - (_tvenv', t') <- freshTy tvenv t - pure (acc1', v':acc2, t': acc3)) - (venv,[],[]) args - Ext <$> (LambdaE (zip vs ts) <$> (freshExp venv' tvenv bod)) - FunRefE tyapps f -> - case M.lookup f venv of - Nothing -> pure $ Ext $ FunRefE tyapps (cleanFunName f) - Just f' -> pure $ Ext $ FunRefE tyapps (cleanFunName f') - PolyAppE{} -> error "freshExp: TODO, PolyAppE." - - BenchE fn tyapps args b -> do - args' <- mapM go args - pure $ Ext (BenchE (cleanFunName fn) tyapps args' b) - - ParE0 ls -> Ext <$> ParE0 <$> mapM go ls - L p e -> Ext <$> (L p) <$> go e - PrintPacked ty arg -> do - (tvenv', ty') <- freshTy tvenv ty - arg' <- freshExp venv tvenv' arg - pure $ Ext $ PrintPacked ty' arg' - CopyPacked ty arg -> do - (tvenv', ty') <- freshTy tvenv ty - arg' <- freshExp venv tvenv' arg - pure $ Ext $ CopyPacked ty' arg' - TravPacked ty arg -> do - (tvenv', ty') <- freshTy tvenv ty - arg' <- freshExp venv tvenv' arg - pure $ Ext $ TravPacked ty' arg' - LinearExt{} -> error $ "freshenExp: a linear types extension wasn't desugared: " ++ sdoc exp - - where go = freshExp venv tvenv - - --- copy-paste. - -freshNames1 :: L1.Prog1 -> PassM L1.Prog1 -freshNames1 (L1.Prog defs funs main) = - do main' <- case main of - Nothing -> return Nothing - Just (m,ty) -> do m' <- freshExp1 M.empty m - return $ Just (m',ty) - funs' <- traverse freshFun1 funs - return $ L1.Prog defs funs' main' - -freshFun1 :: L1.FunDef1 -> PassM L1.FunDef1 -freshFun1 (FunDef nam nargs (targ,ty) bod meta) = do - nargs' <- mapM gensym nargs - let msubst = (M.fromList $ zip nargs nargs') - bod' <- freshExp1 msubst bod - -- let nam' = cleanFunName nam - return $ FunDef nam nargs' (targ,ty) bod' meta - - -freshExp1 :: VarEnv -> L1.Exp1 -> PassM L1.Exp1 -freshExp1 vs exp = - case exp of - LitE i -> return $ LitE i - CharE c -> return $ CharE c - FloatE i -> return $ FloatE i - LitSymE v -> return $ LitSymE v - - VarE v -> - case M.lookup v vs of - Nothing -> return $ VarE v - Just v' -> return $ VarE v' - - AppE v locs ls -> assert ([] == locs) $ do - ls' <- mapM (freshExp1 vs) ls - case M.lookup v vs of - Nothing -> return $ AppE (cleanFunName v) [] ls' - Just v' -> return $ AppE (cleanFunName v') [] ls' - - PrimAppE p es -> do - es' <- mapM (freshExp1 vs) es - return $ PrimAppE p es' - - LetE (v,locs,t, e1) e2 -> assert ([]==locs) $ do - e1' <- freshExp1 vs e1 - v' <- gensym v - e2' <- freshExp1 (M.insert v v' vs) e2 - return $ LetE (v',[],t,e1') e2' - - IfE e1 e2 e3 -> do - e1' <- freshExp1 vs e1 - e2' <- freshExp1 vs e2 - e3' <- freshExp1 vs e3 - return $ IfE e1' e2' e3' - - ProjE i e -> do - e' <- freshExp1 vs e - return $ ProjE i e' - - MkProdE es -> do - es' <- mapM (freshExp1 vs) es - return $ MkProdE es' - - CaseE e mp -> do - e' <- freshExp1 vs e - -- Here we freshen locations: - mp' <- mapM (\(c,prs,ae) -> - let (args,_) = unzip prs in - do - args' <- mapM gensym args - let vs' = (M.fromList $ zip args args') `M.union` vs - ae' <- freshExp1 vs' ae - return (c, map (,()) args', ae')) mp - return $ CaseE e' mp' - - DataConE () c es -> do - es' <- mapM (freshExp1 vs) es - return $ DataConE () c es' - - TimeIt e t b -> do - e' <- freshExp1 vs e - return $ TimeIt e' t b - - SpawnE v locs ls -> assert ([] == locs) $ do - ls' <- mapM (freshExp1 vs) ls - case M.lookup v vs of - Nothing -> return $ SpawnE (cleanFunName v) [] ls' - Just v' -> return $ SpawnE (cleanFunName v') [] ls' - - SyncE -> pure SyncE - - MapE (v,t,b) e -> do - b' <- freshExp1 vs b - e' <- freshExp1 vs e - return $ MapE (v,t,b') e' - - FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do - e1' <- freshExp1 vs e1 - e2' <- freshExp1 vs e2 - e3' <- freshExp1 vs e3 - return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' - - WithArenaE{} -> error "freshExp1: WithArenaE not handled." - - Ext (L1.BenchE fn tyapps args b) -> do - args' <- mapM (freshExp1 vs) args - pure $ Ext (L1.BenchE (cleanFunName fn) tyapps args' b) - - Ext (L1.StartOfPkdCursor cur) -> do - case M.lookup cur vs of - Nothing -> return $ Ext $ L1.StartOfPkdCursor cur - Just v' -> return $ Ext $ L1.StartOfPkdCursor v' - - Ext (L1.AddFixed v i) -> do - case M.lookup v vs of - Nothing -> return $ Ext $ L1.AddFixed v i - Just v' -> return $ Ext $ L1.AddFixed v' i + TimeIt e t b -> return $ TimeIt e t b + WithArenaE v e -> return $ WithArenaE v e + SpawnE v locs ls -> return $ SpawnE v locs ls + SyncE -> return $ SyncE + MapE v e -> return $ MapE v e + FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + Ext ext -> return $ Ext ext From 1b2cfaf5b57b7342bb7d13d3344a05ebfc28d52a Mon Sep 17 00:00:00 2001 From: timmy Date: Fri, 10 Nov 2023 14:38:06 -0800 Subject: [PATCH 05/68] finished basic module import resolution --- gibbon-compiler/ir.log | 28 +++---- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 2 +- .../src/Gibbon/Passes/ModuleRename.hs | 82 +++++++++++++++---- 3 files changed, 80 insertions(+), 32 deletions(-) diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index e6d9a648d..f2a96e11a 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -8,8 +8,8 @@ Prog {ddefs = [(Tree, dataCons = [("Leaf", [(False, IntTy)]), ("Node", [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], - fundefs = [(add1, - FunDef {funName = "*Add*add1", + fundefs = [(Add.add1, + FunDef {funName = "Add.add1", funArgs = [t], funTy = ForAll [] (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), @@ -44,13 +44,13 @@ Pass output: data Tree = Leaf Int | Node (Packed Tree []) (Packed Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -*Add*add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -*Add*add1 t = +Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) +Add_add1_10 t = case t of Leaf x::$2 -> (Leaf $1 x + 1) Node x1::$4 x2::$5 -> - (Node $3 (timmy-Add.add1 [] x1) (timmy-Add.add1 [] x2)) + (Node $3 (Add_add1_10 [] x1) (Add_add1_10 [] x2)) gibbon_main :: $9 gibbon_main = (Add.add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) @@ -61,19 +61,19 @@ Pass output: data Tree = Leaf Int | Node (Packed Tree []) (Packed Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -_Add_add1 t_10 = - case t_10 of - Leaf x_11::$2 -> - (Leaf $1 x_11 + 1) - Node x1_12::$4 x2_13::$5 -> - (Node $3 (timmy_Add_add1 [] x1_12) (timmy_Add_add1 [] x2_13)) +Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) +Add_add1_10 t_11 = + case t_11 of + Leaf x_12::$2 -> + (Leaf $1 x_12 + 1) + Node x1_13::$4 x2_14::$5 -> + (Node $3 (Add_add1_10 [] x1_13) (Add_add1_10 [] x2_14)) gibbon_main :: $9 gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, typecheck gibbon: L0.Typecheck: - Unknown function: timmy_Add_add1 in Var "_Add_add1" + Unknown function: Add_add1 CallStack (from HasCallStack): - error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck + error, called at src/Gibbon/L0/Typecheck.hs:66:32 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 76997367b..13c891cb5 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,7 +200,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = M.map (\funDef -> funDef {funName = toVar ("*" ++ mod_name ++ "*" ++ (fromVar (funName funDef))) }) funs -- can insert function name here + funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = foldr diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 8184e1cd6..ae6fddaf8 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -19,34 +19,70 @@ import qualified Gibbon.L1.Syntax as L1 -------------------------------------------------------------------------------- -type VarEnv = M.Map Var Var +type VarEnv = M.Map Var (M.Map Var Var) type TyVarEnv t = M.Map TyVar t moduleRename :: Prog0 -> PassM Prog0 moduleRename (Prog defs funs main) = - let _ = dbgPrintLn 2 (show defs) - in do --main' <- case main of -- Nothing -> return Nothing -- Just (m,ty) -> do m' <- freshExp M.empty M.empty m -- return $ Just (m',ty) --defs' <- traverse freshDDef defs --funs' <- *traverse map* resolveFunModuleNames funs - funs' <- traverse (\v -> resolveModsInFuns v defs funs) funs - return $ Prog defs funs' main + renamedFuns <- mapM (\k -> (gensym k)) (M.keys funs) + let nameMap = M.fromList $ zip (M.keys funs) renamedFuns + let init :: VarEnv = M.empty + let (env, _) = M.mapAccumWithKey buildEnv init nameMap + --let funs' = M.mapKeys (\k -> resolveNameInEnv () env) funs + let _ = dbgPrintLn 2 "hello?" + let transformKey :: Var -> Var + transformKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name env + funs' <- traverse (\v -> resolveModsInFuns v defs env) funs + let funs'' = M.mapKeys transformKey funs' + return $ Prog defs funs'' main + +buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv env k v = do + let (mod, name) = parseOutMod k + let mod' = case mod of + Just m -> m + Nothing -> (toVar "") + case (M.lookup name env) of + Just m -> + if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + else ((M.insert name (M.insert mod' v m) env), v) + Nothing -> ((M.insert name (M.singleton mod' v) env), v) + +resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var +resolveNameInEnv mod name e = + do case (M.lookup name e) of + Just modspace -> case mod of + Just m -> case (M.lookup m modspace) of + Just n -> n + Nothing -> error $ "can't find function " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find function " ++ (fromVar name) + Nothing -> error $ "can't find function " ++ (fromVar name) freshDDef :: DDef Ty0 -> PassM (DDef Ty0) freshDDef DDef{tyName,tyArgs,dataCons} = do pure $ DDef tyName tyArgs dataCons -resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> FunDefs Exp0 -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defs funs = +--funRename :: FunDef Exp0 -> FunDef Exp0 +--funRename (FunDef nam nargs funty bod meta) = FunDef (gensym nam) nargs funty bod meta + +resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defs env = do - bod' <- resolveModInBod funs bod - pure $ FunDef nam nargs funty bod' meta + let (mod, name) = parseOutMod nam + bod' <- resolveModInBod bod env + pure $ FunDef (resolveNameInEnv mod name env) nargs funty bod' meta -resolveModInBod :: FunDefs Exp0 -> Exp0 -> PassM Exp0 -resolveModInBod funs exp = +resolveModInBod :: Exp0 -> VarEnv -> PassM Exp0 +resolveModInBod exp env = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c @@ -54,12 +90,17 @@ resolveModInBod funs exp = LitSymE v -> return $ LitSymE v --VarE v -> return $ VarE (varAppend (toVar "seen-") v) VarE v -> return $ VarE v - AppE v locs ls -> return $ AppE (varAppend (toVar "timmy-") v) locs ls + + AppE v locs ls -> do + let (mod, fun) = parseOutMod v + let v' = resolveNameInEnv mod fun env + return $ AppE v' locs ls + PrimAppE p es -> return $ PrimAppE p es LetE (v,_locs,ty, e1) e2 -> do - e1' <- resolveModInBod funs e1 - e2' <- resolveModInBod funs e2 + e1' <- resolveModInBod e1 env + e2' <- resolveModInBod e2 env return $ LetE (v, [], ty, e1') e2' IfE e1 e2 e3 -> return $ IfE e1 e2 e3 @@ -67,14 +108,14 @@ resolveModInBod funs exp = MkProdE es -> return $ MkProdE es CaseE e mp -> do - e' <- resolveModInBod funs e + e' <- resolveModInBod e env mp' <- mapM (\(c,prs,ae) -> do - ae' <- resolveModInBod funs ae + ae' <- resolveModInBod ae env return (c, prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- traverse (\v -> resolveModInBod funs v) es + es' <- traverse (\v -> resolveModInBod v env) es return $ DataConE loc c es' TimeIt e t b -> return $ TimeIt e t b @@ -84,3 +125,10 @@ resolveModInBod funs exp = MapE v e -> return $ MapE v e FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 Ext ext -> return $ Ext ext + +parseOutMod :: Var -> (Maybe Var, Var) +parseOutMod v = do + let str = (fromVar v) + case (L.elemIndices '.' str) of + [] -> (Nothing, v) + x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) \ No newline at end of file From f05cbddbd330f443b90a255e897d3dce6f6f24be Mon Sep 17 00:00:00 2001 From: timmy Date: Fri, 10 Nov 2023 18:56:13 -0800 Subject: [PATCH 06/68] parses modules in defs and main as well --- gibbon-compiler/ir.log | 2757 ++++++++++++++++- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 3 +- .../src/Gibbon/Passes/ModuleRename.hs | 175 +- 3 files changed, 2854 insertions(+), 81 deletions(-) diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index f2a96e11a..e0f9c3ec0 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -2,8 +2,8 @@ ! We set DEBUG based on command-line verbose arg: 4 [compiler] pipeline starting, parsed program: ================================================================================ -Prog {ddefs = [(Tree, - DDef {tyName = "Tree", +Prog {ddefs = [(Add.Tree, + DDef {tyName = "Add.Tree", tyArgs = [], dataCons = [("Leaf", [(False, IntTy)]), ("Node", @@ -41,39 +41,2752 @@ Prog {ddefs = [(Tree, [compiler] Running pass, renameModules Pass output: ================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) -Add_add1_10 t = +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t = case t of Leaf x::$2 -> (Leaf $1 x + 1) Node x1::$4 x2::$5 -> - (Node $3 (Add_add1_10 [] x1) (Add_add1_10 [] x2)) + (Node $3 (Add_add1_11 [] x1) (Add_add1_11 [] x2)) gibbon_main :: $9 -gibbon_main = (Add.add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, freshen Pass output: ================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) -Add_add1_10 t_11 = - case t_11 of - Leaf x_12::$2 -> - (Leaf $1 x_12 + 1) - Node x1_13::$4 x2_14::$5 -> - (Node $3 (Add_add1_10 [] x1_13) (Add_add1_10 [] x2_14)) +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::$2 -> + (Leaf $1 x_13 + 1) + Node x1_14::$4 x2_15::$5 -> + (Node $3 (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) gibbon_main :: $9 -gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, typecheck -gibbon: L0.Typecheck: - Unknown function: Add_add1 -CallStack (from HasCallStack): - error, called at src/Gibbon/L0/Typecheck.hs:66:32 in gibbon-0.3-inplace:Gibbon.L0.Typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, bindLambdas +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, monomorphize +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, specLambdas +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, desugarL0 +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 1) + Node x1_14::() x2_15::() -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29::() -> + let y_30 :: Int = x_29 in + (Leaf () y_30) + Node x_31::() x_32::() -> + let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in + (Node () y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36::() -> + let y_37 :: Int = x_36 in + (Leaf () y_37) + Node x_38::() x_39::() -> + let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node () y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43::() -> + () + Node x_45::() x_46::() -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50::() -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55::() x_56::() -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, floatOutCase +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 1) + Node x1_14::() x2_15::() -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29::() -> + let y_30 :: Int = x_29 in + (Leaf () y_30) + Node x_31::() x_32::() -> + let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in + (Node () y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36::() -> + let y_37 :: Int = x_36 in + (Leaf () y_37) + Node x_38::() x_39::() -> + let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node () y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43::() -> + () + Node x_45::() x_46::() -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50::() -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55::() x_56::() -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, toL1 +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, benchMainExp +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63 = + case t_12_63 of + Leaf x_13_64 -> + (Leaf x_13_64 + 1) + Node x1_14_65 x2_15_66 -> + (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67 = + case arg_28_67 of + Leaf x_29_68 -> + let y_30_69 :: Int = x_29_68 in + (Leaf y_30_69) + Node x_31_70 x_32_71 -> + let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in + let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in + (Node y_33_72 y_34_73) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74 = + case arg_35_74 of + Leaf x_36_75 -> + let y_37_76 :: Int = x_36_75 in + (Leaf y_37_76) + Node x_38_77 x_39_78 -> + let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in + let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in + (Node y_40_79 y_41_80) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81 = + case arg_42_81 of + Leaf x_43_82 -> + () + Node x_45_83 x_46_84 -> + let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in + let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87 = + case arg_49_87 of + Leaf x_50_88 -> + let wildcard_52_89 :: () = printsym("(Leaf") in + let wildcard_54_90 :: () = printsym(" ") in + let y_51_91 :: () = printint(x_50_88) in + let wildcard_53_92 :: () = printsym(")") in + () + Node x_55_93 x_56_94 -> + let wildcard_59_95 :: () = printsym("(Node") in + let wildcard_62_96 :: () = printsym(" ") in + let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in + let wildcard_61_98 :: () = printsym(" ") in + let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in + let wildcard_60_100 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63 = + case t_12_63 of + Leaf x_13_64 -> + (Leaf x_13_64 + 1) + Node x1_14_65 x2_15_66 -> + (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67 = + case arg_28_67 of + Leaf x_29_68 -> + let y_30_69 :: Int = x_29_68 in + (Leaf y_30_69) + Node x_31_70 x_32_71 -> + let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in + let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in + (Node y_33_72 y_34_73) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74 = + case arg_35_74 of + Leaf x_36_75 -> + let y_37_76 :: Int = x_36_75 in + (Leaf y_37_76) + Node x_38_77 x_39_78 -> + let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in + let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in + (Node y_40_79 y_41_80) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81 = + case arg_42_81 of + Leaf x_43_82 -> + () + Node x_45_83 x_46_84 -> + let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in + let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87 = + case arg_49_87 of + Leaf x_50_88 -> + let wildcard_52_89 :: () = printsym("(Leaf") in + let wildcard_54_90 :: () = printsym(" ") in + let y_51_91 :: () = printint(x_50_88) in + let wildcard_53_92 :: () = printsym(")") in + () + Node x_55_93 x_56_94 -> + let wildcard_59_95 :: () = printsym("(Node") in + let wildcard_62_96 :: () = printsym(" ") in + let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in + let wildcard_61_98 :: () = printsym(" ") in + let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in + let wildcard_60_100 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, flatten +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63 = + case t_12_63 of + Leaf x_13_64 -> + let fltPkd_104 :: Int = x_13_64 + 1 in + (Leaf fltPkd_104) + Node x1_14_65 x2_15_66 -> + let fltPkd_105 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65) in + let fltPkd_106 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66) in + (Node fltPkd_105 fltPkd_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67 = + case arg_28_67 of + Leaf x_29_68 -> + let y_30_69 :: Int = x_29_68 in + (Leaf y_30_69) + Node x_31_70 x_32_71 -> + let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in + let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in + (Node y_33_72 y_34_73) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74 = + case arg_35_74 of + Leaf x_36_75 -> + let y_37_76 :: Int = x_36_75 in + (Leaf y_37_76) + Node x_38_77 x_39_78 -> + let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in + let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in + (Node y_40_79 y_41_80) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81 = + case arg_42_81 of + Leaf x_43_82 -> + () + Node x_45_83 x_46_84 -> + let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in + let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87 = + case arg_49_87 of + Leaf x_50_88 -> + let wildcard_52_89 :: () = printsym("(Leaf") in + let wildcard_54_90 :: () = printsym(" ") in + let y_51_91 :: () = printint(x_50_88) in + let wildcard_53_92 :: () = printsym(")") in + () + Node x_55_93 x_56_94 -> + let wildcard_59_95 :: () = printsym("(Node") in + let wildcard_62_96 :: () = printsym(" ") in + let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in + let wildcard_61_98 :: () = printsym(" ") in + let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in + let wildcard_60_100 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101 :: (Packed Add_Tree_10) = (Node fltPkd_102 fltPkd_103) in + (Add_add1_11 [] fltAppE_101) + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + let y_30_69_119 :: Int = x_29_68_118 in + (Leaf y_30_69_119) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + let y_37_76_126 :: Int = x_36_75_125 in + (Leaf y_37_76_126) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, inlineTriv +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, directL3 +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, unariser +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, L3.flatten +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, lower +Pass output: +================================================================================ +Prog {infoTable = [("Add_Tree_10", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), + (155, " ")], + fundefs = [FunDecl {funName = "Add_add1_11", + funArgs = [(t_12_63_110, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), + (tail_157, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_12_63_110"], + bod = Switch "switch_160" + (VarTriv "tag_156") + (IntAlts [(0, + LetUnpackT {binds = [(x_13_64_111, + IntTy)], + ptr = "tail_157", + bod = LetPrimCallT {binds = [(fltPkd_104_112, + IntTy)], + prim = AddP, + rands = [VarTriv "x_13_64_111", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_158", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_104_112")], + bod = RetValsT [VarTriv "tailift_158"]}}}), + (1, + LetUnpackT {binds = [(x1_14_65_113, + CursorTy), + (x2_15_66_114, + CursorTy)], + ptr = "tail_157", + bod = LetCallT {async = False, + binds = [(fltPkd_105_115, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x1_14_65_113"], + bod = LetCallT {async = False, + binds = [(fltPkd_106_116, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x2_15_66_114"], + bod = LetAllocT {lhs = "tailift_159", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_105_115"), + (CursorTy, + VarTriv "fltPkd_106_116")], + bod = RetValsT [VarTriv "tailift_159"]}}}})]) + (Just ErrT "Unknown tag in: tag_156")}, + isPure = True}, + FunDecl {funName = "_copy_Add_Tree_10", + funArgs = [(arg_28_67_117, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), + (tail_162, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_28_67_117"], + bod = Switch "switch_165" + (VarTriv "tag_161") + (IntAlts [(0, + LetUnpackT {binds = [(x_29_68_118, + IntTy)], + ptr = "tail_162", + bod = LetAllocT {lhs = "tailift_163", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_29_68_118")], + bod = RetValsT [VarTriv "tailift_163"]}}), + (1, + LetUnpackT {binds = [(x_31_70_120, + CursorTy), + (x_32_71_121, + CursorTy)], + ptr = "tail_162", + bod = LetCallT {async = False, + binds = [(y_33_72_122, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_31_70_120"], + bod = LetCallT {async = False, + binds = [(y_34_73_123, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_32_71_121"], + bod = LetAllocT {lhs = "tailift_164", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_33_72_122"), + (CursorTy, + VarTriv "y_34_73_123")], + bod = RetValsT [VarTriv "tailift_164"]}}}})]) + (Just ErrT "Unknown tag in: tag_161")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", + funArgs = [(arg_35_74_124, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), + (tail_167, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_35_74_124"], + bod = Switch "switch_170" + (VarTriv "tag_166") + (IntAlts [(0, + LetUnpackT {binds = [(x_36_75_125, + IntTy)], + ptr = "tail_167", + bod = LetAllocT {lhs = "tailift_168", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_36_75_125")], + bod = RetValsT [VarTriv "tailift_168"]}}), + (1, + LetUnpackT {binds = [(x_38_77_127, + CursorTy), + (x_39_78_128, + CursorTy)], + ptr = "tail_167", + bod = LetCallT {async = False, + binds = [(y_40_79_129, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_38_77_127"], + bod = LetCallT {async = False, + binds = [(y_41_80_130, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_39_78_128"], + bod = LetAllocT {lhs = "tailift_169", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_40_79_129"), + (CursorTy, + VarTriv "y_41_80_130")], + bod = RetValsT [VarTriv "tailift_169"]}}}})]) + (Just ErrT "Unknown tag in: tag_166")}, + isPure = True}, + FunDecl {funName = "_traverse_Add_Tree_10", + funArgs = [(arg_42_81_131, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), + (tail_172, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_42_81_131"], + bod = Switch "switch_173" + (VarTriv "tag_171") + (IntAlts [(0, + LetUnpackT {binds = [(x_43_82_132, + IntTy)], + ptr = "tail_172", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_45_83_133, + CursorTy), + (x_46_84_134, + CursorTy)], + ptr = "tail_172", + bod = LetCallT {async = False, + binds = [(y_47_85_135, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_45_83_133"], + bod = LetCallT {async = False, + binds = [(y_48_86_136, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_46_84_134"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_171")}, + isPure = True}, + FunDecl {funName = "_print_Add_Tree_10", + funArgs = [(arg_49_87_137, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), + (tail_175, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_49_87_137"], + bod = Switch "switch_176" + (VarTriv "tag_174") + (IntAlts [(0, + LetUnpackT {binds = [(x_50_88_138, + IntTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 154], + bod = LetPrimCallT {binds = [(wildcard_54_90_140, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetPrimCallT {binds = [(y_51_91_141, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_50_88_138"], + bod = LetPrimCallT {binds = [(wildcard_53_92_142, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_55_93_143, + CursorTy), + (x_56_94_144, + CursorTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 153], + bod = LetPrimCallT {binds = [(wildcard_62_96_146, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_57_97_147, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_55_93_143"], + bod = LetPrimCallT {binds = [(wildcard_61_98_148, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_58_99_149, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_56_94_144"], + bod = LetPrimCallT {binds = [(wildcard_60_100_150, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_174")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_102_107", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_103_108", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_101_109", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_102_107"), + (CursorTy, + VarTriv "fltPkd_103_108")], + bod = LetCallT {async = False, + binds = [(tmp_app_151, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "fltAppE_101_109"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_Add_Tree_10", + rands = [VarTriv "tmp_app_151"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}})} + + [compiler] Running pass, lateInlineTriv +Pass output: +================================================================================ +Prog {infoTable = [("Add_Tree_10", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), + (155, " ")], + fundefs = [FunDecl {funName = "Add_add1_11", + funArgs = [(t_12_63_110, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), + (tail_157, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_12_63_110"], + bod = Switch "switch_160" + (VarTriv "tag_156") + (IntAlts [(0, + LetUnpackT {binds = [(x_13_64_111, + IntTy)], + ptr = "tail_157", + bod = LetPrimCallT {binds = [(fltPkd_104_112, + IntTy)], + prim = AddP, + rands = [VarTriv "x_13_64_111", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_158", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_104_112")], + bod = RetValsT [VarTriv "tailift_158"]}}}), + (1, + LetUnpackT {binds = [(x1_14_65_113, + CursorTy), + (x2_15_66_114, + CursorTy)], + ptr = "tail_157", + bod = LetCallT {async = False, + binds = [(fltPkd_105_115, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x1_14_65_113"], + bod = LetCallT {async = False, + binds = [(fltPkd_106_116, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x2_15_66_114"], + bod = LetAllocT {lhs = "tailift_159", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_105_115"), + (CursorTy, + VarTriv "fltPkd_106_116")], + bod = RetValsT [VarTriv "tailift_159"]}}}})]) + (Just ErrT "Unknown tag in: tag_156")}, + isPure = True}, + FunDecl {funName = "_copy_Add_Tree_10", + funArgs = [(arg_28_67_117, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), + (tail_162, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_28_67_117"], + bod = Switch "switch_165" + (VarTriv "tag_161") + (IntAlts [(0, + LetUnpackT {binds = [(x_29_68_118, + IntTy)], + ptr = "tail_162", + bod = LetAllocT {lhs = "tailift_163", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_29_68_118")], + bod = RetValsT [VarTriv "tailift_163"]}}), + (1, + LetUnpackT {binds = [(x_31_70_120, + CursorTy), + (x_32_71_121, + CursorTy)], + ptr = "tail_162", + bod = LetCallT {async = False, + binds = [(y_33_72_122, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_31_70_120"], + bod = LetCallT {async = False, + binds = [(y_34_73_123, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_32_71_121"], + bod = LetAllocT {lhs = "tailift_164", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_33_72_122"), + (CursorTy, + VarTriv "y_34_73_123")], + bod = RetValsT [VarTriv "tailift_164"]}}}})]) + (Just ErrT "Unknown tag in: tag_161")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", + funArgs = [(arg_35_74_124, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), + (tail_167, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_35_74_124"], + bod = Switch "switch_170" + (VarTriv "tag_166") + (IntAlts [(0, + LetUnpackT {binds = [(x_36_75_125, + IntTy)], + ptr = "tail_167", + bod = LetAllocT {lhs = "tailift_168", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_36_75_125")], + bod = RetValsT [VarTriv "tailift_168"]}}), + (1, + LetUnpackT {binds = [(x_38_77_127, + CursorTy), + (x_39_78_128, + CursorTy)], + ptr = "tail_167", + bod = LetCallT {async = False, + binds = [(y_40_79_129, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_38_77_127"], + bod = LetCallT {async = False, + binds = [(y_41_80_130, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_39_78_128"], + bod = LetAllocT {lhs = "tailift_169", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_40_79_129"), + (CursorTy, + VarTriv "y_41_80_130")], + bod = RetValsT [VarTriv "tailift_169"]}}}})]) + (Just ErrT "Unknown tag in: tag_166")}, + isPure = True}, + FunDecl {funName = "_traverse_Add_Tree_10", + funArgs = [(arg_42_81_131, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), + (tail_172, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_42_81_131"], + bod = Switch "switch_173" + (VarTriv "tag_171") + (IntAlts [(0, + LetUnpackT {binds = [(x_43_82_132, + IntTy)], + ptr = "tail_172", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_45_83_133, + CursorTy), + (x_46_84_134, + CursorTy)], + ptr = "tail_172", + bod = LetCallT {async = False, + binds = [(y_47_85_135, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_45_83_133"], + bod = LetCallT {async = False, + binds = [(y_48_86_136, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_46_84_134"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_171")}, + isPure = True}, + FunDecl {funName = "_print_Add_Tree_10", + funArgs = [(arg_49_87_137, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), + (tail_175, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_49_87_137"], + bod = Switch "switch_176" + (VarTriv "tag_174") + (IntAlts [(0, + LetUnpackT {binds = [(x_50_88_138, + IntTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 154], + bod = LetPrimCallT {binds = [(wildcard_54_90_140, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetPrimCallT {binds = [(y_51_91_141, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_50_88_138"], + bod = LetPrimCallT {binds = [(wildcard_53_92_142, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_55_93_143, + CursorTy), + (x_56_94_144, + CursorTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 153], + bod = LetPrimCallT {binds = [(wildcard_62_96_146, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_57_97_147, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_55_93_143"], + bod = LetPrimCallT {binds = [(wildcard_61_98_148, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_58_99_149, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_56_94_144"], + bod = LetPrimCallT {binds = [(wildcard_60_100_150, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_174")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_102_107", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_103_108", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_101_109", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_102_107"), + (CursorTy, + VarTriv "fltPkd_103_108")], + bod = LetCallT {async = False, + binds = [(tmp_app_151, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "fltAppE_101_109"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_Add_Tree_10", + rands = [VarTriv "tmp_app_151"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}})} + + [compiler] Running pass, rearrangeFree +Pass output: +================================================================================ +Prog {infoTable = [("Add_Tree_10", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), + (155, " ")], + fundefs = [FunDecl {funName = "Add_add1_11", + funArgs = [(t_12_63_110, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), + (tail_157, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_12_63_110"], + bod = Switch "switch_160" + (VarTriv "tag_156") + (IntAlts [(0, + LetUnpackT {binds = [(x_13_64_111, + IntTy)], + ptr = "tail_157", + bod = LetPrimCallT {binds = [(fltPkd_104_112, + IntTy)], + prim = AddP, + rands = [VarTriv "x_13_64_111", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_158", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_104_112")], + bod = RetValsT [VarTriv "tailift_158"]}}}), + (1, + LetUnpackT {binds = [(x1_14_65_113, + CursorTy), + (x2_15_66_114, + CursorTy)], + ptr = "tail_157", + bod = LetCallT {async = False, + binds = [(fltPkd_105_115, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x1_14_65_113"], + bod = LetCallT {async = False, + binds = [(fltPkd_106_116, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x2_15_66_114"], + bod = LetAllocT {lhs = "tailift_159", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_105_115"), + (CursorTy, + VarTriv "fltPkd_106_116")], + bod = RetValsT [VarTriv "tailift_159"]}}}})]) + (Just ErrT "Unknown tag in: tag_156")}, + isPure = True}, + FunDecl {funName = "_copy_Add_Tree_10", + funArgs = [(arg_28_67_117, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), + (tail_162, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_28_67_117"], + bod = Switch "switch_165" + (VarTriv "tag_161") + (IntAlts [(0, + LetUnpackT {binds = [(x_29_68_118, + IntTy)], + ptr = "tail_162", + bod = LetAllocT {lhs = "tailift_163", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_29_68_118")], + bod = RetValsT [VarTriv "tailift_163"]}}), + (1, + LetUnpackT {binds = [(x_31_70_120, + CursorTy), + (x_32_71_121, + CursorTy)], + ptr = "tail_162", + bod = LetCallT {async = False, + binds = [(y_33_72_122, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_31_70_120"], + bod = LetCallT {async = False, + binds = [(y_34_73_123, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_32_71_121"], + bod = LetAllocT {lhs = "tailift_164", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_33_72_122"), + (CursorTy, + VarTriv "y_34_73_123")], + bod = RetValsT [VarTriv "tailift_164"]}}}})]) + (Just ErrT "Unknown tag in: tag_161")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", + funArgs = [(arg_35_74_124, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), + (tail_167, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_35_74_124"], + bod = Switch "switch_170" + (VarTriv "tag_166") + (IntAlts [(0, + LetUnpackT {binds = [(x_36_75_125, + IntTy)], + ptr = "tail_167", + bod = LetAllocT {lhs = "tailift_168", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_36_75_125")], + bod = RetValsT [VarTriv "tailift_168"]}}), + (1, + LetUnpackT {binds = [(x_38_77_127, + CursorTy), + (x_39_78_128, + CursorTy)], + ptr = "tail_167", + bod = LetCallT {async = False, + binds = [(y_40_79_129, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_38_77_127"], + bod = LetCallT {async = False, + binds = [(y_41_80_130, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_39_78_128"], + bod = LetAllocT {lhs = "tailift_169", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_40_79_129"), + (CursorTy, + VarTriv "y_41_80_130")], + bod = RetValsT [VarTriv "tailift_169"]}}}})]) + (Just ErrT "Unknown tag in: tag_166")}, + isPure = True}, + FunDecl {funName = "_traverse_Add_Tree_10", + funArgs = [(arg_42_81_131, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), + (tail_172, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_42_81_131"], + bod = Switch "switch_173" + (VarTriv "tag_171") + (IntAlts [(0, + LetUnpackT {binds = [(x_43_82_132, + IntTy)], + ptr = "tail_172", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_45_83_133, + CursorTy), + (x_46_84_134, + CursorTy)], + ptr = "tail_172", + bod = LetCallT {async = False, + binds = [(y_47_85_135, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_45_83_133"], + bod = LetCallT {async = False, + binds = [(y_48_86_136, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_46_84_134"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_171")}, + isPure = True}, + FunDecl {funName = "_print_Add_Tree_10", + funArgs = [(arg_49_87_137, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), + (tail_175, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_49_87_137"], + bod = Switch "switch_176" + (VarTriv "tag_174") + (IntAlts [(0, + LetUnpackT {binds = [(x_50_88_138, + IntTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 154], + bod = LetPrimCallT {binds = [(wildcard_54_90_140, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetPrimCallT {binds = [(y_51_91_141, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_50_88_138"], + bod = LetPrimCallT {binds = [(wildcard_53_92_142, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_55_93_143, + CursorTy), + (x_56_94_144, + CursorTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 153], + bod = LetPrimCallT {binds = [(wildcard_62_96_146, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_57_97_147, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_55_93_143"], + bod = LetPrimCallT {binds = [(wildcard_61_98_148, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_58_99_149, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_56_94_144"], + bod = LetPrimCallT {binds = [(wildcard_60_100_150, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_174")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_102_107", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_103_108", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_101_109", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_102_107"), + (CursorTy, + VarTriv "fltPkd_103_108")], + bod = LetCallT {async = False, + binds = [(tmp_app_151, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "fltAppE_101_109"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_Add_Tree_10", + rands = [VarTriv "tmp_app_151"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}})} + + [compiler] Final C codegen: 11506 characters. +================================================================================ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +typedef struct GibIntGibIntProd_struct { + GibInt field0; + GibInt field1; + } GibIntGibIntProd; +typedef struct GibIntGibCursorGibCursorProd_struct { + GibInt field0; + GibCursor field1; + GibCursor field2; + } GibIntGibCursorGibCursorProd; +typedef struct GibPackedTagGibCursorProd_struct { + GibPackedTag field0; + GibCursor field1; + } GibPackedTagGibCursorProd; +typedef struct GibCursorProd_struct { + GibCursor field0; + } GibCursorProd; +typedef struct GibCursorGibCursorProd_struct { + GibCursor field0; + GibCursor field1; + } GibCursorGibCursorProd; +GibCursor Add_add1_11(GibCursor t_12_63_110); +GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117); +GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124); +unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131); +unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + Add_Tree_10_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(8); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[1]; + + error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 0, 8, 0, 1, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Add_Tree_10_T, 0); + exit(1); + } + error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 1, 0, 2, 0, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Add_Tree_10_T, 1); + exit(1); + } + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ + gib_add_symbol(152, ")"); + gib_add_symbol(153, "(Node"); + gib_add_symbol(154, "(Leaf"); + gib_add_symbol(155, " "); +} +GibCursor Add_add1_11(GibCursor t_12_63_110) +{ + GibPackedTag tag_156 = *(GibPackedTag *) t_12_63_110; + GibCursor tail_157 = t_12_63_110 + sizeof(GibInt); + + + switch_160: + ; + switch (tag_156) { + + case 0: + { + GibInt x_13_64_111 = ((GibIntProd *) tail_157)->field0; + GibInt fltPkd_104_112 = x_13_64_111 + 1; + GibPtr tailift_158 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_158)->field0 = 0; + ((GibIntGibIntProd *) tailift_158)->field1 = fltPkd_104_112; + return tailift_158; + break; + } + + case 1: + { + GibCursor x1_14_65_113 = + ((GibCursorGibCursorProd *) tail_157)->field0; + GibCursor x2_15_66_114 = + ((GibCursorGibCursorProd *) tail_157)->field1; + GibCursor fltPkd_105_115 = Add_add1_11(x1_14_65_113); + GibCursor fltPkd_106_116 = Add_add1_11(x2_15_66_114); + GibPtr tailift_159 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_159)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_159)->field1 = + fltPkd_105_115; + ((GibIntGibCursorGibCursorProd *) tailift_159)->field2 = + fltPkd_106_116; + return tailift_159; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_156"); + exit(1); + } + } +} +GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117) +{ + GibPackedTag tag_161 = *(GibPackedTag *) arg_28_67_117; + GibCursor tail_162 = arg_28_67_117 + sizeof(GibInt); + + + switch_165: + ; + switch (tag_161) { + + case 0: + { + GibInt x_29_68_118 = ((GibIntProd *) tail_162)->field0; + GibPtr tailift_163 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_163)->field0 = 0; + ((GibIntGibIntProd *) tailift_163)->field1 = x_29_68_118; + return tailift_163; + break; + } + + case 1: + { + GibCursor x_31_70_120 = + ((GibCursorGibCursorProd *) tail_162)->field0; + GibCursor x_32_71_121 = + ((GibCursorGibCursorProd *) tail_162)->field1; + GibCursor y_33_72_122 = _copy_Add_Tree_10(x_31_70_120); + GibCursor y_34_73_123 = _copy_Add_Tree_10(x_32_71_121); + GibPtr tailift_164 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_164)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_164)->field1 = + y_33_72_122; + ((GibIntGibCursorGibCursorProd *) tailift_164)->field2 = + y_34_73_123; + return tailift_164; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_161"); + exit(1); + } + } +} +GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124) +{ + GibPackedTag tag_166 = *(GibPackedTag *) arg_35_74_124; + GibCursor tail_167 = arg_35_74_124 + sizeof(GibInt); + + + switch_170: + ; + switch (tag_166) { + + case 0: + { + GibInt x_36_75_125 = ((GibIntProd *) tail_167)->field0; + GibPtr tailift_168 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_168)->field0 = 0; + ((GibIntGibIntProd *) tailift_168)->field1 = x_36_75_125; + return tailift_168; + break; + } + + case 1: + { + GibCursor x_38_77_127 = + ((GibCursorGibCursorProd *) tail_167)->field0; + GibCursor x_39_78_128 = + ((GibCursorGibCursorProd *) tail_167)->field1; + GibCursor y_40_79_129 = + _copy_without_ptrs_Add_Tree_10(x_38_77_127); + GibCursor y_41_80_130 = + _copy_without_ptrs_Add_Tree_10(x_39_78_128); + GibPtr tailift_169 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_169)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_169)->field1 = + y_40_79_129; + ((GibIntGibCursorGibCursorProd *) tailift_169)->field2 = + y_41_80_130; + return tailift_169; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_166"); + exit(1); + } + } +} +unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) +{ + GibPackedTag tag_171 = *(GibPackedTag *) arg_42_81_131; + GibCursor tail_172 = arg_42_81_131 + sizeof(GibInt); + + + switch_173: + ; + switch (tag_171) { + + case 0: + { + GibInt x_43_82_132 = ((GibIntProd *) tail_172)->field0; + + return 0; + break; + } + + case 1: + { + GibCursor x_45_83_133 = + ((GibCursorGibCursorProd *) tail_172)->field0; + GibCursor x_46_84_134 = + ((GibCursorGibCursorProd *) tail_172)->field1; + unsigned char y_47_85_135 = _traverse_Add_Tree_10(x_45_83_133); + unsigned char y_48_86_136 = _traverse_Add_Tree_10(x_46_84_134); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_171"); + exit(1); + } + } +} +unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) +{ + GibPackedTag tag_174 = *(GibPackedTag *) arg_49_87_137; + GibCursor tail_175 = arg_49_87_137 + sizeof(GibInt); + + + switch_176: + ; + switch (tag_174) { + + case 0: + { + GibInt x_50_88_138 = ((GibIntProd *) tail_175)->field0; + unsigned char wildcard_52_89_139 = gib_print_symbol(154); + unsigned char wildcard_54_90_140 = gib_print_symbol(155); + unsigned char y_51_91_141 = printf("%ld", x_50_88_138); + unsigned char wildcard_53_92_142 = gib_print_symbol(152); + + return 0; + break; + } + + case 1: + { + GibCursor x_55_93_143 = + ((GibCursorGibCursorProd *) tail_175)->field0; + GibCursor x_56_94_144 = + ((GibCursorGibCursorProd *) tail_175)->field1; + unsigned char wildcard_59_95_145 = gib_print_symbol(153); + unsigned char wildcard_62_96_146 = gib_print_symbol(155); + unsigned char y_57_97_147 = _print_Add_Tree_10(x_55_93_143); + unsigned char wildcard_61_98_148 = gib_print_symbol(155); + unsigned char y_58_99_149 = _print_Add_Tree_10(x_56_94_144); + unsigned char wildcard_60_100_150 = gib_print_symbol(152); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_174"); + exit(1); + } + } +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + GibPtr fltPkd_102_107 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_102_107)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_102_107)->field1 = 1; + + GibPtr fltPkd_103_108 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_103_108)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_103_108)->field1 = 2; + + GibPtr fltAppE_101_109 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field1 = fltPkd_102_107; + ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field2 = fltPkd_103_108; + + GibCursor tmp_app_151 = Add_add1_11(fltAppE_101_109); + + _print_Add_Tree_10(tmp_app_151); + printf("\n"); + return 0; + + int exit_1 = gib_exit(); + + return exit_1; +} + +Compiling RTS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +codegen: C RTS could not be compiled: +make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory +make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. + +Code: 2 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 13c891cb5..51e0d13b4 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,6 +200,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings + defs' = M.mapWithKey (\k dDef -> dDef {tyName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = @@ -277,7 +278,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports error $ "Conflicting definitions of " ++ show (S.toList em2) ++ " found in " ++ mod_name) - (defs, funs''') + (defs', funs''') imported_progs' pure (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index ae6fddaf8..4c9688ec3 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -24,65 +24,93 @@ type TyVarEnv t = M.Map TyVar t moduleRename :: Prog0 -> PassM Prog0 moduleRename (Prog defs funs main) = - do --main' <- case main of - -- Nothing -> return Nothing - -- Just (m,ty) -> do m' <- freshExp M.empty M.empty m - -- return $ Just (m',ty) - --defs' <- traverse freshDDef defs - --funs' <- *traverse map* resolveFunModuleNames funs + do + -- defs + renamedDefs <- mapM (\k -> (gensym k)) (M.keys defs) + let defNameMap = M.fromList $ zip (M.keys defs) renamedDefs + let initDefEnv :: VarEnv = M.empty + let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap + let transformDefKey :: Var -> Var + transformDefKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name defenv + + -- funs renamedFuns <- mapM (\k -> (gensym k)) (M.keys funs) - let nameMap = M.fromList $ zip (M.keys funs) renamedFuns - let init :: VarEnv = M.empty - let (env, _) = M.mapAccumWithKey buildEnv init nameMap - --let funs' = M.mapKeys (\k -> resolveNameInEnv () env) funs - let _ = dbgPrintLn 2 "hello?" - let transformKey :: Var -> Var - transformKey k = do + let funNameMap = M.fromList $ zip (M.keys funs) renamedFuns + let initFunEnv :: VarEnv = M.empty + let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap + let transformFunKey :: Var -> Var + transformFunKey k = do let (mod, name) = parseOutMod k - resolveNameInEnv mod name env - funs' <- traverse (\v -> resolveModsInFuns v defs env) funs - let funs'' = M.mapKeys transformKey funs' - return $ Prog defs funs'' main + resolveNameInEnv mod name funenv -buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) -buildEnv env k v = do - let (mod, name) = parseOutMod k - let mod' = case mod of - Just m -> m - Nothing -> (toVar "") - case (M.lookup name env) of - Just m -> - if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') - else ((M.insert name (M.insert mod' v m) env), v) - Nothing -> ((M.insert name (M.singleton mod' v) env), v) + -- main + main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- resolveModInExp m defenv funenv + return $ Just (m',ty) + + defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs + funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs -resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var -resolveNameInEnv mod name e = - do case (M.lookup name e) of - Just modspace -> case mod of - Just m -> case (M.lookup m modspace) of - Just n -> n - Nothing -> error $ "can't find function " ++ (fromVar name) ++ " in module " ++ (fromVar m) - Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find function " ++ (fromVar name) - Nothing -> error $ "can't find function " ++ (fromVar name) - -freshDDef :: DDef Ty0 -> PassM (DDef Ty0) -freshDDef DDef{tyName,tyArgs,dataCons} = - do pure $ DDef tyName tyArgs dataCons + let defs'' = M.mapKeys transformDefKey defs' + let funs'' = M.mapKeys transformFunKey funs' ---funRename :: FunDef Exp0 -> FunDef Exp0 ---funRename (FunDef nam nargs funty bod meta) = FunDef (gensym nam) nargs funty bod meta + return $ Prog defs'' funs'' main' -resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> VarEnv -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defs env = +resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) +resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = do - let (mod, name) = parseOutMod nam - bod' <- resolveModInBod bod env - pure $ FunDef (resolveNameInEnv mod name env) nargs funty bod' meta + let (mod, name) = parseOutMod tyName + let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons + pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' -resolveModInBod :: Exp0 -> VarEnv -> PassM Exp0 -resolveModInBod exp env = +resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = + do + let nam' = parseAndResolve nam funenv + let funty' = resolveModsInTyScheme funty defenv + bod' <- resolveModInExp bod defenv funenv + pure $ FunDef nam' nargs funty' bod' meta + +resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme +resolveModsInTyScheme (ForAll tvs ty) defenv = do + let ty' = resolveModInTy ty defenv + ForAll tvs ty' + +resolveModsInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) +resolveModsInDataCons (con, tys) defenv funenv = + do + let tys' = map (\(boxed, ty) -> (boxed, (resolveModInTy ty defenv))) tys + (con, tys') + +resolveModInTy :: Ty0 -> VarEnv -> Ty0 +resolveModInTy ty defenv = + case ty of + IntTy -> ty + CharTy -> ty + FloatTy -> ty + SymTy0 -> ty + BoolTy -> ty + ArenaTy -> ty + SymSetTy -> ty + SymHashTy -> ty + MetaTv{} -> ty + TyVar tv -> ty + ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys + SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv + PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) + ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) $ resolveModInTy t defenv + + PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys + + VectorTy el_t -> VectorTy $ resolveModInTy el_t defenv + ListTy el_t -> ListTy $ resolveModInTy el_t defenv + IntHashTy -> ty + +resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> PassM Exp0 +resolveModInExp exp defenv funenv = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c @@ -93,14 +121,14 @@ resolveModInBod exp env = AppE v locs ls -> do let (mod, fun) = parseOutMod v - let v' = resolveNameInEnv mod fun env + let v' = resolveNameInEnv mod fun funenv return $ AppE v' locs ls PrimAppE p es -> return $ PrimAppE p es LetE (v,_locs,ty, e1) e2 -> do - e1' <- resolveModInBod e1 env - e2' <- resolveModInBod e2 env + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv return $ LetE (v, [], ty, e1') e2' IfE e1 e2 e3 -> return $ IfE e1 e2 e3 @@ -108,14 +136,14 @@ resolveModInBod exp env = MkProdE es -> return $ MkProdE es CaseE e mp -> do - e' <- resolveModInBod e env + e' <- resolveModInExp e defenv funenv mp' <- mapM (\(c,prs,ae) -> do - ae' <- resolveModInBod ae env + ae' <- resolveModInExp ae defenv funenv return (c, prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- traverse (\v -> resolveModInBod v env) es + es' <- traverse (\v -> resolveModInExp v defenv funenv) es return $ DataConE loc c es' TimeIt e t b -> return $ TimeIt e t b @@ -126,9 +154,40 @@ resolveModInBod exp env = FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 Ext ext -> return $ Ext ext + +-- environment interactions + +buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv env k v = do + let (mod, name) = parseOutMod k + let mod' = case mod of + Just m -> m + Nothing -> (toVar "") + case (M.lookup name env) of + Just m -> + if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + else ((M.insert name (M.insert mod' v m) env), v) + Nothing -> ((M.insert name (M.singleton mod' v) env), v) + +parseAndResolve :: Var -> VarEnv -> Var +parseAndResolve v env = do + let (mod, name) = parseOutMod v + resolveNameInEnv mod name env + parseOutMod :: Var -> (Maybe Var, Var) parseOutMod v = do let str = (fromVar v) case (L.elemIndices '.' str) of [] -> (Nothing, v) - x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) \ No newline at end of file + x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) + +resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var +resolveNameInEnv mod name e = + do case (M.lookup name e) of + Just modspace -> case mod of + Just m -> case (M.lookup m modspace) of + Just n -> n + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find " ++ (fromVar name) + Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file From 27762265e14ed010d4abeb9393759175fa7eb32b Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 21 Nov 2023 15:22:36 -0800 Subject: [PATCH 07/68] added a pass to resolve imports in desugarModule --- gibbon-compiler/examples/AddTree.hs | 2 + gibbon-compiler/examples/Addone.hs | 10 +- gibbon-compiler/examples/Addtwo.hs | 12 +- gibbon-compiler/examples/addimport.hs | 7 +- gibbon-compiler/gibbon.cabal | 1 + gibbon-compiler/ir.log | 4537 +++++++++-------- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 13 +- .../src/Gibbon/Passes/ModuleFillImports.hs | 190 + .../src/Gibbon/Passes/ModuleRename.hs | 5 +- 9 files changed, 2766 insertions(+), 2011 deletions(-) create mode 100644 gibbon-compiler/examples/AddTree.hs create mode 100644 gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs diff --git a/gibbon-compiler/examples/AddTree.hs b/gibbon-compiler/examples/AddTree.hs new file mode 100644 index 000000000..1ac4ba955 --- /dev/null +++ b/gibbon-compiler/examples/AddTree.hs @@ -0,0 +1,2 @@ +module AddTree where + data Tree = Leaf Int | Node Tree Tree \ No newline at end of file diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs index 4f0a37bec..a32a620e5 100644 --- a/gibbon-compiler/examples/Addone.hs +++ b/gibbon-compiler/examples/Addone.hs @@ -1,10 +1,10 @@ module Addone where - data Tree = Leaf Int | Node Tree Tree + import AddTree - add/1 :: Tree -> Tree - add/1 t = case t of + add :: Tree -> Tree + add t = case t of Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) + Node x1 x2 -> Node (add x1) (add x2) main :: Tree - main = add1 (Node (Leaf 1) (Leaf 2)) + main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs index fe8682516..82c6216e3 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/Addtwo.hs @@ -1,10 +1,10 @@ module Addtwo where - data Tree = Leaf Int | Node Tree Tree + import AddTree - add/1 :: Tree -> Tree - add1 t = case t of - Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) + add :: Tree -> Tree + add t = case t of + Leaf x -> Leaf (x + 2) + Node x1 x2 -> Node (add x1) (add x2) main :: Tree - main = add1 (Node (Leaf 1) (Leaf 2)) + main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index f366dff69..baaa8d41a 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,5 +1,6 @@ -module Addimport where +module AddImport where import Addone + import Addtwo + import AddTree - main :: Tree - main = Addone.add1 2 (Addone.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = Addone.add (Addtwo.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index 07892070d..c3dfa7a1b 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -61,6 +61,7 @@ library -- compiler passes, roughly in the order they're run Gibbon.Passes.ModuleRename + Gibbon.Passes.ModuleFillImports Gibbon.Passes.Freshen Gibbon.Passes.Flatten Gibbon.Passes.InlineTriv diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index e0f9c3ec0..e8c6e79bf 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -1,18 +1,44 @@ ! Responding to env Var: GIBBON_DEBUG=4 ! We set DEBUG based on command-line verbose arg: 4 +================================================================================ + +desugaring module: AddImport + +- imports: ["Addone","Addtwo","AddTree"] + +================================================================================ + +desugaring module: Addone + +- imports: ["AddTree"] + +================================================================================ + +desugaring module: AddTree + +- imports: [] + +================================================================================ + +desugaring module: Addtwo + +- imports: ["AddTree"] + [compiler] pipeline starting, parsed program: ================================================================================ -Prog {ddefs = [(Add.Tree, - DDef {tyName = "Add.Tree", +Prog {ddefs = [(AddTree.Tree, + DDef {tyName = "AddTree.Tree", tyArgs = [], dataCons = [("Leaf", [(False, IntTy)]), ("Node", - [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], - fundefs = [(Add.add1, - FunDef {funName = "Add.add1", + [(False, PackedTy "AddTree.Tree" []), + (False, PackedTy "AddTree.Tree" [])])]})], + fundefs = [(Addone.add, + FunDef {funName = "Addone.add", funArgs = [t], funTy = ForAll [] - (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), funBody = CaseE (VarE "t") [("Leaf", [(x, MetaTv $2)], @@ -23,1530 +49,1824 @@ Prog {ddefs = [(Add.Tree, [(x1, MetaTv $4),(x2, MetaTv $5)], DataConE (MetaTv $3) "Node" - [AppE "Add.add1" [] [VarE "x1"], - AppE "Add.add1" [] [VarE "x2"]])], + [AppE "Addone.add" [] [VarE "x1"], + AppE "Addone.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.add, + FunDef {funName = "Addtwo.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addtwo.add" [] [VarE "x1"], + AppE "Addtwo.add" [] [VarE "x2"]])], funMeta = FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Add.add1" + mainExp = Just (AppE "Addone.add" [] - [DataConE (MetaTv $6) - "Node" - [DataConE (MetaTv $7) "Leaf" [LitE 1], - DataConE (MetaTv $8) "Leaf" [LitE 2]]], - MetaTv $9)} + [AppE "Addtwo.add" + [] + [DataConE (MetaTv $0) + "Node" + [DataConE (MetaTv $1) "Leaf" [LitE 1], + DataConE (MetaTv $2) "Leaf" [LitE 2]]]], + MetaTv $3)} [compiler] Running pass, renameModules Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t = +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t = case t of Leaf x::$2 -> (Leaf $1 x + 1) Node x1::$4 x2::$5 -> - (Node $3 (Add_add1_11 [] x1) (Add_add1_11 [] x2)) + (Node $3 (Addone_add_5 [] x1) (Addone_add_5 [] x2)) -gibbon_main :: $9 -gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 2) + Node x1::$4 x2::$5 -> + (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) + +gibbon_main :: $3 +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, freshen Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::$2 -> + (Leaf $1 x_8 + 1) + Node x1_9::$4 x2_10::$5 -> + (Node $3 (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::$2 -> - (Leaf $1 x_13 + 1) - Node x1_14::$4 x2_15::$5 -> - (Node $3 (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::$2 -> + (Leaf $1 x_12 + 2) + Node x1_13::$4 x2_14::$5 -> + (Node $3 (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: $9 -gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +gibbon_main :: $3 +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, bindLambdas Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, monomorphize Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, specLambdas Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, desugarL0 Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 1) - Node x1_14::() x2_15::() -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29::() -> - let y_30 :: Int = x_29 in - (Leaf () y_30) - Node x_31::() x_32::() -> - let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in - (Node () y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36::() -> - let y_37 :: Int = x_36 in - (Leaf () y_37) - Node x_38::() x_39::() -> - let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node () y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43::() -> - () - Node x_45::() x_46::() -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50::() -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55::() x_56::() -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::() -> + (Leaf () x_8 + 1) + Node x1_9::() x2_10::() -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::() -> + (Leaf () x_12 + 2) + Node x1_13::() x2_14::() -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40::() -> + let y_41 :: Int = x_40 in + (Leaf () y_41) + Node x_42::() x_43::() -> + let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in + (Node () y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47::() -> + let y_48 :: Int = x_47 in + (Leaf () y_48) + Node x_49::() x_50::() -> + let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node () y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54::() -> + () + Node x_56::() x_57::() -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61::() -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66::() x_67::() -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, floatOutCase Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::() -> + (Leaf () x_8 + 1) + Node x1_9::() x2_10::() -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 1) - Node x1_14::() x2_15::() -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29::() -> - let y_30 :: Int = x_29 in - (Leaf () y_30) - Node x_31::() x_32::() -> - let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in - (Node () y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36::() -> - let y_37 :: Int = x_36 in - (Leaf () y_37) - Node x_38::() x_39::() -> - let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node () y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43::() -> - () - Node x_45::() x_46::() -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50::() -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55::() x_56::() -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::() -> + (Leaf () x_12 + 2) + Node x1_13::() x2_14::() -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40::() -> + let y_41 :: Int = x_40 in + (Leaf () y_41) + Node x_42::() x_43::() -> + let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in + (Node () y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47::() -> + let y_48 :: Int = x_47 in + (Leaf () y_48) + Node x_49::() x_50::() -> + let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node () y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54::() -> + () + Node x_56::() x_57::() -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61::() -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66::() x_67::() -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, toL1 Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, benchMainExp Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, simplify Removed unused functions: [] Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63 = - case t_12_63 of - Leaf x_13_64 -> - (Leaf x_13_64 + 1) - Node x1_14_65 x2_15_66 -> - (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67 = - case arg_28_67 of - Leaf x_29_68 -> - let y_30_69 :: Int = x_29_68 in - (Leaf y_30_69) - Node x_31_70 x_32_71 -> - let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in - let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in - (Node y_33_72 y_34_73) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74 = - case arg_35_74 of - Leaf x_36_75 -> - let y_37_76 :: Int = x_36_75 in - (Leaf y_37_76) - Node x_38_77 x_39_78 -> - let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in - let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in - (Node y_40_79 y_41_80) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81 = - case arg_42_81 of - Leaf x_43_82 -> - () - Node x_45_83 x_46_84 -> - let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in - let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87 = - case arg_49_87 of - Leaf x_50_88 -> - let wildcard_52_89 :: () = printsym("(Leaf") in - let wildcard_54_90 :: () = printsym(" ") in - let y_51_91 :: () = printint(x_50_88) in - let wildcard_53_92 :: () = printsym(")") in - () - Node x_55_93 x_56_94 -> - let wildcard_59_95 :: () = printsym("(Node") in - let wildcard_62_96 :: () = printsym(" ") in - let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in - let wildcard_61_98 :: () = printsym(" ") in - let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in - let wildcard_60_100 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74 = + case t_7_74 of + Leaf x_8_75 -> + (Leaf x_8_75 + 1) + Node x1_9_76 x2_10_77 -> + (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78 = + case t_11_78 of + Leaf x_12_79 -> + (Leaf x_12_79 + 2) + Node x1_13_80 x2_14_81 -> + (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82 = + case arg_39_82 of + Leaf x_40_83 -> + let y_41_84 :: Int = x_40_83 in + (Leaf y_41_84) + Node x_42_85 x_43_86 -> + let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in + let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in + (Node y_44_87 y_45_88) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = + case arg_46_89 of + Leaf x_47_90 -> + let y_48_91 :: Int = x_47_90 in + (Leaf y_48_91) + Node x_49_92 x_50_93 -> + let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in + let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in + (Node y_51_94 y_52_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96 = + case arg_53_96 of + Leaf x_54_97 -> + () + Node x_56_98 x_57_99 -> + let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in + let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102 = + case arg_60_102 of + Leaf x_61_103 -> + let wildcard_63_104 :: () = printsym("(Leaf") in + let wildcard_65_105 :: () = printsym(" ") in + let y_62_106 :: () = printint(x_61_103) in + let wildcard_64_107 :: () = printsym(")") in + () + Node x_66_108 x_67_109 -> + let wildcard_70_110 :: () = printsym("(Node") in + let wildcard_73_111 :: () = printsym(" ") in + let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in + let wildcard_72_113 :: () = printsym(" ") in + let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in + let wildcard_71_115 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63 = - case t_12_63 of - Leaf x_13_64 -> - (Leaf x_13_64 + 1) - Node x1_14_65 x2_15_66 -> - (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67 = - case arg_28_67 of - Leaf x_29_68 -> - let y_30_69 :: Int = x_29_68 in - (Leaf y_30_69) - Node x_31_70 x_32_71 -> - let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in - let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in - (Node y_33_72 y_34_73) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74 = - case arg_35_74 of - Leaf x_36_75 -> - let y_37_76 :: Int = x_36_75 in - (Leaf y_37_76) - Node x_38_77 x_39_78 -> - let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in - let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in - (Node y_40_79 y_41_80) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81 = - case arg_42_81 of - Leaf x_43_82 -> - () - Node x_45_83 x_46_84 -> - let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in - let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87 = - case arg_49_87 of - Leaf x_50_88 -> - let wildcard_52_89 :: () = printsym("(Leaf") in - let wildcard_54_90 :: () = printsym(" ") in - let y_51_91 :: () = printint(x_50_88) in - let wildcard_53_92 :: () = printsym(")") in - () - Node x_55_93 x_56_94 -> - let wildcard_59_95 :: () = printsym("(Node") in - let wildcard_62_96 :: () = printsym(" ") in - let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in - let wildcard_61_98 :: () = printsym(" ") in - let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in - let wildcard_60_100 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74 = + case t_7_74 of + Leaf x_8_75 -> + (Leaf x_8_75 + 1) + Node x1_9_76 x2_10_77 -> + (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78 = + case t_11_78 of + Leaf x_12_79 -> + (Leaf x_12_79 + 2) + Node x1_13_80 x2_14_81 -> + (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82 = + case arg_39_82 of + Leaf x_40_83 -> + let y_41_84 :: Int = x_40_83 in + (Leaf y_41_84) + Node x_42_85 x_43_86 -> + let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in + let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in + (Node y_44_87 y_45_88) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = + case arg_46_89 of + Leaf x_47_90 -> + let y_48_91 :: Int = x_47_90 in + (Leaf y_48_91) + Node x_49_92 x_50_93 -> + let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in + let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in + (Node y_51_94 y_52_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96 = + case arg_53_96 of + Leaf x_54_97 -> + () + Node x_56_98 x_57_99 -> + let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in + let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102 = + case arg_60_102 of + Leaf x_61_103 -> + let wildcard_63_104 :: () = printsym("(Leaf") in + let wildcard_65_105 :: () = printsym(" ") in + let y_62_106 :: () = printint(x_61_103) in + let wildcard_64_107 :: () = printsym(")") in + () + Node x_66_108 x_67_109 -> + let wildcard_70_110 :: () = printsym("(Node") in + let wildcard_73_111 :: () = printsym(" ") in + let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in + let wildcard_72_113 :: () = printsym(" ") in + let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in + let wildcard_71_115 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, flatten Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63 = - case t_12_63 of - Leaf x_13_64 -> - let fltPkd_104 :: Int = x_13_64 + 1 in - (Leaf fltPkd_104) - Node x1_14_65 x2_15_66 -> - let fltPkd_105 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65) in - let fltPkd_106 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66) in - (Node fltPkd_105 fltPkd_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67 = - case arg_28_67 of - Leaf x_29_68 -> - let y_30_69 :: Int = x_29_68 in - (Leaf y_30_69) - Node x_31_70 x_32_71 -> - let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in - let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in - (Node y_33_72 y_34_73) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74 = - case arg_35_74 of - Leaf x_36_75 -> - let y_37_76 :: Int = x_36_75 in - (Leaf y_37_76) - Node x_38_77 x_39_78 -> - let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in - let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in - (Node y_40_79 y_41_80) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81 = - case arg_42_81 of - Leaf x_43_82 -> - () - Node x_45_83 x_46_84 -> - let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in - let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87 = - case arg_49_87 of - Leaf x_50_88 -> - let wildcard_52_89 :: () = printsym("(Leaf") in - let wildcard_54_90 :: () = printsym(" ") in - let y_51_91 :: () = printint(x_50_88) in - let wildcard_53_92 :: () = printsym(")") in - () - Node x_55_93 x_56_94 -> - let wildcard_59_95 :: () = printsym("(Node") in - let wildcard_62_96 :: () = printsym(" ") in - let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in - let wildcard_61_98 :: () = printsym(" ") in - let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in - let wildcard_60_100 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101 :: (Packed Add_Tree_10) = (Node fltPkd_102 fltPkd_103) in - (Add_add1_11 [] fltAppE_101) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74 = + case t_7_74 of + Leaf x_8_75 -> + let fltPkd_120 :: Int = x_8_75 + 1 in + (Leaf fltPkd_120) + Node x1_9_76 x2_10_77 -> + let fltPkd_121 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76) in + let fltPkd_122 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77) in + (Node fltPkd_121 fltPkd_122) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78 = + case t_11_78 of + Leaf x_12_79 -> + let fltPkd_123 :: Int = x_12_79 + 2 in + (Leaf fltPkd_123) + Node x1_13_80 x2_14_81 -> + let fltPkd_124 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80) in + let fltPkd_125 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81) in + (Node fltPkd_124 fltPkd_125) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82 = + case arg_39_82 of + Leaf x_40_83 -> + let y_41_84 :: Int = x_40_83 in + (Leaf y_41_84) + Node x_42_85 x_43_86 -> + let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in + let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in + (Node y_44_87 y_45_88) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = + case arg_46_89 of + Leaf x_47_90 -> + let y_48_91 :: Int = x_47_90 in + (Leaf y_48_91) + Node x_49_92 x_50_93 -> + let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in + let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in + (Node y_51_94 y_52_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96 = + case arg_53_96 of + Leaf x_54_97 -> + () + Node x_56_98 x_57_99 -> + let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in + let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102 = + case arg_60_102 of + Leaf x_61_103 -> + let wildcard_63_104 :: () = printsym("(Leaf") in + let wildcard_65_105 :: () = printsym(" ") in + let y_62_106 :: () = printint(x_61_103) in + let wildcard_64_107 :: () = printsym(")") in + () + Node x_66_108 x_67_109 -> + let wildcard_70_110 :: () = printsym("(Node") in + let wildcard_73_111 :: () = printsym(" ") in + let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in + let wildcard_72_113 :: () = printsym(" ") in + let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in + let wildcard_71_115 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117 :: (Packed AddTree_Tree_4) = (Node fltPkd_118 fltPkd_119) in + let fltAppE_116 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117) in + (Addone_add_5 [] fltAppE_116) [compiler] Running pass, simplify Removed unused functions: [] Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - let y_30_69_119 :: Int = x_29_68_118 in - (Leaf y_30_69_119) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - let y_37_76_126 :: Int = x_36_75_125 in - (Leaf y_37_76_126) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + let y_41_84_146 :: Int = x_40_83_145 in + (Leaf y_41_84_146) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + let y_48_91_153 :: Int = x_47_90_152 in + (Leaf y_48_91_153) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, inlineTriv Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, directL3 Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, unariser Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, L3.flatten Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, lower Pass output: ================================================================================ -Prog {infoTable = [("Add_Tree_10", +Prog {infoTable = [("AddTree_Tree_4", [("Leaf", DataConInfo {dcon_tag = 0, scalar_bytes = 8, @@ -1561,277 +1881,332 @@ Prog {infoTable = [("Add_Tree_10", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), - (155, " ")], - fundefs = [FunDecl {funName = "Add_add1_11", - funArgs = [(t_12_63_110, CursorTy)], + symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), + (182, " ")], + fundefs = [FunDecl {funName = "Addone_add_5", + funArgs = [(t_7_74_130, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), - (tail_157, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), + (tail_184, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_12_63_110"], - bod = Switch "switch_160" - (VarTriv "tag_156") + rands = [VarTriv "t_7_74_130"], + bod = Switch "switch_187" + (VarTriv "tag_183") (IntAlts [(0, - LetUnpackT {binds = [(x_13_64_111, + LetUnpackT {binds = [(x_8_75_131, IntTy)], - ptr = "tail_157", - bod = LetPrimCallT {binds = [(fltPkd_104_112, + ptr = "tail_184", + bod = LetPrimCallT {binds = [(fltPkd_120_132, IntTy)], prim = AddP, - rands = [VarTriv "x_13_64_111", + rands = [VarTriv "x_8_75_131", IntTriv 1], - bod = LetAllocT {lhs = "tailift_158", + bod = LetAllocT {lhs = "tailift_185", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_104_112")], - bod = RetValsT [VarTriv "tailift_158"]}}}), + VarTriv "fltPkd_120_132")], + bod = RetValsT [VarTriv "tailift_185"]}}}), (1, - LetUnpackT {binds = [(x1_14_65_113, + LetUnpackT {binds = [(x1_9_76_133, CursorTy), - (x2_15_66_114, + (x2_10_77_134, CursorTy)], - ptr = "tail_157", + ptr = "tail_184", bod = LetCallT {async = False, - binds = [(fltPkd_105_115, + binds = [(fltPkd_121_135, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x1_14_65_113"], + rator = "Addone_add_5", + rands = [VarTriv "x1_9_76_133"], bod = LetCallT {async = False, - binds = [(fltPkd_106_116, + binds = [(fltPkd_122_136, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x2_15_66_114"], - bod = LetAllocT {lhs = "tailift_159", + rator = "Addone_add_5", + rands = [VarTriv "x2_10_77_134"], + bod = LetAllocT {lhs = "tailift_186", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_105_115"), + VarTriv "fltPkd_121_135"), (CursorTy, - VarTriv "fltPkd_106_116")], - bod = RetValsT [VarTriv "tailift_159"]}}}})]) - (Just ErrT "Unknown tag in: tag_156")}, + VarTriv "fltPkd_122_136")], + bod = RetValsT [VarTriv "tailift_186"]}}}})]) + (Just ErrT "Unknown tag in: tag_183")}, isPure = True}, - FunDecl {funName = "_copy_Add_Tree_10", - funArgs = [(arg_28_67_117, CursorTy)], + FunDecl {funName = "Addtwo_add_6", + funArgs = [(t_11_78_137, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), - (tail_162, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), + (tail_189, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_28_67_117"], - bod = Switch "switch_165" - (VarTriv "tag_161") + rands = [VarTriv "t_11_78_137"], + bod = Switch "switch_192" + (VarTriv "tag_188") (IntAlts [(0, - LetUnpackT {binds = [(x_29_68_118, + LetUnpackT {binds = [(x_12_79_138, IntTy)], - ptr = "tail_162", - bod = LetAllocT {lhs = "tailift_163", + ptr = "tail_189", + bod = LetPrimCallT {binds = [(fltPkd_123_139, + IntTy)], + prim = AddP, + rands = [VarTriv "x_12_79_138", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_190", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_123_139")], + bod = RetValsT [VarTriv "tailift_190"]}}}), + (1, + LetUnpackT {binds = [(x1_13_80_140, + CursorTy), + (x2_14_81_141, + CursorTy)], + ptr = "tail_189", + bod = LetCallT {async = False, + binds = [(fltPkd_124_142, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x1_13_80_140"], + bod = LetCallT {async = False, + binds = [(fltPkd_125_143, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x2_14_81_141"], + bod = LetAllocT {lhs = "tailift_191", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_124_142"), + (CursorTy, + VarTriv "fltPkd_125_143")], + bod = RetValsT [VarTriv "tailift_191"]}}}})]) + (Just ErrT "Unknown tag in: tag_188")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_39_82_144, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), + (tail_194, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_39_82_144"], + bod = Switch "switch_197" + (VarTriv "tag_193") + (IntAlts [(0, + LetUnpackT {binds = [(x_40_83_145, + IntTy)], + ptr = "tail_194", + bod = LetAllocT {lhs = "tailift_195", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_29_68_118")], - bod = RetValsT [VarTriv "tailift_163"]}}), + VarTriv "x_40_83_145")], + bod = RetValsT [VarTriv "tailift_195"]}}), (1, - LetUnpackT {binds = [(x_31_70_120, + LetUnpackT {binds = [(x_42_85_147, CursorTy), - (x_32_71_121, + (x_43_86_148, CursorTy)], - ptr = "tail_162", + ptr = "tail_194", bod = LetCallT {async = False, - binds = [(y_33_72_122, + binds = [(y_44_87_149, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_31_70_120"], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_42_85_147"], bod = LetCallT {async = False, - binds = [(y_34_73_123, + binds = [(y_45_88_150, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_32_71_121"], - bod = LetAllocT {lhs = "tailift_164", + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_43_86_148"], + bod = LetAllocT {lhs = "tailift_196", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_33_72_122"), + VarTriv "y_44_87_149"), (CursorTy, - VarTriv "y_34_73_123")], - bod = RetValsT [VarTriv "tailift_164"]}}}})]) - (Just ErrT "Unknown tag in: tag_161")}, + VarTriv "y_45_88_150")], + bod = RetValsT [VarTriv "tailift_196"]}}}})]) + (Just ErrT "Unknown tag in: tag_193")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", - funArgs = [(arg_35_74_124, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_46_89_151, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), - (tail_167, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), + (tail_199, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_35_74_124"], - bod = Switch "switch_170" - (VarTriv "tag_166") + rands = [VarTriv "arg_46_89_151"], + bod = Switch "switch_202" + (VarTriv "tag_198") (IntAlts [(0, - LetUnpackT {binds = [(x_36_75_125, + LetUnpackT {binds = [(x_47_90_152, IntTy)], - ptr = "tail_167", - bod = LetAllocT {lhs = "tailift_168", + ptr = "tail_199", + bod = LetAllocT {lhs = "tailift_200", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_36_75_125")], - bod = RetValsT [VarTriv "tailift_168"]}}), + VarTriv "x_47_90_152")], + bod = RetValsT [VarTriv "tailift_200"]}}), (1, - LetUnpackT {binds = [(x_38_77_127, + LetUnpackT {binds = [(x_49_92_154, CursorTy), - (x_39_78_128, + (x_50_93_155, CursorTy)], - ptr = "tail_167", + ptr = "tail_199", bod = LetCallT {async = False, - binds = [(y_40_79_129, + binds = [(y_51_94_156, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_38_77_127"], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_49_92_154"], bod = LetCallT {async = False, - binds = [(y_41_80_130, + binds = [(y_52_95_157, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_39_78_128"], - bod = LetAllocT {lhs = "tailift_169", + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_50_93_155"], + bod = LetAllocT {lhs = "tailift_201", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_40_79_129"), + VarTriv "y_51_94_156"), (CursorTy, - VarTriv "y_41_80_130")], - bod = RetValsT [VarTriv "tailift_169"]}}}})]) - (Just ErrT "Unknown tag in: tag_166")}, + VarTriv "y_52_95_157")], + bod = RetValsT [VarTriv "tailift_201"]}}}})]) + (Just ErrT "Unknown tag in: tag_198")}, isPure = True}, - FunDecl {funName = "_traverse_Add_Tree_10", - funArgs = [(arg_42_81_131, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_53_96_158, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), - (tail_172, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), + (tail_204, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_42_81_131"], - bod = Switch "switch_173" - (VarTriv "tag_171") + rands = [VarTriv "arg_53_96_158"], + bod = Switch "switch_205" + (VarTriv "tag_203") (IntAlts [(0, - LetUnpackT {binds = [(x_43_82_132, + LetUnpackT {binds = [(x_54_97_159, IntTy)], - ptr = "tail_172", + ptr = "tail_204", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_45_83_133, + LetUnpackT {binds = [(x_56_98_160, CursorTy), - (x_46_84_134, + (x_57_99_161, CursorTy)], - ptr = "tail_172", + ptr = "tail_204", bod = LetCallT {async = False, - binds = [(y_47_85_135, + binds = [(y_58_100_162, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_45_83_133"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_56_98_160"], bod = LetCallT {async = False, - binds = [(y_48_86_136, + binds = [(y_59_101_163, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_46_84_134"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_57_99_161"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_171")}, + (Just ErrT "Unknown tag in: tag_203")}, isPure = True}, - FunDecl {funName = "_print_Add_Tree_10", - funArgs = [(arg_49_87_137, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_60_102_164, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), - (tail_175, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), + (tail_207, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_49_87_137"], - bod = Switch "switch_176" - (VarTriv "tag_174") + rands = [VarTriv "arg_60_102_164"], + bod = Switch "switch_208" + (VarTriv "tag_206") (IntAlts [(0, - LetUnpackT {binds = [(x_50_88_138, + LetUnpackT {binds = [(x_61_103_165, IntTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_63_104_166, ProdTy [])], prim = PrintSym, - rands = [SymTriv 154], - bod = LetPrimCallT {binds = [(wildcard_54_90_140, + rands = [SymTriv 181], + bod = LetPrimCallT {binds = [(wildcard_65_105_167, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], - bod = LetPrimCallT {binds = [(y_51_91_141, + rands = [SymTriv 182], + bod = LetPrimCallT {binds = [(y_62_106_168, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_50_88_138"], - bod = LetPrimCallT {binds = [(wildcard_53_92_142, + rands = [VarTriv "x_61_103_165"], + bod = LetPrimCallT {binds = [(wildcard_64_107_169, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_55_93_143, + LetUnpackT {binds = [(x_66_108_170, CursorTy), - (x_56_94_144, + (x_67_109_171, CursorTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_70_110_172, ProdTy [])], prim = PrintSym, - rands = [SymTriv 153], - bod = LetPrimCallT {binds = [(wildcard_62_96_146, + rands = [SymTriv 180], + bod = LetPrimCallT {binds = [(wildcard_73_111_173, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_57_97_147, + binds = [(y_68_112_174, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_55_93_143"], - bod = LetPrimCallT {binds = [(wildcard_61_98_148, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_66_108_170"], + bod = LetPrimCallT {binds = [(wildcard_72_113_175, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_58_99_149, + binds = [(y_69_114_176, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_56_94_144"], - bod = LetPrimCallT {binds = [(wildcard_60_100_150, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_67_109_171"], + bod = LetPrimCallT {binds = [(wildcard_71_115_177, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_174")}, + (Just ErrT "Unknown tag in: tag_206")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_102_107", + {lhs = "fltPkd_118_126", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_103_108", + bod = LetAllocT {lhs = "fltPkd_119_127", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_101_109", + bod = LetAllocT {lhs = "fltAppE_117_128", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_102_107"), + VarTriv "fltPkd_118_126"), (CursorTy, - VarTriv "fltPkd_103_108")], + VarTriv "fltPkd_119_127")], bod = LetCallT {async = False, - binds = [(tmp_app_151, + binds = [(fltAppE_116_129, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "fltAppE_101_109"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_117_128"], bod = LetCallT {async = False, - binds = [], - rator = "_print_Add_Tree_10", - rands = [VarTriv "tmp_app_151"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}})} + binds = [(tmp_app_178, + CursorTy)], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_116_129"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_178"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} [compiler] Running pass, lateInlineTriv Pass output: ================================================================================ -Prog {infoTable = [("Add_Tree_10", +Prog {infoTable = [("AddTree_Tree_4", [("Leaf", DataConInfo {dcon_tag = 0, scalar_bytes = 8, @@ -1846,277 +2221,332 @@ Prog {infoTable = [("Add_Tree_10", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), - (155, " ")], - fundefs = [FunDecl {funName = "Add_add1_11", - funArgs = [(t_12_63_110, CursorTy)], + symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), + (182, " ")], + fundefs = [FunDecl {funName = "Addone_add_5", + funArgs = [(t_7_74_130, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), - (tail_157, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), + (tail_184, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_12_63_110"], - bod = Switch "switch_160" - (VarTriv "tag_156") + rands = [VarTriv "t_7_74_130"], + bod = Switch "switch_187" + (VarTriv "tag_183") (IntAlts [(0, - LetUnpackT {binds = [(x_13_64_111, + LetUnpackT {binds = [(x_8_75_131, IntTy)], - ptr = "tail_157", - bod = LetPrimCallT {binds = [(fltPkd_104_112, + ptr = "tail_184", + bod = LetPrimCallT {binds = [(fltPkd_120_132, IntTy)], prim = AddP, - rands = [VarTriv "x_13_64_111", + rands = [VarTriv "x_8_75_131", IntTriv 1], - bod = LetAllocT {lhs = "tailift_158", + bod = LetAllocT {lhs = "tailift_185", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_104_112")], - bod = RetValsT [VarTriv "tailift_158"]}}}), + VarTriv "fltPkd_120_132")], + bod = RetValsT [VarTriv "tailift_185"]}}}), (1, - LetUnpackT {binds = [(x1_14_65_113, + LetUnpackT {binds = [(x1_9_76_133, CursorTy), - (x2_15_66_114, + (x2_10_77_134, CursorTy)], - ptr = "tail_157", + ptr = "tail_184", bod = LetCallT {async = False, - binds = [(fltPkd_105_115, + binds = [(fltPkd_121_135, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x1_14_65_113"], + rator = "Addone_add_5", + rands = [VarTriv "x1_9_76_133"], bod = LetCallT {async = False, - binds = [(fltPkd_106_116, + binds = [(fltPkd_122_136, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x2_15_66_114"], - bod = LetAllocT {lhs = "tailift_159", + rator = "Addone_add_5", + rands = [VarTriv "x2_10_77_134"], + bod = LetAllocT {lhs = "tailift_186", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_105_115"), + VarTriv "fltPkd_121_135"), (CursorTy, - VarTriv "fltPkd_106_116")], - bod = RetValsT [VarTriv "tailift_159"]}}}})]) - (Just ErrT "Unknown tag in: tag_156")}, + VarTriv "fltPkd_122_136")], + bod = RetValsT [VarTriv "tailift_186"]}}}})]) + (Just ErrT "Unknown tag in: tag_183")}, isPure = True}, - FunDecl {funName = "_copy_Add_Tree_10", - funArgs = [(arg_28_67_117, CursorTy)], + FunDecl {funName = "Addtwo_add_6", + funArgs = [(t_11_78_137, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), - (tail_162, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), + (tail_189, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_28_67_117"], - bod = Switch "switch_165" - (VarTriv "tag_161") + rands = [VarTriv "t_11_78_137"], + bod = Switch "switch_192" + (VarTriv "tag_188") (IntAlts [(0, - LetUnpackT {binds = [(x_29_68_118, + LetUnpackT {binds = [(x_12_79_138, IntTy)], - ptr = "tail_162", - bod = LetAllocT {lhs = "tailift_163", + ptr = "tail_189", + bod = LetPrimCallT {binds = [(fltPkd_123_139, + IntTy)], + prim = AddP, + rands = [VarTriv "x_12_79_138", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_190", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_123_139")], + bod = RetValsT [VarTriv "tailift_190"]}}}), + (1, + LetUnpackT {binds = [(x1_13_80_140, + CursorTy), + (x2_14_81_141, + CursorTy)], + ptr = "tail_189", + bod = LetCallT {async = False, + binds = [(fltPkd_124_142, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x1_13_80_140"], + bod = LetCallT {async = False, + binds = [(fltPkd_125_143, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x2_14_81_141"], + bod = LetAllocT {lhs = "tailift_191", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_124_142"), + (CursorTy, + VarTriv "fltPkd_125_143")], + bod = RetValsT [VarTriv "tailift_191"]}}}})]) + (Just ErrT "Unknown tag in: tag_188")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_39_82_144, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), + (tail_194, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_39_82_144"], + bod = Switch "switch_197" + (VarTriv "tag_193") + (IntAlts [(0, + LetUnpackT {binds = [(x_40_83_145, + IntTy)], + ptr = "tail_194", + bod = LetAllocT {lhs = "tailift_195", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_29_68_118")], - bod = RetValsT [VarTriv "tailift_163"]}}), + VarTriv "x_40_83_145")], + bod = RetValsT [VarTriv "tailift_195"]}}), (1, - LetUnpackT {binds = [(x_31_70_120, + LetUnpackT {binds = [(x_42_85_147, CursorTy), - (x_32_71_121, + (x_43_86_148, CursorTy)], - ptr = "tail_162", + ptr = "tail_194", bod = LetCallT {async = False, - binds = [(y_33_72_122, + binds = [(y_44_87_149, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_31_70_120"], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_42_85_147"], bod = LetCallT {async = False, - binds = [(y_34_73_123, + binds = [(y_45_88_150, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_32_71_121"], - bod = LetAllocT {lhs = "tailift_164", + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_43_86_148"], + bod = LetAllocT {lhs = "tailift_196", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_33_72_122"), + VarTriv "y_44_87_149"), (CursorTy, - VarTriv "y_34_73_123")], - bod = RetValsT [VarTriv "tailift_164"]}}}})]) - (Just ErrT "Unknown tag in: tag_161")}, + VarTriv "y_45_88_150")], + bod = RetValsT [VarTriv "tailift_196"]}}}})]) + (Just ErrT "Unknown tag in: tag_193")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", - funArgs = [(arg_35_74_124, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_46_89_151, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), - (tail_167, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), + (tail_199, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_35_74_124"], - bod = Switch "switch_170" - (VarTriv "tag_166") + rands = [VarTriv "arg_46_89_151"], + bod = Switch "switch_202" + (VarTriv "tag_198") (IntAlts [(0, - LetUnpackT {binds = [(x_36_75_125, + LetUnpackT {binds = [(x_47_90_152, IntTy)], - ptr = "tail_167", - bod = LetAllocT {lhs = "tailift_168", + ptr = "tail_199", + bod = LetAllocT {lhs = "tailift_200", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_36_75_125")], - bod = RetValsT [VarTriv "tailift_168"]}}), + VarTriv "x_47_90_152")], + bod = RetValsT [VarTriv "tailift_200"]}}), (1, - LetUnpackT {binds = [(x_38_77_127, + LetUnpackT {binds = [(x_49_92_154, CursorTy), - (x_39_78_128, + (x_50_93_155, CursorTy)], - ptr = "tail_167", + ptr = "tail_199", bod = LetCallT {async = False, - binds = [(y_40_79_129, + binds = [(y_51_94_156, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_38_77_127"], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_49_92_154"], bod = LetCallT {async = False, - binds = [(y_41_80_130, + binds = [(y_52_95_157, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_39_78_128"], - bod = LetAllocT {lhs = "tailift_169", + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_50_93_155"], + bod = LetAllocT {lhs = "tailift_201", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_40_79_129"), + VarTriv "y_51_94_156"), (CursorTy, - VarTriv "y_41_80_130")], - bod = RetValsT [VarTriv "tailift_169"]}}}})]) - (Just ErrT "Unknown tag in: tag_166")}, + VarTriv "y_52_95_157")], + bod = RetValsT [VarTriv "tailift_201"]}}}})]) + (Just ErrT "Unknown tag in: tag_198")}, isPure = True}, - FunDecl {funName = "_traverse_Add_Tree_10", - funArgs = [(arg_42_81_131, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_53_96_158, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), - (tail_172, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), + (tail_204, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_42_81_131"], - bod = Switch "switch_173" - (VarTriv "tag_171") + rands = [VarTriv "arg_53_96_158"], + bod = Switch "switch_205" + (VarTriv "tag_203") (IntAlts [(0, - LetUnpackT {binds = [(x_43_82_132, + LetUnpackT {binds = [(x_54_97_159, IntTy)], - ptr = "tail_172", + ptr = "tail_204", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_45_83_133, + LetUnpackT {binds = [(x_56_98_160, CursorTy), - (x_46_84_134, + (x_57_99_161, CursorTy)], - ptr = "tail_172", + ptr = "tail_204", bod = LetCallT {async = False, - binds = [(y_47_85_135, + binds = [(y_58_100_162, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_45_83_133"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_56_98_160"], bod = LetCallT {async = False, - binds = [(y_48_86_136, + binds = [(y_59_101_163, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_46_84_134"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_57_99_161"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_171")}, + (Just ErrT "Unknown tag in: tag_203")}, isPure = True}, - FunDecl {funName = "_print_Add_Tree_10", - funArgs = [(arg_49_87_137, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_60_102_164, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), - (tail_175, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), + (tail_207, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_49_87_137"], - bod = Switch "switch_176" - (VarTriv "tag_174") + rands = [VarTriv "arg_60_102_164"], + bod = Switch "switch_208" + (VarTriv "tag_206") (IntAlts [(0, - LetUnpackT {binds = [(x_50_88_138, + LetUnpackT {binds = [(x_61_103_165, IntTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_63_104_166, ProdTy [])], prim = PrintSym, - rands = [SymTriv 154], - bod = LetPrimCallT {binds = [(wildcard_54_90_140, + rands = [SymTriv 181], + bod = LetPrimCallT {binds = [(wildcard_65_105_167, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], - bod = LetPrimCallT {binds = [(y_51_91_141, + rands = [SymTriv 182], + bod = LetPrimCallT {binds = [(y_62_106_168, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_50_88_138"], - bod = LetPrimCallT {binds = [(wildcard_53_92_142, + rands = [VarTriv "x_61_103_165"], + bod = LetPrimCallT {binds = [(wildcard_64_107_169, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_55_93_143, + LetUnpackT {binds = [(x_66_108_170, CursorTy), - (x_56_94_144, + (x_67_109_171, CursorTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_70_110_172, ProdTy [])], prim = PrintSym, - rands = [SymTriv 153], - bod = LetPrimCallT {binds = [(wildcard_62_96_146, + rands = [SymTriv 180], + bod = LetPrimCallT {binds = [(wildcard_73_111_173, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_57_97_147, + binds = [(y_68_112_174, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_55_93_143"], - bod = LetPrimCallT {binds = [(wildcard_61_98_148, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_66_108_170"], + bod = LetPrimCallT {binds = [(wildcard_72_113_175, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_58_99_149, + binds = [(y_69_114_176, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_56_94_144"], - bod = LetPrimCallT {binds = [(wildcard_60_100_150, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_67_109_171"], + bod = LetPrimCallT {binds = [(wildcard_71_115_177, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_174")}, + (Just ErrT "Unknown tag in: tag_206")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_102_107", + {lhs = "fltPkd_118_126", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_103_108", + bod = LetAllocT {lhs = "fltPkd_119_127", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_101_109", + bod = LetAllocT {lhs = "fltAppE_117_128", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_102_107"), + VarTriv "fltPkd_118_126"), (CursorTy, - VarTriv "fltPkd_103_108")], + VarTriv "fltPkd_119_127")], bod = LetCallT {async = False, - binds = [(tmp_app_151, + binds = [(fltAppE_116_129, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "fltAppE_101_109"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_117_128"], bod = LetCallT {async = False, - binds = [], - rator = "_print_Add_Tree_10", - rands = [VarTriv "tmp_app_151"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}})} + binds = [(tmp_app_178, + CursorTy)], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_116_129"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_178"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} [compiler] Running pass, rearrangeFree Pass output: ================================================================================ -Prog {infoTable = [("Add_Tree_10", +Prog {infoTable = [("AddTree_Tree_4", [("Leaf", DataConInfo {dcon_tag = 0, scalar_bytes = 8, @@ -2131,274 +2561,329 @@ Prog {infoTable = [("Add_Tree_10", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), - (155, " ")], - fundefs = [FunDecl {funName = "Add_add1_11", - funArgs = [(t_12_63_110, CursorTy)], + symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), + (182, " ")], + fundefs = [FunDecl {funName = "Addone_add_5", + funArgs = [(t_7_74_130, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), - (tail_157, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), + (tail_184, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_12_63_110"], - bod = Switch "switch_160" - (VarTriv "tag_156") + rands = [VarTriv "t_7_74_130"], + bod = Switch "switch_187" + (VarTriv "tag_183") (IntAlts [(0, - LetUnpackT {binds = [(x_13_64_111, + LetUnpackT {binds = [(x_8_75_131, IntTy)], - ptr = "tail_157", - bod = LetPrimCallT {binds = [(fltPkd_104_112, + ptr = "tail_184", + bod = LetPrimCallT {binds = [(fltPkd_120_132, IntTy)], prim = AddP, - rands = [VarTriv "x_13_64_111", + rands = [VarTriv "x_8_75_131", IntTriv 1], - bod = LetAllocT {lhs = "tailift_158", + bod = LetAllocT {lhs = "tailift_185", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_104_112")], - bod = RetValsT [VarTriv "tailift_158"]}}}), + VarTriv "fltPkd_120_132")], + bod = RetValsT [VarTriv "tailift_185"]}}}), (1, - LetUnpackT {binds = [(x1_14_65_113, + LetUnpackT {binds = [(x1_9_76_133, CursorTy), - (x2_15_66_114, + (x2_10_77_134, CursorTy)], - ptr = "tail_157", + ptr = "tail_184", bod = LetCallT {async = False, - binds = [(fltPkd_105_115, + binds = [(fltPkd_121_135, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x1_14_65_113"], + rator = "Addone_add_5", + rands = [VarTriv "x1_9_76_133"], bod = LetCallT {async = False, - binds = [(fltPkd_106_116, + binds = [(fltPkd_122_136, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x2_15_66_114"], - bod = LetAllocT {lhs = "tailift_159", + rator = "Addone_add_5", + rands = [VarTriv "x2_10_77_134"], + bod = LetAllocT {lhs = "tailift_186", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_105_115"), + VarTriv "fltPkd_121_135"), (CursorTy, - VarTriv "fltPkd_106_116")], - bod = RetValsT [VarTriv "tailift_159"]}}}})]) - (Just ErrT "Unknown tag in: tag_156")}, + VarTriv "fltPkd_122_136")], + bod = RetValsT [VarTriv "tailift_186"]}}}})]) + (Just ErrT "Unknown tag in: tag_183")}, isPure = True}, - FunDecl {funName = "_copy_Add_Tree_10", - funArgs = [(arg_28_67_117, CursorTy)], + FunDecl {funName = "Addtwo_add_6", + funArgs = [(t_11_78_137, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), - (tail_162, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), + (tail_189, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_28_67_117"], - bod = Switch "switch_165" - (VarTriv "tag_161") + rands = [VarTriv "t_11_78_137"], + bod = Switch "switch_192" + (VarTriv "tag_188") (IntAlts [(0, - LetUnpackT {binds = [(x_29_68_118, + LetUnpackT {binds = [(x_12_79_138, IntTy)], - ptr = "tail_162", - bod = LetAllocT {lhs = "tailift_163", + ptr = "tail_189", + bod = LetPrimCallT {binds = [(fltPkd_123_139, + IntTy)], + prim = AddP, + rands = [VarTriv "x_12_79_138", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_190", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_123_139")], + bod = RetValsT [VarTriv "tailift_190"]}}}), + (1, + LetUnpackT {binds = [(x1_13_80_140, + CursorTy), + (x2_14_81_141, + CursorTy)], + ptr = "tail_189", + bod = LetCallT {async = False, + binds = [(fltPkd_124_142, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x1_13_80_140"], + bod = LetCallT {async = False, + binds = [(fltPkd_125_143, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x2_14_81_141"], + bod = LetAllocT {lhs = "tailift_191", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_124_142"), + (CursorTy, + VarTriv "fltPkd_125_143")], + bod = RetValsT [VarTriv "tailift_191"]}}}})]) + (Just ErrT "Unknown tag in: tag_188")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_39_82_144, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), + (tail_194, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_39_82_144"], + bod = Switch "switch_197" + (VarTriv "tag_193") + (IntAlts [(0, + LetUnpackT {binds = [(x_40_83_145, + IntTy)], + ptr = "tail_194", + bod = LetAllocT {lhs = "tailift_195", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_29_68_118")], - bod = RetValsT [VarTriv "tailift_163"]}}), + VarTriv "x_40_83_145")], + bod = RetValsT [VarTriv "tailift_195"]}}), (1, - LetUnpackT {binds = [(x_31_70_120, + LetUnpackT {binds = [(x_42_85_147, CursorTy), - (x_32_71_121, + (x_43_86_148, CursorTy)], - ptr = "tail_162", + ptr = "tail_194", bod = LetCallT {async = False, - binds = [(y_33_72_122, + binds = [(y_44_87_149, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_31_70_120"], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_42_85_147"], bod = LetCallT {async = False, - binds = [(y_34_73_123, + binds = [(y_45_88_150, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_32_71_121"], - bod = LetAllocT {lhs = "tailift_164", + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_43_86_148"], + bod = LetAllocT {lhs = "tailift_196", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_33_72_122"), + VarTriv "y_44_87_149"), (CursorTy, - VarTriv "y_34_73_123")], - bod = RetValsT [VarTriv "tailift_164"]}}}})]) - (Just ErrT "Unknown tag in: tag_161")}, + VarTriv "y_45_88_150")], + bod = RetValsT [VarTriv "tailift_196"]}}}})]) + (Just ErrT "Unknown tag in: tag_193")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", - funArgs = [(arg_35_74_124, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_46_89_151, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), - (tail_167, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), + (tail_199, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_35_74_124"], - bod = Switch "switch_170" - (VarTriv "tag_166") + rands = [VarTriv "arg_46_89_151"], + bod = Switch "switch_202" + (VarTriv "tag_198") (IntAlts [(0, - LetUnpackT {binds = [(x_36_75_125, + LetUnpackT {binds = [(x_47_90_152, IntTy)], - ptr = "tail_167", - bod = LetAllocT {lhs = "tailift_168", + ptr = "tail_199", + bod = LetAllocT {lhs = "tailift_200", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_36_75_125")], - bod = RetValsT [VarTriv "tailift_168"]}}), + VarTriv "x_47_90_152")], + bod = RetValsT [VarTriv "tailift_200"]}}), (1, - LetUnpackT {binds = [(x_38_77_127, + LetUnpackT {binds = [(x_49_92_154, CursorTy), - (x_39_78_128, + (x_50_93_155, CursorTy)], - ptr = "tail_167", + ptr = "tail_199", bod = LetCallT {async = False, - binds = [(y_40_79_129, + binds = [(y_51_94_156, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_38_77_127"], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_49_92_154"], bod = LetCallT {async = False, - binds = [(y_41_80_130, + binds = [(y_52_95_157, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_39_78_128"], - bod = LetAllocT {lhs = "tailift_169", + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_50_93_155"], + bod = LetAllocT {lhs = "tailift_201", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_40_79_129"), + VarTriv "y_51_94_156"), (CursorTy, - VarTriv "y_41_80_130")], - bod = RetValsT [VarTriv "tailift_169"]}}}})]) - (Just ErrT "Unknown tag in: tag_166")}, + VarTriv "y_52_95_157")], + bod = RetValsT [VarTriv "tailift_201"]}}}})]) + (Just ErrT "Unknown tag in: tag_198")}, isPure = True}, - FunDecl {funName = "_traverse_Add_Tree_10", - funArgs = [(arg_42_81_131, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_53_96_158, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), - (tail_172, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), + (tail_204, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_42_81_131"], - bod = Switch "switch_173" - (VarTriv "tag_171") + rands = [VarTriv "arg_53_96_158"], + bod = Switch "switch_205" + (VarTriv "tag_203") (IntAlts [(0, - LetUnpackT {binds = [(x_43_82_132, + LetUnpackT {binds = [(x_54_97_159, IntTy)], - ptr = "tail_172", + ptr = "tail_204", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_45_83_133, + LetUnpackT {binds = [(x_56_98_160, CursorTy), - (x_46_84_134, + (x_57_99_161, CursorTy)], - ptr = "tail_172", + ptr = "tail_204", bod = LetCallT {async = False, - binds = [(y_47_85_135, + binds = [(y_58_100_162, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_45_83_133"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_56_98_160"], bod = LetCallT {async = False, - binds = [(y_48_86_136, + binds = [(y_59_101_163, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_46_84_134"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_57_99_161"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_171")}, + (Just ErrT "Unknown tag in: tag_203")}, isPure = True}, - FunDecl {funName = "_print_Add_Tree_10", - funArgs = [(arg_49_87_137, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_60_102_164, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), - (tail_175, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), + (tail_207, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_49_87_137"], - bod = Switch "switch_176" - (VarTriv "tag_174") + rands = [VarTriv "arg_60_102_164"], + bod = Switch "switch_208" + (VarTriv "tag_206") (IntAlts [(0, - LetUnpackT {binds = [(x_50_88_138, + LetUnpackT {binds = [(x_61_103_165, IntTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_63_104_166, ProdTy [])], prim = PrintSym, - rands = [SymTriv 154], - bod = LetPrimCallT {binds = [(wildcard_54_90_140, + rands = [SymTriv 181], + bod = LetPrimCallT {binds = [(wildcard_65_105_167, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], - bod = LetPrimCallT {binds = [(y_51_91_141, + rands = [SymTriv 182], + bod = LetPrimCallT {binds = [(y_62_106_168, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_50_88_138"], - bod = LetPrimCallT {binds = [(wildcard_53_92_142, + rands = [VarTriv "x_61_103_165"], + bod = LetPrimCallT {binds = [(wildcard_64_107_169, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_55_93_143, + LetUnpackT {binds = [(x_66_108_170, CursorTy), - (x_56_94_144, + (x_67_109_171, CursorTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_70_110_172, ProdTy [])], prim = PrintSym, - rands = [SymTriv 153], - bod = LetPrimCallT {binds = [(wildcard_62_96_146, + rands = [SymTriv 180], + bod = LetPrimCallT {binds = [(wildcard_73_111_173, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_57_97_147, + binds = [(y_68_112_174, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_55_93_143"], - bod = LetPrimCallT {binds = [(wildcard_61_98_148, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_66_108_170"], + bod = LetPrimCallT {binds = [(wildcard_72_113_175, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_58_99_149, + binds = [(y_69_114_176, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_56_94_144"], - bod = LetPrimCallT {binds = [(wildcard_60_100_150, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_67_109_171"], + bod = LetPrimCallT {binds = [(wildcard_71_115_177, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_174")}, + (Just ErrT "Unknown tag in: tag_206")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_102_107", + {lhs = "fltPkd_118_126", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_103_108", + bod = LetAllocT {lhs = "fltPkd_119_127", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_101_109", + bod = LetAllocT {lhs = "fltAppE_117_128", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_102_107"), + VarTriv "fltPkd_118_126"), (CursorTy, - VarTriv "fltPkd_103_108")], + VarTriv "fltPkd_119_127")], bod = LetCallT {async = False, - binds = [(tmp_app_151, + binds = [(fltAppE_116_129, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "fltAppE_101_109"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_117_128"], bod = LetCallT {async = False, - binds = [], - rator = "_print_Add_Tree_10", - rands = [VarTriv "tmp_app_151"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}})} - - [compiler] Final C codegen: 11506 characters. + binds = [(tmp_app_178, + CursorTy)], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_116_129"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_178"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Final C codegen: 13304 characters. ================================================================================ /* Gibbon program. */ @@ -2464,11 +2949,12 @@ typedef struct GibCursorGibCursorProd_struct { GibCursor field0; GibCursor field1; } GibCursorGibCursorProd; -GibCursor Add_add1_11(GibCursor t_12_63_110); -GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117); -GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124); -unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131); -unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137); +GibCursor Addone_add_5(GibCursor t_7_74_130); +GibCursor Addtwo_add_6(GibCursor t_11_78_137); +GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144); +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151); +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158); +unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164); typedef enum { GibInt_T, GibFloat_T, @@ -2477,7 +2963,7 @@ typedef enum { GibVector_T, GibList_T, GibCursor_T, - Add_Tree_10_T, + AddTree_Tree_4_T, } GibDatatype; void info_table_initialize(void) { @@ -2490,191 +2976,240 @@ void info_table_initialize(void) GibDatatype field_tys[1]; - error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 0, 8, 0, 1, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, Add_Tree_10_T, 0); + error, AddTree_Tree_4_T, 0); exit(1); } - error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 1, 0, 2, 0, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, Add_Tree_10_T, 1); + error, AddTree_Tree_4_T, 1); exit(1); } gib_info_table_finalize(); } void symbol_table_initialize(void) { - gib_add_symbol(152, ")"); - gib_add_symbol(153, "(Node"); - gib_add_symbol(154, "(Leaf"); - gib_add_symbol(155, " "); + gib_add_symbol(179, ")"); + gib_add_symbol(180, "(Node"); + gib_add_symbol(181, "(Leaf"); + gib_add_symbol(182, " "); +} +GibCursor Addone_add_5(GibCursor t_7_74_130) +{ + GibPackedTag tag_183 = *(GibPackedTag *) t_7_74_130; + GibCursor tail_184 = t_7_74_130 + sizeof(GibInt); + + + switch_187: + ; + switch (tag_183) { + + case 0: + { + GibInt x_8_75_131 = ((GibIntProd *) tail_184)->field0; + GibInt fltPkd_120_132 = x_8_75_131 + 1; + GibPtr tailift_185 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_185)->field0 = 0; + ((GibIntGibIntProd *) tailift_185)->field1 = fltPkd_120_132; + return tailift_185; + break; + } + + case 1: + { + GibCursor x1_9_76_133 = + ((GibCursorGibCursorProd *) tail_184)->field0; + GibCursor x2_10_77_134 = + ((GibCursorGibCursorProd *) tail_184)->field1; + GibCursor fltPkd_121_135 = Addone_add_5(x1_9_76_133); + GibCursor fltPkd_122_136 = Addone_add_5(x2_10_77_134); + GibPtr tailift_186 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_186)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_186)->field1 = + fltPkd_121_135; + ((GibIntGibCursorGibCursorProd *) tailift_186)->field2 = + fltPkd_122_136; + return tailift_186; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_183"); + exit(1); + } + } } -GibCursor Add_add1_11(GibCursor t_12_63_110) +GibCursor Addtwo_add_6(GibCursor t_11_78_137) { - GibPackedTag tag_156 = *(GibPackedTag *) t_12_63_110; - GibCursor tail_157 = t_12_63_110 + sizeof(GibInt); + GibPackedTag tag_188 = *(GibPackedTag *) t_11_78_137; + GibCursor tail_189 = t_11_78_137 + sizeof(GibInt); - switch_160: + switch_192: ; - switch (tag_156) { + switch (tag_188) { case 0: { - GibInt x_13_64_111 = ((GibIntProd *) tail_157)->field0; - GibInt fltPkd_104_112 = x_13_64_111 + 1; - GibPtr tailift_158 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_12_79_138 = ((GibIntProd *) tail_189)->field0; + GibInt fltPkd_123_139 = x_12_79_138 + 2; + GibPtr tailift_190 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_158)->field0 = 0; - ((GibIntGibIntProd *) tailift_158)->field1 = fltPkd_104_112; - return tailift_158; + ((GibIntGibIntProd *) tailift_190)->field0 = 0; + ((GibIntGibIntProd *) tailift_190)->field1 = fltPkd_123_139; + return tailift_190; break; } case 1: { - GibCursor x1_14_65_113 = - ((GibCursorGibCursorProd *) tail_157)->field0; - GibCursor x2_15_66_114 = - ((GibCursorGibCursorProd *) tail_157)->field1; - GibCursor fltPkd_105_115 = Add_add1_11(x1_14_65_113); - GibCursor fltPkd_106_116 = Add_add1_11(x2_15_66_114); - GibPtr tailift_159 = + GibCursor x1_13_80_140 = + ((GibCursorGibCursorProd *) tail_189)->field0; + GibCursor x2_14_81_141 = + ((GibCursorGibCursorProd *) tail_189)->field1; + GibCursor fltPkd_124_142 = Addtwo_add_6(x1_13_80_140); + GibCursor fltPkd_125_143 = Addtwo_add_6(x2_14_81_141); + GibPtr tailift_191 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_159)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_159)->field1 = - fltPkd_105_115; - ((GibIntGibCursorGibCursorProd *) tailift_159)->field2 = - fltPkd_106_116; - return tailift_159; + ((GibIntGibCursorGibCursorProd *) tailift_191)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_191)->field1 = + fltPkd_124_142; + ((GibIntGibCursorGibCursorProd *) tailift_191)->field2 = + fltPkd_125_143; + return tailift_191; break; } default: { - printf("%s\n", "Unknown tag in: tag_156"); + printf("%s\n", "Unknown tag in: tag_188"); exit(1); } } } -GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117) +GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144) { - GibPackedTag tag_161 = *(GibPackedTag *) arg_28_67_117; - GibCursor tail_162 = arg_28_67_117 + sizeof(GibInt); + GibPackedTag tag_193 = *(GibPackedTag *) arg_39_82_144; + GibCursor tail_194 = arg_39_82_144 + sizeof(GibInt); - switch_165: + switch_197: ; - switch (tag_161) { + switch (tag_193) { case 0: { - GibInt x_29_68_118 = ((GibIntProd *) tail_162)->field0; - GibPtr tailift_163 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_40_83_145 = ((GibIntProd *) tail_194)->field0; + GibPtr tailift_195 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_163)->field0 = 0; - ((GibIntGibIntProd *) tailift_163)->field1 = x_29_68_118; - return tailift_163; + ((GibIntGibIntProd *) tailift_195)->field0 = 0; + ((GibIntGibIntProd *) tailift_195)->field1 = x_40_83_145; + return tailift_195; break; } case 1: { - GibCursor x_31_70_120 = - ((GibCursorGibCursorProd *) tail_162)->field0; - GibCursor x_32_71_121 = - ((GibCursorGibCursorProd *) tail_162)->field1; - GibCursor y_33_72_122 = _copy_Add_Tree_10(x_31_70_120); - GibCursor y_34_73_123 = _copy_Add_Tree_10(x_32_71_121); - GibPtr tailift_164 = + GibCursor x_42_85_147 = + ((GibCursorGibCursorProd *) tail_194)->field0; + GibCursor x_43_86_148 = + ((GibCursorGibCursorProd *) tail_194)->field1; + GibCursor y_44_87_149 = _copy_AddTree_Tree_4(x_42_85_147); + GibCursor y_45_88_150 = _copy_AddTree_Tree_4(x_43_86_148); + GibPtr tailift_196 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_164)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_164)->field1 = - y_33_72_122; - ((GibIntGibCursorGibCursorProd *) tailift_164)->field2 = - y_34_73_123; - return tailift_164; + ((GibIntGibCursorGibCursorProd *) tailift_196)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_196)->field1 = + y_44_87_149; + ((GibIntGibCursorGibCursorProd *) tailift_196)->field2 = + y_45_88_150; + return tailift_196; break; } default: { - printf("%s\n", "Unknown tag in: tag_161"); + printf("%s\n", "Unknown tag in: tag_193"); exit(1); } } } -GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124) +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151) { - GibPackedTag tag_166 = *(GibPackedTag *) arg_35_74_124; - GibCursor tail_167 = arg_35_74_124 + sizeof(GibInt); + GibPackedTag tag_198 = *(GibPackedTag *) arg_46_89_151; + GibCursor tail_199 = arg_46_89_151 + sizeof(GibInt); - switch_170: + switch_202: ; - switch (tag_166) { + switch (tag_198) { case 0: { - GibInt x_36_75_125 = ((GibIntProd *) tail_167)->field0; - GibPtr tailift_168 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_47_90_152 = ((GibIntProd *) tail_199)->field0; + GibPtr tailift_200 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_168)->field0 = 0; - ((GibIntGibIntProd *) tailift_168)->field1 = x_36_75_125; - return tailift_168; + ((GibIntGibIntProd *) tailift_200)->field0 = 0; + ((GibIntGibIntProd *) tailift_200)->field1 = x_47_90_152; + return tailift_200; break; } case 1: { - GibCursor x_38_77_127 = - ((GibCursorGibCursorProd *) tail_167)->field0; - GibCursor x_39_78_128 = - ((GibCursorGibCursorProd *) tail_167)->field1; - GibCursor y_40_79_129 = - _copy_without_ptrs_Add_Tree_10(x_38_77_127); - GibCursor y_41_80_130 = - _copy_without_ptrs_Add_Tree_10(x_39_78_128); - GibPtr tailift_169 = + GibCursor x_49_92_154 = + ((GibCursorGibCursorProd *) tail_199)->field0; + GibCursor x_50_93_155 = + ((GibCursorGibCursorProd *) tail_199)->field1; + GibCursor y_51_94_156 = + _copy_without_ptrs_AddTree_Tree_4(x_49_92_154); + GibCursor y_52_95_157 = + _copy_without_ptrs_AddTree_Tree_4(x_50_93_155); + GibPtr tailift_201 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_169)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_169)->field1 = - y_40_79_129; - ((GibIntGibCursorGibCursorProd *) tailift_169)->field2 = - y_41_80_130; - return tailift_169; + ((GibIntGibCursorGibCursorProd *) tailift_201)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_201)->field1 = + y_51_94_156; + ((GibIntGibCursorGibCursorProd *) tailift_201)->field2 = + y_52_95_157; + return tailift_201; break; } default: { - printf("%s\n", "Unknown tag in: tag_166"); + printf("%s\n", "Unknown tag in: tag_198"); exit(1); } } } -unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) { - GibPackedTag tag_171 = *(GibPackedTag *) arg_42_81_131; - GibCursor tail_172 = arg_42_81_131 + sizeof(GibInt); + GibPackedTag tag_203 = *(GibPackedTag *) arg_53_96_158; + GibCursor tail_204 = arg_53_96_158 + sizeof(GibInt); - switch_173: + switch_205: ; - switch (tag_171) { + switch (tag_203) { case 0: { - GibInt x_43_82_132 = ((GibIntProd *) tail_172)->field0; + GibInt x_54_97_159 = ((GibIntProd *) tail_204)->field0; return 0; break; @@ -2682,12 +3217,12 @@ unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) case 1: { - GibCursor x_45_83_133 = - ((GibCursorGibCursorProd *) tail_172)->field0; - GibCursor x_46_84_134 = - ((GibCursorGibCursorProd *) tail_172)->field1; - unsigned char y_47_85_135 = _traverse_Add_Tree_10(x_45_83_133); - unsigned char y_48_86_136 = _traverse_Add_Tree_10(x_46_84_134); + GibCursor x_56_98_160 = + ((GibCursorGibCursorProd *) tail_204)->field0; + GibCursor x_57_99_161 = + ((GibCursorGibCursorProd *) tail_204)->field1; + unsigned char y_58_100_162 = _traverse_AddTree_Tree_4(x_56_98_160); + unsigned char y_59_101_163 = _traverse_AddTree_Tree_4(x_57_99_161); return 0; break; @@ -2695,28 +3230,28 @@ unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) default: { - printf("%s\n", "Unknown tag in: tag_171"); + printf("%s\n", "Unknown tag in: tag_203"); exit(1); } } } -unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) +unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) { - GibPackedTag tag_174 = *(GibPackedTag *) arg_49_87_137; - GibCursor tail_175 = arg_49_87_137 + sizeof(GibInt); + GibPackedTag tag_206 = *(GibPackedTag *) arg_60_102_164; + GibCursor tail_207 = arg_60_102_164 + sizeof(GibInt); - switch_176: + switch_208: ; - switch (tag_174) { + switch (tag_206) { case 0: { - GibInt x_50_88_138 = ((GibIntProd *) tail_175)->field0; - unsigned char wildcard_52_89_139 = gib_print_symbol(154); - unsigned char wildcard_54_90_140 = gib_print_symbol(155); - unsigned char y_51_91_141 = printf("%ld", x_50_88_138); - unsigned char wildcard_53_92_142 = gib_print_symbol(152); + GibInt x_61_103_165 = ((GibIntProd *) tail_207)->field0; + unsigned char wildcard_63_104_166 = gib_print_symbol(181); + unsigned char wildcard_65_105_167 = gib_print_symbol(182); + unsigned char y_62_106_168 = printf("%ld", x_61_103_165); + unsigned char wildcard_64_107_169 = gib_print_symbol(179); return 0; break; @@ -2724,16 +3259,16 @@ unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) case 1: { - GibCursor x_55_93_143 = - ((GibCursorGibCursorProd *) tail_175)->field0; - GibCursor x_56_94_144 = - ((GibCursorGibCursorProd *) tail_175)->field1; - unsigned char wildcard_59_95_145 = gib_print_symbol(153); - unsigned char wildcard_62_96_146 = gib_print_symbol(155); - unsigned char y_57_97_147 = _print_Add_Tree_10(x_55_93_143); - unsigned char wildcard_61_98_148 = gib_print_symbol(155); - unsigned char y_58_99_149 = _print_Add_Tree_10(x_56_94_144); - unsigned char wildcard_60_100_150 = gib_print_symbol(152); + GibCursor x_66_108_170 = + ((GibCursorGibCursorProd *) tail_207)->field0; + GibCursor x_67_109_171 = + ((GibCursorGibCursorProd *) tail_207)->field1; + unsigned char wildcard_70_110_172 = gib_print_symbol(180); + unsigned char wildcard_73_111_173 = gib_print_symbol(182); + unsigned char y_68_112_174 = _print_AddTree_Tree_4(x_66_108_170); + unsigned char wildcard_72_113_175 = gib_print_symbol(182); + unsigned char y_69_114_176 = _print_AddTree_Tree_4(x_67_109_171); + unsigned char wildcard_71_115_177 = gib_print_symbol(179); return 0; break; @@ -2741,7 +3276,7 @@ unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) default: { - printf("%s\n", "Unknown tag in: tag_174"); + printf("%s\n", "Unknown tag in: tag_206"); exit(1); } } @@ -2753,25 +3288,26 @@ int main(int argc, char **argv) info_table_initialize(); symbol_table_initialize(); - GibPtr fltPkd_102_107 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_118_126 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_102_107)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_102_107)->field1 = 1; + ((GibIntGibIntProd *) fltPkd_118_126)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_118_126)->field1 = 1; - GibPtr fltPkd_103_108 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_119_127 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_103_108)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_103_108)->field1 = 2; + ((GibIntGibIntProd *) fltPkd_119_127)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_119_127)->field1 = 2; - GibPtr fltAppE_101_109 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + GibPtr fltAppE_117_128 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field1 = fltPkd_102_107; - ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field2 = fltPkd_103_108; + ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field1 = fltPkd_118_126; + ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field2 = fltPkd_119_127; - GibCursor tmp_app_151 = Add_add1_11(fltAppE_101_109); + GibCursor fltAppE_116_129 = Addtwo_add_6(fltAppE_117_128); + GibCursor tmp_app_178 = Addone_add_5(fltAppE_116_129); - _print_Add_Tree_10(tmp_app_151); + _print_AddTree_Tree_4(tmp_app_178); printf("\n"); return 0; @@ -2783,10 +3319,25 @@ int main(int argc, char **argv) Compiling RTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 +make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +make: Nothing to be done for 'all'. + + + + +Compiling the program +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng + + + +In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] + #warning "Simple write barrier is disabled." + ^~~~~~~ -codegen: C RTS could not be compiled: -make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory -make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. -Code: 2 +(Node (Leaf 4) (Leaf 5)) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 51e0d13b4..e79c4d853 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -35,6 +35,8 @@ import Gibbon.L0.Syntax as L0 import Data.List as L import Prelude as P +import Gibbon.Passes.ModuleFillImports (fillImports) + -------------------------------------------------------------------------------- {- @@ -179,6 +181,11 @@ type TopTyEnv = TyEnv TyScheme type TypeSynEnv = M.Map TyCon Ty0 +-- ======================================================== + + +-- ======================================================== + desugarModule :: (Show a, Pretty a) => Config @@ -193,6 +200,9 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports -- single top-level declaration we first collect types and then collect -- definitions. funtys = foldr (collectTopTy type_syns) M.empty decls + dbgPrintLn 2 "================================================================================" + dbgPrintLn 2 $ "desugaring module: " ++ mod_name + dbgPrintLn 2 $ "- imports: " ++ (show import_names) imported_progs :: [PassM Prog0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports let prog = do @@ -280,11 +290,12 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports show (S.toList em2) ++ " found in " ++ mod_name) (defs', funs''') imported_progs' - pure (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + fillImports (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) mod_name = moduleName head_mb + import_names = (map (\(ImportDecl _ (ModuleName _ imp_name) _ _ _ _ _ _) -> imp_name) imports) coalese_constraints :: [(Var, M.Map DataCon [UserOrdering])] -> [(Var, M.Map DataCon [UserOrdering])] diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs new file mode 100644 index 000000000..ea60831ef --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -0,0 +1,190 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} + +-- | Unique names. + +module Gibbon.Passes.ModuleFillImports (fillImports) where + +import Control.Exception +import Data.Foldable ( foldrM ) +import Prelude hiding (exp) +import qualified Data.List as L +import qualified Data.Map as M + +import Gibbon.Common +import Gibbon.L0.Syntax +import qualified Gibbon.L1.Syntax as L1 + +-------------------------------------------------------------------------------- + +type VarEnv = M.Map Var (M.Map Var Var) +type TyVarEnv t = M.Map TyVar t + +fillImports :: Prog0 -> PassM Prog0 +fillImports (Prog defs funs main) = + do + -- defs + let defNameMap = M.fromList $ zip (M.keys defs) (M.keys defs) + let initDefEnv :: VarEnv = M.empty + let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap + let transformDefKey :: Var -> Var + transformDefKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name defenv + + -- funs + let funNameMap = M.fromList $ zip (M.keys funs) (M.keys funs) + let initFunEnv :: VarEnv = M.empty + let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap + let transformFunKey :: Var -> Var + transformFunKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name funenv + + -- main + main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- resolveModInExp m defenv funenv + return $ Just (m',ty) + + defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs + funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs + + let defs'' = M.mapKeys transformDefKey defs' + let funs'' = M.mapKeys transformFunKey funs' + + return $ Prog defs'' funs'' main' + +resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) +resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = + do + let (mod, name) = parseOutMod tyName + let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons + pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' + +resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = + do + let nam' = parseAndResolve nam funenv + let funty' = resolveModsInTyScheme funty defenv + bod' <- resolveModInExp bod defenv funenv + pure $ FunDef nam' nargs funty' bod' meta + +resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme +resolveModsInTyScheme (ForAll tvs ty) defenv = do + let ty' = resolveModInTy ty defenv + ForAll tvs ty' + +resolveModsInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) +resolveModsInDataCons (con, tys) defenv funenv = + do + let tys' = map (\(boxed, ty) -> (boxed, (resolveModInTy ty defenv))) tys + (con, tys') + +resolveModInTy :: Ty0 -> VarEnv -> Ty0 +resolveModInTy ty defenv = + case ty of + IntTy -> ty + CharTy -> ty + FloatTy -> ty + SymTy0 -> ty + BoolTy -> ty + ArenaTy -> ty + SymSetTy -> ty + SymHashTy -> ty + MetaTv{} -> ty + TyVar tv -> ty + ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys + SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv + PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) + ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) $ resolveModInTy t defenv + + PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys + + VectorTy el_t -> VectorTy $ resolveModInTy el_t defenv + ListTy el_t -> ListTy $ resolveModInTy el_t defenv + IntHashTy -> ty + +resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> PassM Exp0 +resolveModInExp exp defenv funenv = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + --VarE v -> return $ VarE (varAppend (toVar "seen-") v) + VarE v -> return $ VarE v + + AppE v locs ls -> do + let (mod, fun) = parseOutMod v + let v' = resolveNameInEnv mod fun funenv + ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + return $ AppE v' locs ls + + PrimAppE p es -> return $ PrimAppE p es + + LetE (v,_locs,ty, e1) e2 -> do + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv + return $ LetE (v, [], ty, e1') e2' + + IfE e1 e2 e3 -> return $ IfE e1 e2 e3 + ProjE i e -> return $ ProjE i e + MkProdE es -> return $ MkProdE es + + CaseE e mp -> do + e' <- resolveModInExp e defenv funenv + mp' <- mapM (\(c,prs,ae) -> do + ae' <- resolveModInExp ae defenv funenv + return (c, prs, ae')) mp + return $ CaseE e' mp' + + DataConE loc c es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv) es + return $ DataConE loc c es' + + TimeIt e t b -> return $ TimeIt e t b + WithArenaE v e -> return $ WithArenaE v e + SpawnE v locs ls -> return $ SpawnE v locs ls + SyncE -> return $ SyncE + MapE v e -> return $ MapE v e + FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + Ext ext -> return $ Ext ext + + +-- environment interactions + +buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv env k v = do + let (mod, name) = parseOutMod k + let mod' = case mod of + Just m -> m + Nothing -> (toVar "") + case (M.lookup name env) of + Just m -> + if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + else ((M.insert name (M.insert mod' v m) env), v) + Nothing -> ((M.insert name (M.singleton mod' v) env), v) + +parseAndResolve :: Var -> VarEnv -> Var +parseAndResolve v env = do + let (mod, name) = parseOutMod v + resolveNameInEnv mod name env + +parseOutMod :: Var -> (Maybe Var, Var) +parseOutMod v = do + let str = (fromVar v) + case (L.elemIndices '.' str) of + [] -> (Nothing, v) + x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) + +resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var +resolveNameInEnv mod name e = + do case (M.lookup name e) of + Just modspace -> case mod of + Just m -> case (M.lookup m modspace) of + Just n -> n + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find " ++ (fromVar name) + Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 4c9688ec3..88abe2f2b 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -5,8 +5,6 @@ module Gibbon.Passes.ModuleRename (moduleRename) where -import Gibbon.Pretty - import Control.Exception import Data.Foldable ( foldrM ) import Prelude hiding (exp) @@ -122,7 +120,8 @@ resolveModInExp exp defenv funenv = AppE v locs ls -> do let (mod, fun) = parseOutMod v let v' = resolveNameInEnv mod fun funenv - return $ AppE v' locs ls + ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + return $ AppE v' locs ls' PrimAppE p es -> return $ PrimAppE p es From 3d80c840bbfee9c745c8fa582d3fee5e3b91962d Mon Sep 17 00:00:00 2001 From: Artem Pelenitsyn Date: Wed, 22 Nov 2023 16:45:59 +0000 Subject: [PATCH 08/68] minor cleanup of README and gibbon-compiler/gibbon.cabal --- README.md | 17 ++++++++++------- gibbon-compiler/gibbon.cabal | 4 +--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7a819add3..d24bb970c 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,12 @@ similar to Typed Racket, and a small subset of Haskell. ## Building Gibbon -Gibbon is implemented in Haskell, and is set up to be built with -[Cabal](https://cabal.readthedocs.io/en/3.4/). +### Getting Dependencies -Follow the instructions below to have all dependencies. +Gibbon is implemented in Haskell, and is set up to be built with +[Cabal](https://cabal.readthedocs.io/en/latest/), but it has a number of native dependencies. +Follow the instructions below to get all dependencies or enter the Nix shell +with `nix-shell` to get them via [Nix](https://nix.dev/). - Ubuntu 22.04: (Parallelism support temporarily not available with ubuntu 22.04 as Cilk support is not avaiable with newer gcc) @@ -77,24 +79,25 @@ Others require a few extra steps: 2. [uthash](https://github.com/troydhanson/uthash): Clone the [repository](https://github.com/troydhanson/uthash) and copy all the `.h` files in `src` to `/usr/local/include` +### Actually Building Gibbon After you have both Cabal and all the dependencies installed, you can build Gibbon from source: $ git clone https://github.com/iu-parfunc/gibbon $ cd gibbon && source set_env.sh - $ cd gibbon-compiler && cabal v2-build . -w ghc-9.4.6 + $ cd gibbon-compiler && cabal v2-build At this point you can run the Gibbon executable: - $ cabal v2-exec -w ghc-9.4.6 gibbon -- -h + $ cabal v2-run gibbon -- -h If you'd like to run the testsuite, you can do so with: - $ cd $GIBBONDIR && ./run_all_tests.sh + $ ./run_all_tests.sh -## Building a Developement docker container for Gibbon +### Building a Developement docker container for Gibbon To build the Dockerfile for dev purposes run the command below from the gibbon directory. diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index 82d2fb51c..706cb2f0c 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -1,4 +1,4 @@ -cabal-version: >=1.10 +cabal-version: 2.0 name: gibbon version: 0.3 @@ -15,9 +15,7 @@ category: Compilers/Interpreters extra-source-files: README.md build-type: Simple extra-source-files: README.md -cabal-version: >=1.10 tested-with: GHC==9.4.6 - , GHC==9.4.5 , GHC==9.2.8 , GHC==9.0.2 , GHC==8.10.7 From 6145e027b7898eb5bce1cc9701854e71feba3385 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 22 Nov 2023 12:15:07 -0800 Subject: [PATCH 09/68] aliases work --- gibbon-compiler/examples/Addtwo.hs | 5 + gibbon-compiler/examples/addimport.hs | 6 +- gibbon-compiler/ir.log | 3711 +++++++++-------- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 21 +- .../src/Gibbon/Passes/ModuleFillImports.hs | 63 +- 5 files changed, 2001 insertions(+), 1805 deletions(-) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs index 82c6216e3..9056b48e1 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/Addtwo.hs @@ -6,5 +6,10 @@ module Addtwo where Leaf x -> Leaf (x + 2) Node x1 x2 -> Node (add x1) (add x2) + sub :: Tree -> Tree + sub t = case t of + Leaf x -> Leaf (x - 2) + Node x1 x2 -> Node (sub x1) (sub x2) + main :: Tree main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index baaa8d41a..6b0f947d0 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,6 +1,6 @@ module AddImport where - import Addone - import Addtwo + import Addone as On + import Addtwo as Tw import AddTree - gibbon_main = Addone.add (Addtwo.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = Tw.add (On.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index e8c6e79bf..156118cf7 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -6,24 +6,32 @@ desugaring module: AddImport - imports: ["Addone","Addtwo","AddTree"] +- aliases: fromList [(Var "Addone",Var "On"),(Var "Addtwo",Var "Tw"),(Var "AddTree",Var "AddTree")] + ================================================================================ desugaring module: Addone - imports: ["AddTree"] +- aliases: fromList [(Var "AddTree",Var "AddTree")] + ================================================================================ desugaring module: AddTree - imports: [] +- aliases: fromList [] + ================================================================================ desugaring module: Addtwo - imports: ["AddTree"] +- aliases: fromList [(Var "AddTree",Var "AddTree")] + [compiler] pipeline starting, parsed program: ================================================================================ Prog {ddefs = [(AddTree.Tree, @@ -74,14 +82,37 @@ Prog {ddefs = [(AddTree.Tree, "Node" [AppE "Addtwo.add" [] [VarE "x1"], AppE "Addtwo.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.sub, + FunDef {funName = "Addtwo.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addtwo.sub" [] [VarE "x1"], + AppE "Addtwo.sub" [] [VarE "x2"]])], funMeta = FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Addone.add" + mainExp = Just (AppE "Addtwo.add" [] - [AppE "Addtwo.add" + [AppE "Addone.add" [] [DataConE (MetaTv $0) "Node" @@ -112,8 +143,17 @@ Addtwo_add_6 t = Node x1::$4 x2::$5 -> (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 2) + Node x1::$10 x2::$11 -> + (Node $9 (Addtwo_sub_7 [] x1) (Addtwo_sub_7 [] x2)) + gibbon_main :: $3 -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, freshen Pass output: @@ -122,24 +162,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::$2 -> - (Leaf $1 x_8 + 1) - Node x1_9::$4 x2_10::$5 -> - (Node $3 (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::$2 -> + (Leaf $1 x_9 + 1) + Node x1_10::$4 x2_11::$5 -> + (Node $3 (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::$2 -> - (Leaf $1 x_12 + 2) - Node x1_13::$4 x2_14::$5 -> - (Node $3 (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::$2 -> + (Leaf $1 x_13 + 2) + Node x1_14::$4 x2_15::$5 -> + (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::$8 -> + (Leaf $7 x_17 - 2) + Node x1_18::$10 x2_19::$11 -> + (Node $9 (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: $3 -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, typecheck Pass output: @@ -148,24 +197,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, bindLambdas Pass output: @@ -174,24 +232,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, monomorphize Pass output: @@ -200,24 +267,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, specLambdas Pass output: @@ -226,24 +302,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, desugarL0 Pass output: @@ -252,78 +337,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::() -> - (Leaf () x_8 + 1) - Node x1_9::() x2_10::() -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 + 1) + Node x1_10::() x2_11::() -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::() -> - (Leaf () x_12 + 2) - Node x1_13::() x2_14::() -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 - 2) + Node x1_18::() x2_19::() -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40::() -> - let y_41 :: Int = x_40 in - (Leaf () y_41) - Node x_42::() x_43::() -> - let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in - (Node () y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47::() -> - let y_48 :: Int = x_47 in - (Leaf () y_48) - Node x_49::() x_50::() -> - let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node () y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54::() -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> () - Node x_56::() x_57::() -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61::() -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66::() x_67::() -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, floatOutCase Pass output: @@ -332,78 +426,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::() -> - (Leaf () x_8 + 1) - Node x1_9::() x2_10::() -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 + 1) + Node x1_10::() x2_11::() -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::() -> - (Leaf () x_12 + 2) - Node x1_13::() x2_14::() -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 - 2) + Node x1_18::() x2_19::() -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40::() -> - let y_41 :: Int = x_40 in - (Leaf () y_41) - Node x_42::() x_43::() -> - let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in - (Node () y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47::() -> - let y_48 :: Int = x_47 in - (Leaf () y_48) - Node x_49::() x_50::() -> - let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node () y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54::() -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> () - Node x_56::() x_57::() -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61::() -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66::() x_67::() -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, toL1 Pass output: @@ -412,78 +515,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: @@ -492,78 +604,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, benchMainExp Pass output: @@ -572,78 +693,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: @@ -652,159 +782,168 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, simplify -Removed unused functions: [] +Removed unused functions: [Var "Addtwo_sub_7"] Pass output: ================================================================================ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74 = - case t_7_74 of - Leaf x_8_75 -> - (Leaf x_8_75 + 1) - Node x1_9_76 x2_10_77 -> - (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) +Addone_add_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 + 1) + Node x1_10_89 x2_11_90 -> + (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78 = - case t_11_78 of - Leaf x_12_79 -> - (Leaf x_12_79 + 2) - Node x1_13_80 x2_14_81 -> - (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) +Addtwo_add_6 t_12_91 = + case t_12_91 of + Leaf x_13_92 -> + (Leaf x_13_92 + 2) + Node x1_14_93 x2_15_94 -> + (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82 = - case arg_39_82 of - Leaf x_40_83 -> - let y_41_84 :: Int = x_40_83 in - (Leaf y_41_84) - Node x_42_85 x_43_86 -> - let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in - let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in - (Node y_44_87 y_45_88) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = - case arg_46_89 of - Leaf x_47_90 -> - let y_48_91 :: Int = x_47_90 in - (Leaf y_48_91) - Node x_49_92 x_50_93 -> - let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in - let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in - (Node y_51_94 y_52_95) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96 = - case arg_53_96 of - Leaf x_54_97 -> +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> () - Node x_56_98 x_57_99 -> - let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in - let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102 = - case arg_60_102 of - Leaf x_61_103 -> - let wildcard_63_104 :: () = printsym("(Leaf") in - let wildcard_65_105 :: () = printsym(" ") in - let y_62_106 :: () = printint(x_61_103) in - let wildcard_64_107 :: () = printsym(")") in - () - Node x_66_108 x_67_109 -> - let wildcard_70_110 :: () = printsym("(Node") in - let wildcard_73_111 :: () = printsym(" ") in - let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in - let wildcard_72_113 :: () = printsym(" ") in - let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in - let wildcard_71_115 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: @@ -813,78 +952,78 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74 = - case t_7_74 of - Leaf x_8_75 -> - (Leaf x_8_75 + 1) - Node x1_9_76 x2_10_77 -> - (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) +Addone_add_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 + 1) + Node x1_10_89 x2_11_90 -> + (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78 = - case t_11_78 of - Leaf x_12_79 -> - (Leaf x_12_79 + 2) - Node x1_13_80 x2_14_81 -> - (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) +Addtwo_add_6 t_12_91 = + case t_12_91 of + Leaf x_13_92 -> + (Leaf x_13_92 + 2) + Node x1_14_93 x2_15_94 -> + (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82 = - case arg_39_82 of - Leaf x_40_83 -> - let y_41_84 :: Int = x_40_83 in - (Leaf y_41_84) - Node x_42_85 x_43_86 -> - let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in - let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in - (Node y_44_87 y_45_88) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = - case arg_46_89 of - Leaf x_47_90 -> - let y_48_91 :: Int = x_47_90 in - (Leaf y_48_91) - Node x_49_92 x_50_93 -> - let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in - let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in - (Node y_51_94 y_52_95) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96 = - case arg_53_96 of - Leaf x_54_97 -> +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> () - Node x_56_98 x_57_99 -> - let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in - let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102 = - case arg_60_102 of - Leaf x_61_103 -> - let wildcard_63_104 :: () = printsym("(Leaf") in - let wildcard_65_105 :: () = printsym(" ") in - let y_62_106 :: () = printint(x_61_103) in - let wildcard_64_107 :: () = printsym(")") in - () - Node x_66_108 x_67_109 -> - let wildcard_70_110 :: () = printsym("(Node") in - let wildcard_73_111 :: () = printsym(" ") in - let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in - let wildcard_72_113 :: () = printsym(" ") in - let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in - let wildcard_71_115 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, flatten Pass output: @@ -893,88 +1032,88 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74 = - case t_7_74 of - Leaf x_8_75 -> - let fltPkd_120 :: Int = x_8_75 + 1 in - (Leaf fltPkd_120) - Node x1_9_76 x2_10_77 -> - let fltPkd_121 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76) in - let fltPkd_122 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77) in - (Node fltPkd_121 fltPkd_122) +Addone_add_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + let fltPkd_137 :: Int = x_9_88 + 1 in + (Leaf fltPkd_137) + Node x1_10_89 x2_11_90 -> + let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89) in + let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90) in + (Node fltPkd_138 fltPkd_139) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78 = - case t_11_78 of - Leaf x_12_79 -> - let fltPkd_123 :: Int = x_12_79 + 2 in - (Leaf fltPkd_123) - Node x1_13_80 x2_14_81 -> - let fltPkd_124 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80) in - let fltPkd_125 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81) in - (Node fltPkd_124 fltPkd_125) +Addtwo_add_6 t_12_91 = + case t_12_91 of + Leaf x_13_92 -> + let fltPkd_140 :: Int = x_13_92 + 2 in + (Leaf fltPkd_140) + Node x1_14_93 x2_15_94 -> + let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93) in + let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94) in + (Node fltPkd_141 fltPkd_142) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82 = - case arg_39_82 of - Leaf x_40_83 -> - let y_41_84 :: Int = x_40_83 in - (Leaf y_41_84) - Node x_42_85 x_43_86 -> - let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in - let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in - (Node y_44_87 y_45_88) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = - case arg_46_89 of - Leaf x_47_90 -> - let y_48_91 :: Int = x_47_90 in - (Leaf y_48_91) - Node x_49_92 x_50_93 -> - let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in - let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in - (Node y_51_94 y_52_95) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96 = - case arg_53_96 of - Leaf x_54_97 -> +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> () - Node x_56_98 x_57_99 -> - let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in - let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102 = - case arg_60_102 of - Leaf x_61_103 -> - let wildcard_63_104 :: () = printsym("(Leaf") in - let wildcard_65_105 :: () = printsym(" ") in - let y_62_106 :: () = printint(x_61_103) in - let wildcard_64_107 :: () = printsym(")") in - () - Node x_66_108 x_67_109 -> - let wildcard_70_110 :: () = printsym("(Node") in - let wildcard_73_111 :: () = printsym(" ") in - let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in - let wildcard_72_113 :: () = printsym(" ") in - let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in - let wildcard_71_115 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117 :: (Packed AddTree_Tree_4) = (Node fltPkd_118 fltPkd_119) in - let fltAppE_116 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117) in - (Addone_add_5 [] fltAppE_116) +gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in + let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134) in + (Addtwo_add_6 [] fltAppE_133) [compiler] Running pass, simplify Removed unused functions: [] @@ -984,88 +1123,88 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - let y_41_84_146 :: Int = x_40_83_145 in - (Leaf y_41_84_146) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + let y_54_101_163 :: Int = x_53_100_162 in + (Leaf y_54_101_163) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - let y_48_91_153 :: Int = x_47_90_152 in - (Leaf y_48_91_153) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + let y_61_108_170 :: Int = x_60_107_169 in + (Leaf y_61_108_170) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, inlineTriv Pass output: @@ -1074,86 +1213,86 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, typecheck Pass output: @@ -1162,86 +1301,86 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, typecheck Pass output: @@ -1250,86 +1389,86 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, directL3 Pass output: @@ -1338,86 +1477,86 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, L3.typecheck Pass output: @@ -1426,86 +1565,86 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, unariser Pass output: @@ -1514,87 +1653,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, L3.typecheck Pass output: @@ -1603,87 +1742,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, L3.flatten Pass output: @@ -1692,87 +1831,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, L3.typecheck Pass output: @@ -1781,87 +1920,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, lower Pass output: @@ -1881,323 +2020,323 @@ Prog {infoTable = [("AddTree_Tree_4", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), - (182, " ")], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_7_74_130, CursorTy)], + funArgs = [(t_8_87_147, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), - (tail_184, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_7_74_130"], - bod = Switch "switch_187" - (VarTriv "tag_183") + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") (IntAlts [(0, - LetUnpackT {binds = [(x_8_75_131, + LetUnpackT {binds = [(x_9_88_148, IntTy)], - ptr = "tail_184", - bod = LetPrimCallT {binds = [(fltPkd_120_132, + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, IntTy)], prim = AddP, - rands = [VarTriv "x_8_75_131", + rands = [VarTriv "x_9_88_148", IntTriv 1], - bod = LetAllocT {lhs = "tailift_185", + bod = LetAllocT {lhs = "tailift_202", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_120_132")], - bod = RetValsT [VarTriv "tailift_185"]}}}), + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), (1, - LetUnpackT {binds = [(x1_9_76_133, + LetUnpackT {binds = [(x1_10_89_150, CursorTy), - (x2_10_77_134, + (x2_11_90_151, CursorTy)], - ptr = "tail_184", + ptr = "tail_201", bod = LetCallT {async = False, - binds = [(fltPkd_121_135, + binds = [(fltPkd_138_152, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x1_9_76_133"], + rands = [VarTriv "x1_10_89_150"], bod = LetCallT {async = False, - binds = [(fltPkd_122_136, + binds = [(fltPkd_139_153, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x2_10_77_134"], - bod = LetAllocT {lhs = "tailift_186", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_121_135"), + VarTriv "fltPkd_138_152"), (CursorTy, - VarTriv "fltPkd_122_136")], - bod = RetValsT [VarTriv "tailift_186"]}}}})]) - (Just ErrT "Unknown tag in: tag_183")}, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, isPure = True}, FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_11_78_137, CursorTy)], + funArgs = [(t_12_91_154, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), - (tail_189, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_11_78_137"], - bod = Switch "switch_192" - (VarTriv "tag_188") + rands = [VarTriv "t_12_91_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") (IntAlts [(0, - LetUnpackT {binds = [(x_12_79_138, + LetUnpackT {binds = [(x_13_92_155, IntTy)], - ptr = "tail_189", - bod = LetPrimCallT {binds = [(fltPkd_123_139, + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, IntTy)], prim = AddP, - rands = [VarTriv "x_12_79_138", + rands = [VarTriv "x_13_92_155", IntTriv 2], - bod = LetAllocT {lhs = "tailift_190", + bod = LetAllocT {lhs = "tailift_207", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_123_139")], - bod = RetValsT [VarTriv "tailift_190"]}}}), + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), (1, - LetUnpackT {binds = [(x1_13_80_140, + LetUnpackT {binds = [(x1_14_93_157, CursorTy), - (x2_14_81_141, + (x2_15_94_158, CursorTy)], - ptr = "tail_189", + ptr = "tail_206", bod = LetCallT {async = False, - binds = [(fltPkd_124_142, + binds = [(fltPkd_141_159, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x1_13_80_140"], + rands = [VarTriv "x1_14_93_157"], bod = LetCallT {async = False, - binds = [(fltPkd_125_143, + binds = [(fltPkd_142_160, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x2_14_81_141"], - bod = LetAllocT {lhs = "tailift_191", + rands = [VarTriv "x2_15_94_158"], + bod = LetAllocT {lhs = "tailift_208", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_124_142"), + VarTriv "fltPkd_141_159"), (CursorTy, - VarTriv "fltPkd_125_143")], - bod = RetValsT [VarTriv "tailift_191"]}}}})]) - (Just ErrT "Unknown tag in: tag_188")}, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, isPure = True}, FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_39_82_144, CursorTy)], + funArgs = [(arg_52_99_161, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), - (tail_194, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_39_82_144"], - bod = Switch "switch_197" - (VarTriv "tag_193") + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") (IntAlts [(0, - LetUnpackT {binds = [(x_40_83_145, + LetUnpackT {binds = [(x_53_100_162, IntTy)], - ptr = "tail_194", - bod = LetAllocT {lhs = "tailift_195", + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_40_83_145")], - bod = RetValsT [VarTriv "tailift_195"]}}), + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), (1, - LetUnpackT {binds = [(x_42_85_147, + LetUnpackT {binds = [(x_55_102_164, CursorTy), - (x_43_86_148, + (x_56_103_165, CursorTy)], - ptr = "tail_194", + ptr = "tail_211", bod = LetCallT {async = False, - binds = [(y_44_87_149, + binds = [(y_57_104_166, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_42_85_147"], + rands = [VarTriv "x_55_102_164"], bod = LetCallT {async = False, - binds = [(y_45_88_150, + binds = [(y_58_105_167, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_43_86_148"], - bod = LetAllocT {lhs = "tailift_196", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_44_87_149"), + VarTriv "y_57_104_166"), (CursorTy, - VarTriv "y_45_88_150")], - bod = RetValsT [VarTriv "tailift_196"]}}}})]) - (Just ErrT "Unknown tag in: tag_193")}, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, isPure = True}, FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_46_89_151, CursorTy)], + funArgs = [(arg_59_106_168, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), - (tail_199, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_46_89_151"], - bod = Switch "switch_202" - (VarTriv "tag_198") + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") (IntAlts [(0, - LetUnpackT {binds = [(x_47_90_152, + LetUnpackT {binds = [(x_60_107_169, IntTy)], - ptr = "tail_199", - bod = LetAllocT {lhs = "tailift_200", + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_47_90_152")], - bod = RetValsT [VarTriv "tailift_200"]}}), + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), (1, - LetUnpackT {binds = [(x_49_92_154, + LetUnpackT {binds = [(x_62_109_171, CursorTy), - (x_50_93_155, + (x_63_110_172, CursorTy)], - ptr = "tail_199", + ptr = "tail_216", bod = LetCallT {async = False, - binds = [(y_51_94_156, + binds = [(y_64_111_173, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_49_92_154"], + rands = [VarTriv "x_62_109_171"], bod = LetCallT {async = False, - binds = [(y_52_95_157, + binds = [(y_65_112_174, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_50_93_155"], - bod = LetAllocT {lhs = "tailift_201", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_51_94_156"), + VarTriv "y_64_111_173"), (CursorTy, - VarTriv "y_52_95_157")], - bod = RetValsT [VarTriv "tailift_201"]}}}})]) - (Just ErrT "Unknown tag in: tag_198")}, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, isPure = True}, FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_53_96_158, CursorTy)], + funArgs = [(arg_66_113_175, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), - (tail_204, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_53_96_158"], - bod = Switch "switch_205" - (VarTriv "tag_203") + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") (IntAlts [(0, - LetUnpackT {binds = [(x_54_97_159, + LetUnpackT {binds = [(x_67_114_176, IntTy)], - ptr = "tail_204", + ptr = "tail_221", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_56_98_160, + LetUnpackT {binds = [(x_69_115_177, CursorTy), - (x_57_99_161, + (x_70_116_178, CursorTy)], - ptr = "tail_204", + ptr = "tail_221", bod = LetCallT {async = False, - binds = [(y_58_100_162, + binds = [(y_71_117_179, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_56_98_160"], + rands = [VarTriv "x_69_115_177"], bod = LetCallT {async = False, - binds = [(y_59_101_163, + binds = [(y_72_118_180, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_57_99_161"], + rands = [VarTriv "x_70_116_178"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_203")}, + (Just ErrT "Unknown tag in: tag_220")}, isPure = True}, FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_60_102_164, CursorTy)], + funArgs = [(arg_73_119_181, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), - (tail_207, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_60_102_164"], - bod = Switch "switch_208" - (VarTriv "tag_206") + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") (IntAlts [(0, - LetUnpackT {binds = [(x_61_103_165, + LetUnpackT {binds = [(x_74_120_182, IntTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_63_104_166, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, ProdTy [])], prim = PrintSym, - rands = [SymTriv 181], - bod = LetPrimCallT {binds = [(wildcard_65_105_167, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], - bod = LetPrimCallT {binds = [(y_62_106_168, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_61_103_165"], - bod = LetPrimCallT {binds = [(wildcard_64_107_169, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_66_108_170, + LetUnpackT {binds = [(x_79_125_187, CursorTy), - (x_67_109_171, + (x_80_126_188, CursorTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_70_110_172, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, ProdTy [])], prim = PrintSym, - rands = [SymTriv 180], - bod = LetPrimCallT {binds = [(wildcard_73_111_173, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_68_112_174, + binds = [(y_81_129_191, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_66_108_170"], - bod = LetPrimCallT {binds = [(wildcard_72_113_175, + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_69_114_176, + binds = [(y_82_131_193, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_67_109_171"], - bod = LetPrimCallT {binds = [(wildcard_71_115_177, + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_206")}, + (Just ErrT "Unknown tag in: tag_223")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_118_126", + {lhs = "fltPkd_135_143", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_119_127", + bod = LetAllocT {lhs = "fltPkd_136_144", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_117_128", + bod = LetAllocT {lhs = "fltAppE_134_145", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_118_126"), + VarTriv "fltPkd_135_143"), (CursorTy, - VarTriv "fltPkd_119_127")], + VarTriv "fltPkd_136_144")], bod = LetCallT {async = False, - binds = [(fltAppE_116_129, + binds = [(fltAppE_133_146, CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_117_128"], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_134_145"], bod = LetCallT {async = False, - binds = [(tmp_app_178, + binds = [(tmp_app_195, CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_116_129"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_133_146"], bod = LetCallT {async = False, binds = [], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_178"], + rands = [VarTriv "tmp_app_195"], bod = LetPrimCallT {binds = [], prim = PrintString "\n", rands = [], @@ -2221,323 +2360,323 @@ Prog {infoTable = [("AddTree_Tree_4", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), - (182, " ")], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_7_74_130, CursorTy)], + funArgs = [(t_8_87_147, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), - (tail_184, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_7_74_130"], - bod = Switch "switch_187" - (VarTriv "tag_183") + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") (IntAlts [(0, - LetUnpackT {binds = [(x_8_75_131, + LetUnpackT {binds = [(x_9_88_148, IntTy)], - ptr = "tail_184", - bod = LetPrimCallT {binds = [(fltPkd_120_132, + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, IntTy)], prim = AddP, - rands = [VarTriv "x_8_75_131", + rands = [VarTriv "x_9_88_148", IntTriv 1], - bod = LetAllocT {lhs = "tailift_185", + bod = LetAllocT {lhs = "tailift_202", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_120_132")], - bod = RetValsT [VarTriv "tailift_185"]}}}), + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), (1, - LetUnpackT {binds = [(x1_9_76_133, + LetUnpackT {binds = [(x1_10_89_150, CursorTy), - (x2_10_77_134, + (x2_11_90_151, CursorTy)], - ptr = "tail_184", + ptr = "tail_201", bod = LetCallT {async = False, - binds = [(fltPkd_121_135, + binds = [(fltPkd_138_152, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x1_9_76_133"], + rands = [VarTriv "x1_10_89_150"], bod = LetCallT {async = False, - binds = [(fltPkd_122_136, + binds = [(fltPkd_139_153, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x2_10_77_134"], - bod = LetAllocT {lhs = "tailift_186", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_121_135"), + VarTriv "fltPkd_138_152"), (CursorTy, - VarTriv "fltPkd_122_136")], - bod = RetValsT [VarTriv "tailift_186"]}}}})]) - (Just ErrT "Unknown tag in: tag_183")}, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, isPure = True}, FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_11_78_137, CursorTy)], + funArgs = [(t_12_91_154, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), - (tail_189, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_11_78_137"], - bod = Switch "switch_192" - (VarTriv "tag_188") + rands = [VarTriv "t_12_91_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") (IntAlts [(0, - LetUnpackT {binds = [(x_12_79_138, + LetUnpackT {binds = [(x_13_92_155, IntTy)], - ptr = "tail_189", - bod = LetPrimCallT {binds = [(fltPkd_123_139, + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, IntTy)], prim = AddP, - rands = [VarTriv "x_12_79_138", + rands = [VarTriv "x_13_92_155", IntTriv 2], - bod = LetAllocT {lhs = "tailift_190", + bod = LetAllocT {lhs = "tailift_207", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_123_139")], - bod = RetValsT [VarTriv "tailift_190"]}}}), + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), (1, - LetUnpackT {binds = [(x1_13_80_140, + LetUnpackT {binds = [(x1_14_93_157, CursorTy), - (x2_14_81_141, + (x2_15_94_158, CursorTy)], - ptr = "tail_189", + ptr = "tail_206", bod = LetCallT {async = False, - binds = [(fltPkd_124_142, + binds = [(fltPkd_141_159, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x1_13_80_140"], + rands = [VarTriv "x1_14_93_157"], bod = LetCallT {async = False, - binds = [(fltPkd_125_143, + binds = [(fltPkd_142_160, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x2_14_81_141"], - bod = LetAllocT {lhs = "tailift_191", + rands = [VarTriv "x2_15_94_158"], + bod = LetAllocT {lhs = "tailift_208", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_124_142"), + VarTriv "fltPkd_141_159"), (CursorTy, - VarTriv "fltPkd_125_143")], - bod = RetValsT [VarTriv "tailift_191"]}}}})]) - (Just ErrT "Unknown tag in: tag_188")}, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, isPure = True}, FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_39_82_144, CursorTy)], + funArgs = [(arg_52_99_161, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), - (tail_194, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_39_82_144"], - bod = Switch "switch_197" - (VarTriv "tag_193") + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") (IntAlts [(0, - LetUnpackT {binds = [(x_40_83_145, + LetUnpackT {binds = [(x_53_100_162, IntTy)], - ptr = "tail_194", - bod = LetAllocT {lhs = "tailift_195", + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_40_83_145")], - bod = RetValsT [VarTriv "tailift_195"]}}), + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), (1, - LetUnpackT {binds = [(x_42_85_147, + LetUnpackT {binds = [(x_55_102_164, CursorTy), - (x_43_86_148, + (x_56_103_165, CursorTy)], - ptr = "tail_194", + ptr = "tail_211", bod = LetCallT {async = False, - binds = [(y_44_87_149, + binds = [(y_57_104_166, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_42_85_147"], + rands = [VarTriv "x_55_102_164"], bod = LetCallT {async = False, - binds = [(y_45_88_150, + binds = [(y_58_105_167, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_43_86_148"], - bod = LetAllocT {lhs = "tailift_196", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_44_87_149"), + VarTriv "y_57_104_166"), (CursorTy, - VarTriv "y_45_88_150")], - bod = RetValsT [VarTriv "tailift_196"]}}}})]) - (Just ErrT "Unknown tag in: tag_193")}, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, isPure = True}, FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_46_89_151, CursorTy)], + funArgs = [(arg_59_106_168, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), - (tail_199, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_46_89_151"], - bod = Switch "switch_202" - (VarTriv "tag_198") + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") (IntAlts [(0, - LetUnpackT {binds = [(x_47_90_152, + LetUnpackT {binds = [(x_60_107_169, IntTy)], - ptr = "tail_199", - bod = LetAllocT {lhs = "tailift_200", + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_47_90_152")], - bod = RetValsT [VarTriv "tailift_200"]}}), + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), (1, - LetUnpackT {binds = [(x_49_92_154, + LetUnpackT {binds = [(x_62_109_171, CursorTy), - (x_50_93_155, + (x_63_110_172, CursorTy)], - ptr = "tail_199", + ptr = "tail_216", bod = LetCallT {async = False, - binds = [(y_51_94_156, + binds = [(y_64_111_173, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_49_92_154"], + rands = [VarTriv "x_62_109_171"], bod = LetCallT {async = False, - binds = [(y_52_95_157, + binds = [(y_65_112_174, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_50_93_155"], - bod = LetAllocT {lhs = "tailift_201", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_51_94_156"), + VarTriv "y_64_111_173"), (CursorTy, - VarTriv "y_52_95_157")], - bod = RetValsT [VarTriv "tailift_201"]}}}})]) - (Just ErrT "Unknown tag in: tag_198")}, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, isPure = True}, FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_53_96_158, CursorTy)], + funArgs = [(arg_66_113_175, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), - (tail_204, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_53_96_158"], - bod = Switch "switch_205" - (VarTriv "tag_203") + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") (IntAlts [(0, - LetUnpackT {binds = [(x_54_97_159, + LetUnpackT {binds = [(x_67_114_176, IntTy)], - ptr = "tail_204", + ptr = "tail_221", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_56_98_160, + LetUnpackT {binds = [(x_69_115_177, CursorTy), - (x_57_99_161, + (x_70_116_178, CursorTy)], - ptr = "tail_204", + ptr = "tail_221", bod = LetCallT {async = False, - binds = [(y_58_100_162, + binds = [(y_71_117_179, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_56_98_160"], + rands = [VarTriv "x_69_115_177"], bod = LetCallT {async = False, - binds = [(y_59_101_163, + binds = [(y_72_118_180, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_57_99_161"], + rands = [VarTriv "x_70_116_178"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_203")}, + (Just ErrT "Unknown tag in: tag_220")}, isPure = True}, FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_60_102_164, CursorTy)], + funArgs = [(arg_73_119_181, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), - (tail_207, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_60_102_164"], - bod = Switch "switch_208" - (VarTriv "tag_206") + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") (IntAlts [(0, - LetUnpackT {binds = [(x_61_103_165, + LetUnpackT {binds = [(x_74_120_182, IntTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_63_104_166, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, ProdTy [])], prim = PrintSym, - rands = [SymTriv 181], - bod = LetPrimCallT {binds = [(wildcard_65_105_167, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], - bod = LetPrimCallT {binds = [(y_62_106_168, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_61_103_165"], - bod = LetPrimCallT {binds = [(wildcard_64_107_169, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_66_108_170, + LetUnpackT {binds = [(x_79_125_187, CursorTy), - (x_67_109_171, + (x_80_126_188, CursorTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_70_110_172, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, ProdTy [])], prim = PrintSym, - rands = [SymTriv 180], - bod = LetPrimCallT {binds = [(wildcard_73_111_173, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_68_112_174, + binds = [(y_81_129_191, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_66_108_170"], - bod = LetPrimCallT {binds = [(wildcard_72_113_175, + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_69_114_176, + binds = [(y_82_131_193, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_67_109_171"], - bod = LetPrimCallT {binds = [(wildcard_71_115_177, + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_206")}, + (Just ErrT "Unknown tag in: tag_223")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_118_126", + {lhs = "fltPkd_135_143", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_119_127", + bod = LetAllocT {lhs = "fltPkd_136_144", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_117_128", + bod = LetAllocT {lhs = "fltAppE_134_145", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_118_126"), + VarTriv "fltPkd_135_143"), (CursorTy, - VarTriv "fltPkd_119_127")], + VarTriv "fltPkd_136_144")], bod = LetCallT {async = False, - binds = [(fltAppE_116_129, + binds = [(fltAppE_133_146, CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_117_128"], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_134_145"], bod = LetCallT {async = False, - binds = [(tmp_app_178, + binds = [(tmp_app_195, CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_116_129"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_133_146"], bod = LetCallT {async = False, binds = [], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_178"], + rands = [VarTriv "tmp_app_195"], bod = LetPrimCallT {binds = [], prim = PrintString "\n", rands = [], @@ -2561,329 +2700,329 @@ Prog {infoTable = [("AddTree_Tree_4", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), - (182, " ")], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_7_74_130, CursorTy)], + funArgs = [(t_8_87_147, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), - (tail_184, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_7_74_130"], - bod = Switch "switch_187" - (VarTriv "tag_183") + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") (IntAlts [(0, - LetUnpackT {binds = [(x_8_75_131, + LetUnpackT {binds = [(x_9_88_148, IntTy)], - ptr = "tail_184", - bod = LetPrimCallT {binds = [(fltPkd_120_132, + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, IntTy)], prim = AddP, - rands = [VarTriv "x_8_75_131", + rands = [VarTriv "x_9_88_148", IntTriv 1], - bod = LetAllocT {lhs = "tailift_185", + bod = LetAllocT {lhs = "tailift_202", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_120_132")], - bod = RetValsT [VarTriv "tailift_185"]}}}), + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), (1, - LetUnpackT {binds = [(x1_9_76_133, + LetUnpackT {binds = [(x1_10_89_150, CursorTy), - (x2_10_77_134, + (x2_11_90_151, CursorTy)], - ptr = "tail_184", + ptr = "tail_201", bod = LetCallT {async = False, - binds = [(fltPkd_121_135, + binds = [(fltPkd_138_152, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x1_9_76_133"], + rands = [VarTriv "x1_10_89_150"], bod = LetCallT {async = False, - binds = [(fltPkd_122_136, + binds = [(fltPkd_139_153, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x2_10_77_134"], - bod = LetAllocT {lhs = "tailift_186", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_121_135"), + VarTriv "fltPkd_138_152"), (CursorTy, - VarTriv "fltPkd_122_136")], - bod = RetValsT [VarTriv "tailift_186"]}}}})]) - (Just ErrT "Unknown tag in: tag_183")}, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, isPure = True}, FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_11_78_137, CursorTy)], + funArgs = [(t_12_91_154, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), - (tail_189, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_11_78_137"], - bod = Switch "switch_192" - (VarTriv "tag_188") + rands = [VarTriv "t_12_91_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") (IntAlts [(0, - LetUnpackT {binds = [(x_12_79_138, + LetUnpackT {binds = [(x_13_92_155, IntTy)], - ptr = "tail_189", - bod = LetPrimCallT {binds = [(fltPkd_123_139, + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, IntTy)], prim = AddP, - rands = [VarTriv "x_12_79_138", + rands = [VarTriv "x_13_92_155", IntTriv 2], - bod = LetAllocT {lhs = "tailift_190", + bod = LetAllocT {lhs = "tailift_207", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_123_139")], - bod = RetValsT [VarTriv "tailift_190"]}}}), + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), (1, - LetUnpackT {binds = [(x1_13_80_140, + LetUnpackT {binds = [(x1_14_93_157, CursorTy), - (x2_14_81_141, + (x2_15_94_158, CursorTy)], - ptr = "tail_189", + ptr = "tail_206", bod = LetCallT {async = False, - binds = [(fltPkd_124_142, + binds = [(fltPkd_141_159, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x1_13_80_140"], + rands = [VarTriv "x1_14_93_157"], bod = LetCallT {async = False, - binds = [(fltPkd_125_143, + binds = [(fltPkd_142_160, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x2_14_81_141"], - bod = LetAllocT {lhs = "tailift_191", + rands = [VarTriv "x2_15_94_158"], + bod = LetAllocT {lhs = "tailift_208", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_124_142"), + VarTriv "fltPkd_141_159"), (CursorTy, - VarTriv "fltPkd_125_143")], - bod = RetValsT [VarTriv "tailift_191"]}}}})]) - (Just ErrT "Unknown tag in: tag_188")}, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, isPure = True}, FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_39_82_144, CursorTy)], + funArgs = [(arg_52_99_161, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), - (tail_194, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_39_82_144"], - bod = Switch "switch_197" - (VarTriv "tag_193") + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") (IntAlts [(0, - LetUnpackT {binds = [(x_40_83_145, + LetUnpackT {binds = [(x_53_100_162, IntTy)], - ptr = "tail_194", - bod = LetAllocT {lhs = "tailift_195", + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_40_83_145")], - bod = RetValsT [VarTriv "tailift_195"]}}), + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), (1, - LetUnpackT {binds = [(x_42_85_147, + LetUnpackT {binds = [(x_55_102_164, CursorTy), - (x_43_86_148, + (x_56_103_165, CursorTy)], - ptr = "tail_194", + ptr = "tail_211", bod = LetCallT {async = False, - binds = [(y_44_87_149, + binds = [(y_57_104_166, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_42_85_147"], + rands = [VarTriv "x_55_102_164"], bod = LetCallT {async = False, - binds = [(y_45_88_150, + binds = [(y_58_105_167, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_43_86_148"], - bod = LetAllocT {lhs = "tailift_196", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_44_87_149"), + VarTriv "y_57_104_166"), (CursorTy, - VarTriv "y_45_88_150")], - bod = RetValsT [VarTriv "tailift_196"]}}}})]) - (Just ErrT "Unknown tag in: tag_193")}, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, isPure = True}, FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_46_89_151, CursorTy)], + funArgs = [(arg_59_106_168, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), - (tail_199, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_46_89_151"], - bod = Switch "switch_202" - (VarTriv "tag_198") + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") (IntAlts [(0, - LetUnpackT {binds = [(x_47_90_152, + LetUnpackT {binds = [(x_60_107_169, IntTy)], - ptr = "tail_199", - bod = LetAllocT {lhs = "tailift_200", + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_47_90_152")], - bod = RetValsT [VarTriv "tailift_200"]}}), + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), (1, - LetUnpackT {binds = [(x_49_92_154, + LetUnpackT {binds = [(x_62_109_171, CursorTy), - (x_50_93_155, + (x_63_110_172, CursorTy)], - ptr = "tail_199", + ptr = "tail_216", bod = LetCallT {async = False, - binds = [(y_51_94_156, + binds = [(y_64_111_173, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_49_92_154"], + rands = [VarTriv "x_62_109_171"], bod = LetCallT {async = False, - binds = [(y_52_95_157, + binds = [(y_65_112_174, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_50_93_155"], - bod = LetAllocT {lhs = "tailift_201", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_51_94_156"), + VarTriv "y_64_111_173"), (CursorTy, - VarTriv "y_52_95_157")], - bod = RetValsT [VarTriv "tailift_201"]}}}})]) - (Just ErrT "Unknown tag in: tag_198")}, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, isPure = True}, FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_53_96_158, CursorTy)], + funArgs = [(arg_66_113_175, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), - (tail_204, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_53_96_158"], - bod = Switch "switch_205" - (VarTriv "tag_203") + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") (IntAlts [(0, - LetUnpackT {binds = [(x_54_97_159, + LetUnpackT {binds = [(x_67_114_176, IntTy)], - ptr = "tail_204", + ptr = "tail_221", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_56_98_160, + LetUnpackT {binds = [(x_69_115_177, CursorTy), - (x_57_99_161, + (x_70_116_178, CursorTy)], - ptr = "tail_204", + ptr = "tail_221", bod = LetCallT {async = False, - binds = [(y_58_100_162, + binds = [(y_71_117_179, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_56_98_160"], + rands = [VarTriv "x_69_115_177"], bod = LetCallT {async = False, - binds = [(y_59_101_163, + binds = [(y_72_118_180, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_57_99_161"], + rands = [VarTriv "x_70_116_178"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_203")}, + (Just ErrT "Unknown tag in: tag_220")}, isPure = True}, FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_60_102_164, CursorTy)], + funArgs = [(arg_73_119_181, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), - (tail_207, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_60_102_164"], - bod = Switch "switch_208" - (VarTriv "tag_206") + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") (IntAlts [(0, - LetUnpackT {binds = [(x_61_103_165, + LetUnpackT {binds = [(x_74_120_182, IntTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_63_104_166, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, ProdTy [])], prim = PrintSym, - rands = [SymTriv 181], - bod = LetPrimCallT {binds = [(wildcard_65_105_167, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], - bod = LetPrimCallT {binds = [(y_62_106_168, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_61_103_165"], - bod = LetPrimCallT {binds = [(wildcard_64_107_169, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_66_108_170, + LetUnpackT {binds = [(x_79_125_187, CursorTy), - (x_67_109_171, + (x_80_126_188, CursorTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_70_110_172, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, ProdTy [])], prim = PrintSym, - rands = [SymTriv 180], - bod = LetPrimCallT {binds = [(wildcard_73_111_173, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_68_112_174, + binds = [(y_81_129_191, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_66_108_170"], - bod = LetPrimCallT {binds = [(wildcard_72_113_175, + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_69_114_176, + binds = [(y_82_131_193, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_67_109_171"], - bod = LetPrimCallT {binds = [(wildcard_71_115_177, + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_206")}, + (Just ErrT "Unknown tag in: tag_223")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_118_126", + {lhs = "fltPkd_135_143", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_119_127", + bod = LetAllocT {lhs = "fltPkd_136_144", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_117_128", + bod = LetAllocT {lhs = "fltAppE_134_145", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_118_126"), + VarTriv "fltPkd_135_143"), (CursorTy, - VarTriv "fltPkd_119_127")], + VarTriv "fltPkd_136_144")], bod = LetCallT {async = False, - binds = [(fltAppE_116_129, + binds = [(fltAppE_133_146, CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_117_128"], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_134_145"], bod = LetCallT {async = False, - binds = [(tmp_app_178, + binds = [(tmp_app_195, CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_116_129"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_133_146"], bod = LetCallT {async = False, binds = [], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_178"], + rands = [VarTriv "tmp_app_195"], bod = LetPrimCallT {binds = [], prim = PrintString "\n", rands = [], bod = RetValsT []}}}}}}})} - [compiler] Final C codegen: 13304 characters. + [compiler] Final C codegen: 13391 characters. ================================================================================ /* Gibbon program. */ @@ -2949,12 +3088,12 @@ typedef struct GibCursorGibCursorProd_struct { GibCursor field0; GibCursor field1; } GibCursorGibCursorProd; -GibCursor Addone_add_5(GibCursor t_7_74_130); -GibCursor Addtwo_add_6(GibCursor t_11_78_137); -GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144); -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151); -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158); -unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164); +GibCursor Addone_add_5(GibCursor t_8_87_147); +GibCursor Addtwo_add_6(GibCursor t_12_91_154); +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); typedef enum { GibInt_T, GibFloat_T, @@ -2996,220 +3135,220 @@ void info_table_initialize(void) } void symbol_table_initialize(void) { - gib_add_symbol(179, ")"); - gib_add_symbol(180, "(Node"); - gib_add_symbol(181, "(Leaf"); - gib_add_symbol(182, " "); + gib_add_symbol(196, ")"); + gib_add_symbol(197, "(Node"); + gib_add_symbol(198, "(Leaf"); + gib_add_symbol(199, " "); } -GibCursor Addone_add_5(GibCursor t_7_74_130) +GibCursor Addone_add_5(GibCursor t_8_87_147) { - GibPackedTag tag_183 = *(GibPackedTag *) t_7_74_130; - GibCursor tail_184 = t_7_74_130 + sizeof(GibInt); + GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; + GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); - switch_187: + switch_204: ; - switch (tag_183) { + switch (tag_200) { case 0: { - GibInt x_8_75_131 = ((GibIntProd *) tail_184)->field0; - GibInt fltPkd_120_132 = x_8_75_131 + 1; - GibPtr tailift_185 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; + GibInt fltPkd_137_149 = x_9_88_148 + 1; + GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_185)->field0 = 0; - ((GibIntGibIntProd *) tailift_185)->field1 = fltPkd_120_132; - return tailift_185; + ((GibIntGibIntProd *) tailift_202)->field0 = 0; + ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; + return tailift_202; break; } case 1: { - GibCursor x1_9_76_133 = - ((GibCursorGibCursorProd *) tail_184)->field0; - GibCursor x2_10_77_134 = - ((GibCursorGibCursorProd *) tail_184)->field1; - GibCursor fltPkd_121_135 = Addone_add_5(x1_9_76_133); - GibCursor fltPkd_122_136 = Addone_add_5(x2_10_77_134); - GibPtr tailift_186 = + GibCursor x1_10_89_150 = + ((GibCursorGibCursorProd *) tail_201)->field0; + GibCursor x2_11_90_151 = + ((GibCursorGibCursorProd *) tail_201)->field1; + GibCursor fltPkd_138_152 = Addone_add_5(x1_10_89_150); + GibCursor fltPkd_139_153 = Addone_add_5(x2_11_90_151); + GibPtr tailift_203 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_186)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_186)->field1 = - fltPkd_121_135; - ((GibIntGibCursorGibCursorProd *) tailift_186)->field2 = - fltPkd_122_136; - return tailift_186; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = + fltPkd_138_152; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = + fltPkd_139_153; + return tailift_203; break; } default: { - printf("%s\n", "Unknown tag in: tag_183"); + printf("%s\n", "Unknown tag in: tag_200"); exit(1); } } } -GibCursor Addtwo_add_6(GibCursor t_11_78_137) +GibCursor Addtwo_add_6(GibCursor t_12_91_154) { - GibPackedTag tag_188 = *(GibPackedTag *) t_11_78_137; - GibCursor tail_189 = t_11_78_137 + sizeof(GibInt); + GibPackedTag tag_205 = *(GibPackedTag *) t_12_91_154; + GibCursor tail_206 = t_12_91_154 + sizeof(GibInt); - switch_192: + switch_209: ; - switch (tag_188) { + switch (tag_205) { case 0: { - GibInt x_12_79_138 = ((GibIntProd *) tail_189)->field0; - GibInt fltPkd_123_139 = x_12_79_138 + 2; - GibPtr tailift_190 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_13_92_155 = ((GibIntProd *) tail_206)->field0; + GibInt fltPkd_140_156 = x_13_92_155 + 2; + GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_190)->field0 = 0; - ((GibIntGibIntProd *) tailift_190)->field1 = fltPkd_123_139; - return tailift_190; + ((GibIntGibIntProd *) tailift_207)->field0 = 0; + ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; + return tailift_207; break; } case 1: { - GibCursor x1_13_80_140 = - ((GibCursorGibCursorProd *) tail_189)->field0; - GibCursor x2_14_81_141 = - ((GibCursorGibCursorProd *) tail_189)->field1; - GibCursor fltPkd_124_142 = Addtwo_add_6(x1_13_80_140); - GibCursor fltPkd_125_143 = Addtwo_add_6(x2_14_81_141); - GibPtr tailift_191 = + GibCursor x1_14_93_157 = + ((GibCursorGibCursorProd *) tail_206)->field0; + GibCursor x2_15_94_158 = + ((GibCursorGibCursorProd *) tail_206)->field1; + GibCursor fltPkd_141_159 = Addtwo_add_6(x1_14_93_157); + GibCursor fltPkd_142_160 = Addtwo_add_6(x2_15_94_158); + GibPtr tailift_208 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_191)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_191)->field1 = - fltPkd_124_142; - ((GibIntGibCursorGibCursorProd *) tailift_191)->field2 = - fltPkd_125_143; - return tailift_191; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = + fltPkd_141_159; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = + fltPkd_142_160; + return tailift_208; break; } default: { - printf("%s\n", "Unknown tag in: tag_188"); + printf("%s\n", "Unknown tag in: tag_205"); exit(1); } } } -GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144) +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) { - GibPackedTag tag_193 = *(GibPackedTag *) arg_39_82_144; - GibCursor tail_194 = arg_39_82_144 + sizeof(GibInt); + GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; + GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); - switch_197: + switch_214: ; - switch (tag_193) { + switch (tag_210) { case 0: { - GibInt x_40_83_145 = ((GibIntProd *) tail_194)->field0; - GibPtr tailift_195 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; + GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_195)->field0 = 0; - ((GibIntGibIntProd *) tailift_195)->field1 = x_40_83_145; - return tailift_195; + ((GibIntGibIntProd *) tailift_212)->field0 = 0; + ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; + return tailift_212; break; } case 1: { - GibCursor x_42_85_147 = - ((GibCursorGibCursorProd *) tail_194)->field0; - GibCursor x_43_86_148 = - ((GibCursorGibCursorProd *) tail_194)->field1; - GibCursor y_44_87_149 = _copy_AddTree_Tree_4(x_42_85_147); - GibCursor y_45_88_150 = _copy_AddTree_Tree_4(x_43_86_148); - GibPtr tailift_196 = + GibCursor x_55_102_164 = + ((GibCursorGibCursorProd *) tail_211)->field0; + GibCursor x_56_103_165 = + ((GibCursorGibCursorProd *) tail_211)->field1; + GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); + GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); + GibPtr tailift_213 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_196)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_196)->field1 = - y_44_87_149; - ((GibIntGibCursorGibCursorProd *) tailift_196)->field2 = - y_45_88_150; - return tailift_196; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = + y_57_104_166; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = + y_58_105_167; + return tailift_213; break; } default: { - printf("%s\n", "Unknown tag in: tag_193"); + printf("%s\n", "Unknown tag in: tag_210"); exit(1); } } } -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151) +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) { - GibPackedTag tag_198 = *(GibPackedTag *) arg_46_89_151; - GibCursor tail_199 = arg_46_89_151 + sizeof(GibInt); + GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; + GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); - switch_202: + switch_219: ; - switch (tag_198) { + switch (tag_215) { case 0: { - GibInt x_47_90_152 = ((GibIntProd *) tail_199)->field0; - GibPtr tailift_200 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; + GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_200)->field0 = 0; - ((GibIntGibIntProd *) tailift_200)->field1 = x_47_90_152; - return tailift_200; + ((GibIntGibIntProd *) tailift_217)->field0 = 0; + ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; + return tailift_217; break; } case 1: { - GibCursor x_49_92_154 = - ((GibCursorGibCursorProd *) tail_199)->field0; - GibCursor x_50_93_155 = - ((GibCursorGibCursorProd *) tail_199)->field1; - GibCursor y_51_94_156 = - _copy_without_ptrs_AddTree_Tree_4(x_49_92_154); - GibCursor y_52_95_157 = - _copy_without_ptrs_AddTree_Tree_4(x_50_93_155); - GibPtr tailift_201 = + GibCursor x_62_109_171 = + ((GibCursorGibCursorProd *) tail_216)->field0; + GibCursor x_63_110_172 = + ((GibCursorGibCursorProd *) tail_216)->field1; + GibCursor y_64_111_173 = + _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); + GibCursor y_65_112_174 = + _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); + GibPtr tailift_218 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_201)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_201)->field1 = - y_51_94_156; - ((GibIntGibCursorGibCursorProd *) tailift_201)->field2 = - y_52_95_157; - return tailift_201; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = + y_64_111_173; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = + y_65_112_174; + return tailift_218; break; } default: { - printf("%s\n", "Unknown tag in: tag_198"); + printf("%s\n", "Unknown tag in: tag_215"); exit(1); } } } -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) { - GibPackedTag tag_203 = *(GibPackedTag *) arg_53_96_158; - GibCursor tail_204 = arg_53_96_158 + sizeof(GibInt); + GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; + GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); - switch_205: + switch_222: ; - switch (tag_203) { + switch (tag_220) { case 0: { - GibInt x_54_97_159 = ((GibIntProd *) tail_204)->field0; + GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; return 0; break; @@ -3217,12 +3356,14 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) case 1: { - GibCursor x_56_98_160 = - ((GibCursorGibCursorProd *) tail_204)->field0; - GibCursor x_57_99_161 = - ((GibCursorGibCursorProd *) tail_204)->field1; - unsigned char y_58_100_162 = _traverse_AddTree_Tree_4(x_56_98_160); - unsigned char y_59_101_163 = _traverse_AddTree_Tree_4(x_57_99_161); + GibCursor x_69_115_177 = + ((GibCursorGibCursorProd *) tail_221)->field0; + GibCursor x_70_116_178 = + ((GibCursorGibCursorProd *) tail_221)->field1; + unsigned char y_71_117_179 = + _traverse_AddTree_Tree_4(x_69_115_177); + unsigned char y_72_118_180 = + _traverse_AddTree_Tree_4(x_70_116_178); return 0; break; @@ -3230,28 +3371,28 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) default: { - printf("%s\n", "Unknown tag in: tag_203"); + printf("%s\n", "Unknown tag in: tag_220"); exit(1); } } } -unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) { - GibPackedTag tag_206 = *(GibPackedTag *) arg_60_102_164; - GibCursor tail_207 = arg_60_102_164 + sizeof(GibInt); + GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; + GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); - switch_208: + switch_225: ; - switch (tag_206) { + switch (tag_223) { case 0: { - GibInt x_61_103_165 = ((GibIntProd *) tail_207)->field0; - unsigned char wildcard_63_104_166 = gib_print_symbol(181); - unsigned char wildcard_65_105_167 = gib_print_symbol(182); - unsigned char y_62_106_168 = printf("%ld", x_61_103_165); - unsigned char wildcard_64_107_169 = gib_print_symbol(179); + GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; + unsigned char wildcard_76_121_183 = gib_print_symbol(198); + unsigned char wildcard_78_122_184 = gib_print_symbol(199); + unsigned char y_75_123_185 = printf("%ld", x_74_120_182); + unsigned char wildcard_77_124_186 = gib_print_symbol(196); return 0; break; @@ -3259,16 +3400,16 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) case 1: { - GibCursor x_66_108_170 = - ((GibCursorGibCursorProd *) tail_207)->field0; - GibCursor x_67_109_171 = - ((GibCursorGibCursorProd *) tail_207)->field1; - unsigned char wildcard_70_110_172 = gib_print_symbol(180); - unsigned char wildcard_73_111_173 = gib_print_symbol(182); - unsigned char y_68_112_174 = _print_AddTree_Tree_4(x_66_108_170); - unsigned char wildcard_72_113_175 = gib_print_symbol(182); - unsigned char y_69_114_176 = _print_AddTree_Tree_4(x_67_109_171); - unsigned char wildcard_71_115_177 = gib_print_symbol(179); + GibCursor x_79_125_187 = + ((GibCursorGibCursorProd *) tail_224)->field0; + GibCursor x_80_126_188 = + ((GibCursorGibCursorProd *) tail_224)->field1; + unsigned char wildcard_83_127_189 = gib_print_symbol(197); + unsigned char wildcard_86_128_190 = gib_print_symbol(199); + unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); + unsigned char wildcard_85_130_192 = gib_print_symbol(199); + unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); + unsigned char wildcard_84_132_194 = gib_print_symbol(196); return 0; break; @@ -3276,7 +3417,7 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) default: { - printf("%s\n", "Unknown tag in: tag_206"); + printf("%s\n", "Unknown tag in: tag_223"); exit(1); } } @@ -3288,26 +3429,26 @@ int main(int argc, char **argv) info_table_initialize(); symbol_table_initialize(); - GibPtr fltPkd_118_126 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_118_126)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_118_126)->field1 = 1; + ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; - GibPtr fltPkd_119_127 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_119_127)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_119_127)->field1 = 2; + ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; - GibPtr fltAppE_117_128 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field1 = fltPkd_118_126; - ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field2 = fltPkd_119_127; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; - GibCursor fltAppE_116_129 = Addtwo_add_6(fltAppE_117_128); - GibCursor tmp_app_178 = Addone_add_5(fltAppE_116_129); + GibCursor fltAppE_133_146 = Addone_add_5(fltAppE_134_145); + GibCursor tmp_app_195 = Addtwo_add_6(fltAppE_133_146); - _print_AddTree_Tree_4(tmp_app_178); + _print_AddTree_Tree_4(tmp_app_195); printf("\n"); return 0; diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index e79c4d853..967f2cd13 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -203,6 +203,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports dbgPrintLn 2 "================================================================================" dbgPrintLn 2 $ "desugaring module: " ++ mod_name dbgPrintLn 2 $ "- imports: " ++ (show import_names) + dbgPrintLn 2 $ "- aliases: " ++ (show aliases) imported_progs :: [PassM Prog0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports let prog = do @@ -250,6 +251,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports funs''' (M.keys userOrderings') imported_progs' <- mapM id imported_progs + Prog defs'' funs'''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' let (defs0, funs0) = foldr (\Prog {ddefs, fundefs} (defs1, funs1) -> @@ -288,14 +290,21 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports error $ "Conflicting definitions of " ++ show (S.toList em2) ++ " found in " ++ mod_name) - (defs', funs''') + (defs'', funs'''') imported_progs' - fillImports (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + return $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) mod_name = moduleName head_mb - import_names = (map (\(ImportDecl _ (ModuleName _ imp_name) _ _ _ _ _ _) -> imp_name) imports) + import_names = (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ _ _) -> importName) imports) + aliases = M.fromList (map + (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ aliased _) -> + case aliased of + Just (ModuleName _ importAs) -> ((toVar importName), (toVar importAs)) + Nothing -> ((toVar importName), (toVar importName)) + ) + imports) coalese_constraints :: [(Var, M.Map DataCon [UserOrdering])] -> [(Var, M.Map DataCon [UserOrdering])] @@ -431,9 +440,9 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} error $ "Qualified imports not supported yet. Offending import: " ++ prettyPrint decl - when (isJust importAs) $ - error $ - "Module aliases not supported yet. Offending import: " ++ prettyPrint decl + --when (isJust importAs) $ + -- error $ + -- "Module aliases not supported yet. Offending import: " ++ prettyPrint decl when (isJust importSpecs) $ error $ "Selective imports not supported yet. Offending import: " ++ diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index ea60831ef..25c36a695 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -15,16 +15,34 @@ import Gibbon.Common import Gibbon.L0.Syntax import qualified Gibbon.L1.Syntax as L1 +import qualified Language.Haskell.Exts.Syntax as H + -------------------------------------------------------------------------------- type VarEnv = M.Map Var (M.Map Var Var) type TyVarEnv t = M.Map TyVar t -fillImports :: Prog0 -> PassM Prog0 -fillImports (Prog defs funs main) = +fillImports :: Prog0 -> Var -> [H.ImportDecl a] -> [Prog0]-> PassM Prog0 +fillImports (Prog defs funs main) localMod imports imported_progs = do - -- defs - let defNameMap = M.fromList $ zip (M.keys defs) (M.keys defs) + + -- resolve aliases in imported functions + let aliases = getAliases imports + let initImportedNames :: [(Var, Var)] = [] + let applyAlias :: Var -> M.Map Var Var -> (Var, Var) + applyAlias v aliasMap = do + let (mod, name) = parseOutMod v + case mod of + Just modName -> + case (M.lookup modName aliasMap) of + Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), v) + Nothing -> error $ "could not find module or alias: " ++ (show modName) + Nothing -> error "how did we get here?" + let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyAlias tyName aliases) (M.keys idefs))) initImportedNames imported_progs + let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyAlias funName aliases) (M.keys ifuns))) initImportedNames imported_progs + + -- build def env + let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (M.keys defs)) let initDefEnv :: VarEnv = M.empty let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap let transformDefKey :: Var -> Var @@ -32,8 +50,8 @@ fillImports (Prog defs funs main) = let (mod, name) = parseOutMod k resolveNameInEnv mod name defenv - -- funs - let funNameMap = M.fromList $ zip (M.keys funs) (M.keys funs) + -- build fun env + let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (M.keys funs)) let initFunEnv :: VarEnv = M.empty let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap let transformFunKey :: Var -> Var @@ -44,9 +62,11 @@ fillImports (Prog defs funs main) = -- main main' <- case main of Nothing -> return Nothing - Just (m,ty) -> do m' <- resolveModInExp m defenv funenv + Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) + m' <- resolveModInExp m defenv funenv return $ Just (m',ty) + defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs @@ -55,6 +75,27 @@ fillImports (Prog defs funs main) = return $ Prog defs'' funs'' main' +getAliases :: [H.ImportDecl a] -> M.Map Var Var +getAliases imports = do + M.fromList $ map + (\(H.ImportDecl _ (H.ModuleName _ importName) _ _ _ _ aliased _) -> + case aliased of + Just (H.ModuleName _ importAs) -> ((toVar importName), (toVar importAs)) + Nothing -> ((toVar importName), (toVar importName)) + ) + imports + +resolveAlias :: Var -> Var -> M.Map Var Var -> (Var, Var) +resolveAlias fullName localMod aliases = do + let (mod, name) = parseOutMod fullName + case mod of + Just modName -> + if modName == localMod then (fullName, fullName) + else case (M.lookup modName aliases) of + Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), fullName) + Nothing -> error $ "could not find import: " ++ (fromVar modName) ++ " in alias map: " ++ (show aliases) + Nothing -> error $ "tbh shoulding get here either -- resolving aliases, couldn't parse out module name in declaration" + resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = do @@ -119,7 +160,7 @@ resolveModInExp exp defenv funenv = let (mod, fun) = parseOutMod v let v' = resolveNameInEnv mod fun funenv ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls - return $ AppE v' locs ls + return $ AppE v' locs ls' PrimAppE p es -> return $ PrimAppE p es @@ -184,7 +225,7 @@ resolveNameInEnv mod name e = Just modspace -> case mod of Just m -> case (M.lookup m modspace) of Just n -> n - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) ++ " in env: " ++ (show e) Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find " ++ (fromVar name) - Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file + else error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) \ No newline at end of file From 434712c2e3f77de90c8f4365eba3ff2f210e5ce4 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 22 Nov 2023 15:46:20 -0800 Subject: [PATCH 10/68] qualified imports --- gibbon-compiler/examples/addimport.hs | 6 +- gibbon-compiler/ir.log | 3453 +---------------- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 4 - .../src/Gibbon/Passes/ModuleFillImports.hs | 62 +- 4 files changed, 35 insertions(+), 3490 deletions(-) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index 6b0f947d0..e779665a0 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,6 +1,6 @@ module AddImport where - import Addone as On - import Addtwo as Tw + import qualified Addone as On + import qualified Addtwo as Tw import AddTree - gibbon_main = Tw.add (On.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = On.add (Tw.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index 156118cf7..3652f187a 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -32,3453 +32,6 @@ desugaring module: Addtwo - aliases: fromList [(Var "AddTree",Var "AddTree")] - [compiler] pipeline starting, parsed program: -================================================================================ -Prog {ddefs = [(AddTree.Tree, - DDef {tyName = "AddTree.Tree", - tyArgs = [], - dataCons = [("Leaf", [(False, IntTy)]), - ("Node", - [(False, PackedTy "AddTree.Tree" []), - (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(Addone.add, - FunDef {funName = "Addone.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addone.add" [] [VarE "x1"], - AppE "Addone.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.add, - FunDef {funName = "Addtwo.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addtwo.add" [] [VarE "x1"], - AppE "Addtwo.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.sub, - FunDef {funName = "Addtwo.sub", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addtwo.sub" [] [VarE "x1"], - AppE "Addtwo.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Addtwo.add" - [] - [AppE "Addone.add" - [] - [DataConE (MetaTv $0) - "Node" - [DataConE (MetaTv $1) "Leaf" [LitE 1], - DataConE (MetaTv $2) "Leaf" [LitE 2]]]], - MetaTv $3)} - - [compiler] Running pass, renameModules -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 1) - Node x1::$4 x2::$5 -> - (Node $3 (Addone_add_5 [] x1) (Addone_add_5 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 2) - Node x1::$4 x2::$5 -> - (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t = - case t of - Leaf x::$8 -> - (Leaf $7 x - 2) - Node x1::$10 x2::$11 -> - (Node $9 (Addtwo_sub_7 [] x1) (Addtwo_sub_7 [] x2)) - -gibbon_main :: $3 -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) - - [compiler] Running pass, freshen -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::$2 -> - (Leaf $1 x_9 + 1) - Node x1_10::$4 x2_11::$5 -> - (Node $3 (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::$2 -> - (Leaf $1 x_13 + 2) - Node x1_14::$4 x2_15::$5 -> - (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::$8 -> - (Leaf $7 x_17 - 2) - Node x1_18::$10 x2_19::$11 -> - (Node $9 (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: $3 -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, bindLambdas -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, monomorphize -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, specLambdas -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, desugarL0 -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::() -> - (Leaf () x_9 + 1) - Node x1_10::() x2_11::() -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 - 2) - Node x1_18::() x2_19::() -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, floatOutCase -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::() -> - (Leaf () x_9 + 1) - Node x1_10::() x2_11::() -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 - 2) - Node x1_18::() x2_19::() -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, toL1 -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, benchMainExp -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, simplify -Removed unused functions: [Var "Addtwo_sub_7"] -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 + 1) - Node x1_10_89 x2_11_90 -> - (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91 = - case t_12_91 of - Leaf x_13_92 -> - (Leaf x_13_92 + 2) - Node x1_14_93 x2_15_94 -> - (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 + 1) - Node x1_10_89 x2_11_90 -> - (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91 = - case t_12_91 of - Leaf x_13_92 -> - (Leaf x_13_92 + 2) - Node x1_14_93 x2_15_94 -> - (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, flatten -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - let fltPkd_137 :: Int = x_9_88 + 1 in - (Leaf fltPkd_137) - Node x1_10_89 x2_11_90 -> - let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89) in - let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90) in - (Node fltPkd_138 fltPkd_139) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91 = - case t_12_91 of - Leaf x_13_92 -> - let fltPkd_140 :: Int = x_13_92 + 2 in - (Leaf fltPkd_140) - Node x1_14_93 x2_15_94 -> - let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93) in - let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94) in - (Node fltPkd_141 fltPkd_142) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in - let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134) in - (Addtwo_add_6 [] fltAppE_133) - - [compiler] Running pass, simplify -Removed unused functions: [] -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - let y_54_101_163 :: Int = x_53_100_162 in - (Leaf y_54_101_163) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - let y_61_108_170 :: Int = x_60_107_169 in - (Leaf y_61_108_170) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, inlineTriv -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, directL3 -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, unariser -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, L3.flatten -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, lower -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = AddP, - rands = [VarTriv "x_9_88_148", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_12_91_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_12_91_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_13_92_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_13_92_155", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_14_93_157, - CursorTy), - (x2_15_94_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x1_14_93_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x2_15_94_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), - (1, - LetUnpackT {binds = [(x_55_102_164, - CursorTy), - (x_56_103_165, - CursorTy)], - ptr = "tail_211", - bod = LetCallT {async = False, - binds = [(y_57_104_166, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], - bod = LetCallT {async = False, - binds = [(y_58_105_167, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_57_104_166"), - (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") - (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, - IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), - (1, - LetUnpackT {binds = [(x_62_109_171, - CursorTy), - (x_63_110_172, - CursorTy)], - ptr = "tail_216", - bod = LetCallT {async = False, - binds = [(y_64_111_173, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], - bod = LetCallT {async = False, - binds = [(y_65_112_174, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_64_111_173"), - (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") - (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, - IntTy)], - ptr = "tail_221", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_69_115_177, - CursorTy), - (x_70_116_178, - CursorTy)], - ptr = "tail_221", - bod = LetCallT {async = False, - binds = [(y_71_117_179, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], - bod = LetCallT {async = False, - binds = [(y_72_118_180, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") - (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, - IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_79_125_187, - CursorTy), - (x_80_126_188, - CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_81_129_191, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_82_131_193, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, - isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Running pass, lateInlineTriv -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = AddP, - rands = [VarTriv "x_9_88_148", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_12_91_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_12_91_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_13_92_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_13_92_155", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_14_93_157, - CursorTy), - (x2_15_94_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x1_14_93_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x2_15_94_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), - (1, - LetUnpackT {binds = [(x_55_102_164, - CursorTy), - (x_56_103_165, - CursorTy)], - ptr = "tail_211", - bod = LetCallT {async = False, - binds = [(y_57_104_166, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], - bod = LetCallT {async = False, - binds = [(y_58_105_167, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_57_104_166"), - (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") - (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, - IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), - (1, - LetUnpackT {binds = [(x_62_109_171, - CursorTy), - (x_63_110_172, - CursorTy)], - ptr = "tail_216", - bod = LetCallT {async = False, - binds = [(y_64_111_173, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], - bod = LetCallT {async = False, - binds = [(y_65_112_174, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_64_111_173"), - (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") - (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, - IntTy)], - ptr = "tail_221", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_69_115_177, - CursorTy), - (x_70_116_178, - CursorTy)], - ptr = "tail_221", - bod = LetCallT {async = False, - binds = [(y_71_117_179, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], - bod = LetCallT {async = False, - binds = [(y_72_118_180, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") - (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, - IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_79_125_187, - CursorTy), - (x_80_126_188, - CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_81_129_191, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_82_131_193, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, - isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Running pass, rearrangeFree -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = AddP, - rands = [VarTriv "x_9_88_148", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_12_91_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_12_91_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_13_92_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_13_92_155", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_14_93_157, - CursorTy), - (x2_15_94_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x1_14_93_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x2_15_94_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), - (1, - LetUnpackT {binds = [(x_55_102_164, - CursorTy), - (x_56_103_165, - CursorTy)], - ptr = "tail_211", - bod = LetCallT {async = False, - binds = [(y_57_104_166, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], - bod = LetCallT {async = False, - binds = [(y_58_105_167, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_57_104_166"), - (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") - (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, - IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), - (1, - LetUnpackT {binds = [(x_62_109_171, - CursorTy), - (x_63_110_172, - CursorTy)], - ptr = "tail_216", - bod = LetCallT {async = False, - binds = [(y_64_111_173, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], - bod = LetCallT {async = False, - binds = [(y_65_112_174, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_64_111_173"), - (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") - (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, - IntTy)], - ptr = "tail_221", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_69_115_177, - CursorTy), - (x_70_116_178, - CursorTy)], - ptr = "tail_221", - bod = LetCallT {async = False, - binds = [(y_71_117_179, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], - bod = LetCallT {async = False, - binds = [(y_72_118_180, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") - (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, - IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_79_125_187, - CursorTy), - (x_80_126_188, - CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_81_129_191, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_82_131_193, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, - isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Final C codegen: 13391 characters. -================================================================================ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef struct GibIntProd_struct { - GibInt field0; - } GibIntProd; -typedef struct GibIntGibIntProd_struct { - GibInt field0; - GibInt field1; - } GibIntGibIntProd; -typedef struct GibIntGibCursorGibCursorProd_struct { - GibInt field0; - GibCursor field1; - GibCursor field2; - } GibIntGibCursorGibCursorProd; -typedef struct GibPackedTagGibCursorProd_struct { - GibPackedTag field0; - GibCursor field1; - } GibPackedTagGibCursorProd; -typedef struct GibCursorProd_struct { - GibCursor field0; - } GibCursorProd; -typedef struct GibCursorGibCursorProd_struct { - GibCursor field0; - GibCursor field1; - } GibCursorGibCursorProd; -GibCursor Addone_add_5(GibCursor t_8_87_147); -GibCursor Addtwo_add_6(GibCursor t_12_91_154); -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - AddTree_Tree_4_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(8); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[1]; - - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 0); - exit(1); - } - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 1); - exit(1); - } - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ - gib_add_symbol(196, ")"); - gib_add_symbol(197, "(Node"); - gib_add_symbol(198, "(Leaf"); - gib_add_symbol(199, " "); -} -GibCursor Addone_add_5(GibCursor t_8_87_147) -{ - GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; - GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); - - - switch_204: - ; - switch (tag_200) { - - case 0: - { - GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; - GibInt fltPkd_137_149 = x_9_88_148 + 1; - GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_202)->field0 = 0; - ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; - return tailift_202; - break; - } - - case 1: - { - GibCursor x1_10_89_150 = - ((GibCursorGibCursorProd *) tail_201)->field0; - GibCursor x2_11_90_151 = - ((GibCursorGibCursorProd *) tail_201)->field1; - GibCursor fltPkd_138_152 = Addone_add_5(x1_10_89_150); - GibCursor fltPkd_139_153 = Addone_add_5(x2_11_90_151); - GibPtr tailift_203 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = - fltPkd_138_152; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = - fltPkd_139_153; - return tailift_203; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_200"); - exit(1); - } - } -} -GibCursor Addtwo_add_6(GibCursor t_12_91_154) -{ - GibPackedTag tag_205 = *(GibPackedTag *) t_12_91_154; - GibCursor tail_206 = t_12_91_154 + sizeof(GibInt); - - - switch_209: - ; - switch (tag_205) { - - case 0: - { - GibInt x_13_92_155 = ((GibIntProd *) tail_206)->field0; - GibInt fltPkd_140_156 = x_13_92_155 + 2; - GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_207)->field0 = 0; - ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; - return tailift_207; - break; - } - - case 1: - { - GibCursor x1_14_93_157 = - ((GibCursorGibCursorProd *) tail_206)->field0; - GibCursor x2_15_94_158 = - ((GibCursorGibCursorProd *) tail_206)->field1; - GibCursor fltPkd_141_159 = Addtwo_add_6(x1_14_93_157); - GibCursor fltPkd_142_160 = Addtwo_add_6(x2_15_94_158); - GibPtr tailift_208 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = - fltPkd_141_159; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = - fltPkd_142_160; - return tailift_208; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_205"); - exit(1); - } - } -} -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) -{ - GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; - GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); - - - switch_214: - ; - switch (tag_210) { - - case 0: - { - GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; - GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_212)->field0 = 0; - ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; - return tailift_212; - break; - } - - case 1: - { - GibCursor x_55_102_164 = - ((GibCursorGibCursorProd *) tail_211)->field0; - GibCursor x_56_103_165 = - ((GibCursorGibCursorProd *) tail_211)->field1; - GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); - GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); - GibPtr tailift_213 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = - y_57_104_166; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = - y_58_105_167; - return tailift_213; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_210"); - exit(1); - } - } -} -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) -{ - GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; - GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); - - - switch_219: - ; - switch (tag_215) { - - case 0: - { - GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; - GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_217)->field0 = 0; - ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; - return tailift_217; - break; - } - - case 1: - { - GibCursor x_62_109_171 = - ((GibCursorGibCursorProd *) tail_216)->field0; - GibCursor x_63_110_172 = - ((GibCursorGibCursorProd *) tail_216)->field1; - GibCursor y_64_111_173 = - _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); - GibCursor y_65_112_174 = - _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); - GibPtr tailift_218 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = - y_64_111_173; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = - y_65_112_174; - return tailift_218; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_215"); - exit(1); - } - } -} -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) -{ - GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; - GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); - - - switch_222: - ; - switch (tag_220) { - - case 0: - { - GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; - - return 0; - break; - } - - case 1: - { - GibCursor x_69_115_177 = - ((GibCursorGibCursorProd *) tail_221)->field0; - GibCursor x_70_116_178 = - ((GibCursorGibCursorProd *) tail_221)->field1; - unsigned char y_71_117_179 = - _traverse_AddTree_Tree_4(x_69_115_177); - unsigned char y_72_118_180 = - _traverse_AddTree_Tree_4(x_70_116_178); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_220"); - exit(1); - } - } -} -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) -{ - GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; - GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); - - - switch_225: - ; - switch (tag_223) { - - case 0: - { - GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; - unsigned char wildcard_76_121_183 = gib_print_symbol(198); - unsigned char wildcard_78_122_184 = gib_print_symbol(199); - unsigned char y_75_123_185 = printf("%ld", x_74_120_182); - unsigned char wildcard_77_124_186 = gib_print_symbol(196); - - return 0; - break; - } - - case 1: - { - GibCursor x_79_125_187 = - ((GibCursorGibCursorProd *) tail_224)->field0; - GibCursor x_80_126_188 = - ((GibCursorGibCursorProd *) tail_224)->field1; - unsigned char wildcard_83_127_189 = gib_print_symbol(197); - unsigned char wildcard_86_128_190 = gib_print_symbol(199); - unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); - unsigned char wildcard_85_130_192 = gib_print_symbol(199); - unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); - unsigned char wildcard_84_132_194 = gib_print_symbol(196); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_223"); - exit(1); - } - } -} -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; - - GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; - - GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; - - GibCursor fltAppE_133_146 = Addone_add_5(fltAppE_134_145); - GibCursor tmp_app_195 = Addtwo_add_6(fltAppE_133_146); - - _print_AddTree_Tree_4(tmp_app_195); - printf("\n"); - return 0; - - int exit_1 = gib_exit(); - - return exit_1; -} - -Compiling RTS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 - -make: Nothing to be done for 'all'. - - - - -Compiling the program -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng - - - -In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] - #warning "Simple write barrier is disabled." - ^~~~~~~ - - -(Node (Leaf 4) (Leaf 5)) +gibbon: Ambiguous reference +CallStack (from HasCallStack): + error, called at src/Gibbon/Passes/ModuleFillImports.hs:226:35 in gibbon-0.3-inplace:Gibbon.Passes.ModuleFillImports diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 967f2cd13..356e93a21 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -436,10 +436,6 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} error $ "Circular dependency detected. Import path: " ++ show (mod_name : import_route) - when (importQualified) $ - error $ - "Qualified imports not supported yet. Offending import: " ++ - prettyPrint decl --when (isJust importAs) $ -- error $ -- "Module aliases not supported yet. Offending import: " ++ prettyPrint decl diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 25c36a695..12b58ae9a 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -19,7 +19,7 @@ import qualified Language.Haskell.Exts.Syntax as H -------------------------------------------------------------------------------- -type VarEnv = M.Map Var (M.Map Var Var) +type VarEnv = M.Map Var (M.Map Var (Var, Bool)) type TyVarEnv t = M.Map TyVar t fillImports :: Prog0 -> Var -> [H.ImportDecl a] -> [Prog0]-> PassM Prog0 @@ -27,22 +27,22 @@ fillImports (Prog defs funs main) localMod imports imported_progs = do -- resolve aliases in imported functions - let aliases = getAliases imports - let initImportedNames :: [(Var, Var)] = [] - let applyAlias :: Var -> M.Map Var Var -> (Var, Var) - applyAlias v aliasMap = do + let importMeta = getImportMeta imports + let initImportedNames :: [(Var, (Var, Bool))] = [] + let applyImportMeta :: Var -> M.Map Var (Var, Bool) -> (Var, (Var, Bool)) + applyImportMeta v importMap = do let (mod, name) = parseOutMod v case mod of Just modName -> - case (M.lookup modName aliasMap) of - Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), v) + case (M.lookup modName importMap) of + Just (alias, qual) -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual)) Nothing -> error $ "could not find module or alias: " ++ (show modName) Nothing -> error "how did we get here?" - let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyAlias tyName aliases) (M.keys idefs))) initImportedNames imported_progs - let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyAlias funName aliases) (M.keys ifuns))) initImportedNames imported_progs + let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs + let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs -- build def env - let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (M.keys defs)) + let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (map (\v -> (v, False)) (M.keys defs))) let initDefEnv :: VarEnv = M.empty let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap let transformDefKey :: Var -> Var @@ -51,7 +51,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = resolveNameInEnv mod name defenv -- build fun env - let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (M.keys funs)) + let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (map (\v -> (v, False)) (M.keys funs)) ) let initFunEnv :: VarEnv = M.empty let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap let transformFunKey :: Var -> Var @@ -75,27 +75,16 @@ fillImports (Prog defs funs main) localMod imports imported_progs = return $ Prog defs'' funs'' main' -getAliases :: [H.ImportDecl a] -> M.Map Var Var -getAliases imports = do +getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool) +getImportMeta imports = do M.fromList $ map - (\(H.ImportDecl _ (H.ModuleName _ importName) _ _ _ _ aliased _) -> + (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased _) -> case aliased of - Just (H.ModuleName _ importAs) -> ((toVar importName), (toVar importAs)) - Nothing -> ((toVar importName), (toVar importName)) + Just (H.ModuleName _ importAs) -> ((toVar importName), ((toVar importAs), qualified)) + Nothing -> ((toVar importName), ((toVar importName), qualified)) ) imports -resolveAlias :: Var -> Var -> M.Map Var Var -> (Var, Var) -resolveAlias fullName localMod aliases = do - let (mod, name) = parseOutMod fullName - case mod of - Just modName -> - if modName == localMod then (fullName, fullName) - else case (M.lookup modName aliases) of - Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), fullName) - Nothing -> error $ "could not find import: " ++ (fromVar modName) ++ " in alias map: " ++ (show aliases) - Nothing -> error $ "tbh shoulding get here either -- resolving aliases, couldn't parse out module name in declaration" - resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = do @@ -195,7 +184,7 @@ resolveModInExp exp defenv funenv = -- environment interactions -buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv :: VarEnv -> Var -> (Var, Bool) -> (VarEnv, (Var, Bool)) buildEnv env k v = do let (mod, name) = parseOutMod k let mod' = case mod of @@ -203,7 +192,7 @@ buildEnv env k v = do Nothing -> (toVar "") case (M.lookup name env) of Just m -> - if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + if (M.member mod' m) then error $ "duplicate function call in module" ++ (fromVar mod') else ((M.insert name (M.insert mod' v m) env), v) Nothing -> ((M.insert name (M.singleton mod' v) env), v) @@ -224,8 +213,15 @@ resolveNameInEnv mod name e = do case (M.lookup name e) of Just modspace -> case mod of Just m -> case (M.lookup m modspace) of - Just n -> n + Just (n, _) -> n Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) ++ " in env: " ++ (show e) - Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) \ No newline at end of file + Nothing -> case (foldr findUnqualified (False, "") modspace) of + (True, n) -> n + (False, _) -> error $ "can't find unquilified reference to " ++ (fromVar name) + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) + +findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) +findUnqualified (n, q) (acc, out) = + if (not q) && (not acc) then (True, n) + else if (not q) && acc then error $ "Ambiguous reference" + else (acc, out) \ No newline at end of file From 34e66189a7f5b7f364df6b90c5ee1ee27145c9a7 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 22 Nov 2023 18:20:14 -0800 Subject: [PATCH 11/68] spec imports --- gibbon-compiler/examples/addimport.hs | 6 +- gibbon-compiler/ir.log | 3469 ++++++++++++++++- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 38 +- .../src/Gibbon/Passes/ModuleFillImports.hs | 46 +- 4 files changed, 3535 insertions(+), 24 deletions(-) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index e779665a0..7d874a369 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,6 +1,6 @@ module AddImport where - import qualified Addone as On - import qualified Addtwo as Tw + import Addtwo (sub) + import Addone import AddTree - gibbon_main = On.add (Tw.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = add (sub (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index 3652f187a..bfe86e8f7 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -4,18 +4,22 @@ desugaring module: AddImport -- imports: ["Addone","Addtwo","AddTree"] +- imports: ["Addtwo","Addone","AddTree"] -- aliases: fromList [(Var "Addone",Var "On"),(Var "Addtwo",Var "Tw"),(Var "AddTree",Var "AddTree")] +- aliases: fromList [(Var "Addtwo",Var "Addtwo"),(Var "Addone",Var "Addone"),(Var "AddTree",Var "AddTree")] + +- imports: fromList [(Var "Addtwo",(Var "Addtwo",False,Just [Var "sub"])),(Var "Addone",(Var "Addone",False,Nothing)),(Var "AddTree",(Var "AddTree",False,Nothing))] ================================================================================ -desugaring module: Addone +desugaring module: Addtwo - imports: ["AddTree"] - aliases: fromList [(Var "AddTree",Var "AddTree")] +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + ================================================================================ desugaring module: AddTree @@ -24,14 +28,3465 @@ desugaring module: AddTree - aliases: fromList [] +- imports: fromList [] + ================================================================================ -desugaring module: Addtwo +desugaring module: Addone - imports: ["AddTree"] - aliases: fromList [(Var "AddTree",Var "AddTree")] -gibbon: Ambiguous reference -CallStack (from HasCallStack): - error, called at src/Gibbon/Passes/ModuleFillImports.hs:226:35 in gibbon-0.3-inplace:Gibbon.Passes.ModuleFillImports +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(AddTree.Tree, + DDef {tyName = "AddTree.Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "AddTree.Tree" []), + (False, PackedTy "AddTree.Tree" [])])]})], + fundefs = [(Addtwo.sub, + FunDef {funName = "Addtwo.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addtwo.sub" [] [VarE "x1"], + AppE "Addtwo.sub" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.add, + FunDef {funName = "Addtwo.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addtwo.add" [] [VarE "x1"], + AppE "Addtwo.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addone.add, + FunDef {funName = "Addone.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addone.add" [] [VarE "x1"], + AppE "Addone.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (AppE "Addone.add" + [] + [AppE "Addtwo.sub" + [] + [DataConE (MetaTv $0) + "Node" + [DataConE (MetaTv $1) "Leaf" [LitE 1], + DataConE (MetaTv $2) "Leaf" [LitE 2]]]], + MetaTv $3)} + + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 2) + Node x1::$10 x2::$11 -> + (Node $9 (Addtwo_sub_5 [] x1) (Addtwo_sub_5 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 2) + Node x1::$4 x2::$5 -> + (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 1) + Node x1::$4 x2::$5 -> + (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) + +gibbon_main :: $3 +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::$8 -> + (Leaf $7 x_9 - 2) + Node x1_10::$10 x2_11::$11 -> + (Node $9 (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::$2 -> + (Leaf $1 x_13 + 2) + Node x1_14::$4 x2_15::$5 -> + (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::$2 -> + (Leaf $1 x_17 + 1) + Node x1_18::$4 x2_19::$5 -> + (Node $3 (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: $3 +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, bindLambdas +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, monomorphize +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, specLambdas +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, desugarL0 +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 - 2) + Node x1_10::() x2_11::() -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 + 1) + Node x1_18::() x2_19::() -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> + () + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, floatOutCase +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 - 2) + Node x1_10::() x2_11::() -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 + 1) + Node x1_18::() x2_19::() -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> + () + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, toL1 +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, benchMainExp +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, simplify +Removed unused functions: [Var "Addtwo_add_6"] +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 - 2) + Node x1_10_89 x2_11_90 -> + (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95 = + case t_16_95 of + Leaf x_17_96 -> + (Leaf x_17_96 + 1) + Node x1_18_97 x2_19_98 -> + (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> + () + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 - 2) + Node x1_10_89 x2_11_90 -> + (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95 = + case t_16_95 of + Leaf x_17_96 -> + (Leaf x_17_96 + 1) + Node x1_18_97 x2_19_98 -> + (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> + () + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, flatten +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + let fltPkd_137 :: Int = x_9_88 - 2 in + (Leaf fltPkd_137) + Node x1_10_89 x2_11_90 -> + let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89) in + let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90) in + (Node fltPkd_138 fltPkd_139) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95 = + case t_16_95 of + Leaf x_17_96 -> + let fltPkd_140 :: Int = x_17_96 + 1 in + (Leaf fltPkd_140) + Node x1_18_97 x2_19_98 -> + let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97) in + let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98) in + (Node fltPkd_141 fltPkd_142) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> + () + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in + let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134) in + (Addone_add_7 [] fltAppE_133) + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + let y_54_101_163 :: Int = x_53_100_162 in + (Leaf y_54_101_163) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + let y_61_108_170 :: Int = x_60_107_169 in + (Leaf y_61_108_170) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, inlineTriv +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, directL3 +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, unariser +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, L3.flatten +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, lower +Pass output: +================================================================================ +Prog {infoTable = [("AddTree_Tree_4", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], + fundefs = [FunDecl {funName = "Addtwo_sub_5", + funArgs = [(t_8_87_147, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") + (IntAlts [(0, + LetUnpackT {binds = [(x_9_88_148, + IntTy)], + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, + IntTy)], + prim = SubP, + rands = [VarTriv "x_9_88_148", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_202", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), + (1, + LetUnpackT {binds = [(x1_10_89_150, + CursorTy), + (x2_11_90_151, + CursorTy)], + ptr = "tail_201", + bod = LetCallT {async = False, + binds = [(fltPkd_138_152, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x1_10_89_150"], + bod = LetCallT {async = False, + binds = [(fltPkd_139_153, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_138_152"), + (CursorTy, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, + isPure = True}, + FunDecl {funName = "Addone_add_7", + funArgs = [(t_16_95_154, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_16_95_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_96_155, + IntTy)], + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, + IntTy)], + prim = AddP, + rands = [VarTriv "x_17_96_155", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_207", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), + (1, + LetUnpackT {binds = [(x1_18_97_157, + CursorTy), + (x2_19_98_158, + CursorTy)], + ptr = "tail_206", + bod = LetCallT {async = False, + binds = [(fltPkd_141_159, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x1_18_97_157"], + bod = LetCallT {async = False, + binds = [(fltPkd_142_160, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x2_19_98_158"], + bod = LetAllocT {lhs = "tailift_208", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_141_159"), + (CursorTy, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_52_99_161, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") + (IntAlts [(0, + LetUnpackT {binds = [(x_53_100_162, + IntTy)], + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), + (1, + LetUnpackT {binds = [(x_55_102_164, + CursorTy), + (x_56_103_165, + CursorTy)], + ptr = "tail_211", + bod = LetCallT {async = False, + binds = [(y_57_104_166, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_55_102_164"], + bod = LetCallT {async = False, + binds = [(y_58_105_167, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_57_104_166"), + (CursorTy, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_59_106_168, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") + (IntAlts [(0, + LetUnpackT {binds = [(x_60_107_169, + IntTy)], + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), + (1, + LetUnpackT {binds = [(x_62_109_171, + CursorTy), + (x_63_110_172, + CursorTy)], + ptr = "tail_216", + bod = LetCallT {async = False, + binds = [(y_64_111_173, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_62_109_171"], + bod = LetCallT {async = False, + binds = [(y_65_112_174, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_64_111_173"), + (CursorTy, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, + isPure = True}, + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_66_113_175, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") + (IntAlts [(0, + LetUnpackT {binds = [(x_67_114_176, + IntTy)], + ptr = "tail_221", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_69_115_177, + CursorTy), + (x_70_116_178, + CursorTy)], + ptr = "tail_221", + bod = LetCallT {async = False, + binds = [(y_71_117_179, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_69_115_177"], + bod = LetCallT {async = False, + binds = [(y_72_118_180, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_70_116_178"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_220")}, + isPure = True}, + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_73_119_181, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") + (IntAlts [(0, + LetUnpackT {binds = [(x_74_120_182, + IntTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_79_125_187, + CursorTy), + (x_80_126_188, + CursorTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_81_129_191, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_82_131_193, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_223")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_135_143", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_136_144", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_134_145", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_135_143"), + (CursorTy, + VarTriv "fltPkd_136_144")], + bod = LetCallT {async = False, + binds = [(fltAppE_133_146, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "fltAppE_134_145"], + bod = LetCallT {async = False, + binds = [(tmp_app_195, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "fltAppE_133_146"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_195"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Running pass, lateInlineTriv +Pass output: +================================================================================ +Prog {infoTable = [("AddTree_Tree_4", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], + fundefs = [FunDecl {funName = "Addtwo_sub_5", + funArgs = [(t_8_87_147, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") + (IntAlts [(0, + LetUnpackT {binds = [(x_9_88_148, + IntTy)], + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, + IntTy)], + prim = SubP, + rands = [VarTriv "x_9_88_148", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_202", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), + (1, + LetUnpackT {binds = [(x1_10_89_150, + CursorTy), + (x2_11_90_151, + CursorTy)], + ptr = "tail_201", + bod = LetCallT {async = False, + binds = [(fltPkd_138_152, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x1_10_89_150"], + bod = LetCallT {async = False, + binds = [(fltPkd_139_153, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_138_152"), + (CursorTy, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, + isPure = True}, + FunDecl {funName = "Addone_add_7", + funArgs = [(t_16_95_154, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_16_95_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_96_155, + IntTy)], + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, + IntTy)], + prim = AddP, + rands = [VarTriv "x_17_96_155", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_207", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), + (1, + LetUnpackT {binds = [(x1_18_97_157, + CursorTy), + (x2_19_98_158, + CursorTy)], + ptr = "tail_206", + bod = LetCallT {async = False, + binds = [(fltPkd_141_159, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x1_18_97_157"], + bod = LetCallT {async = False, + binds = [(fltPkd_142_160, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x2_19_98_158"], + bod = LetAllocT {lhs = "tailift_208", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_141_159"), + (CursorTy, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_52_99_161, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") + (IntAlts [(0, + LetUnpackT {binds = [(x_53_100_162, + IntTy)], + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), + (1, + LetUnpackT {binds = [(x_55_102_164, + CursorTy), + (x_56_103_165, + CursorTy)], + ptr = "tail_211", + bod = LetCallT {async = False, + binds = [(y_57_104_166, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_55_102_164"], + bod = LetCallT {async = False, + binds = [(y_58_105_167, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_57_104_166"), + (CursorTy, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_59_106_168, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") + (IntAlts [(0, + LetUnpackT {binds = [(x_60_107_169, + IntTy)], + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), + (1, + LetUnpackT {binds = [(x_62_109_171, + CursorTy), + (x_63_110_172, + CursorTy)], + ptr = "tail_216", + bod = LetCallT {async = False, + binds = [(y_64_111_173, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_62_109_171"], + bod = LetCallT {async = False, + binds = [(y_65_112_174, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_64_111_173"), + (CursorTy, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, + isPure = True}, + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_66_113_175, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") + (IntAlts [(0, + LetUnpackT {binds = [(x_67_114_176, + IntTy)], + ptr = "tail_221", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_69_115_177, + CursorTy), + (x_70_116_178, + CursorTy)], + ptr = "tail_221", + bod = LetCallT {async = False, + binds = [(y_71_117_179, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_69_115_177"], + bod = LetCallT {async = False, + binds = [(y_72_118_180, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_70_116_178"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_220")}, + isPure = True}, + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_73_119_181, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") + (IntAlts [(0, + LetUnpackT {binds = [(x_74_120_182, + IntTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_79_125_187, + CursorTy), + (x_80_126_188, + CursorTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_81_129_191, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_82_131_193, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_223")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_135_143", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_136_144", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_134_145", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_135_143"), + (CursorTy, + VarTriv "fltPkd_136_144")], + bod = LetCallT {async = False, + binds = [(fltAppE_133_146, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "fltAppE_134_145"], + bod = LetCallT {async = False, + binds = [(tmp_app_195, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "fltAppE_133_146"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_195"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Running pass, rearrangeFree +Pass output: +================================================================================ +Prog {infoTable = [("AddTree_Tree_4", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], + fundefs = [FunDecl {funName = "Addtwo_sub_5", + funArgs = [(t_8_87_147, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") + (IntAlts [(0, + LetUnpackT {binds = [(x_9_88_148, + IntTy)], + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, + IntTy)], + prim = SubP, + rands = [VarTriv "x_9_88_148", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_202", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), + (1, + LetUnpackT {binds = [(x1_10_89_150, + CursorTy), + (x2_11_90_151, + CursorTy)], + ptr = "tail_201", + bod = LetCallT {async = False, + binds = [(fltPkd_138_152, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x1_10_89_150"], + bod = LetCallT {async = False, + binds = [(fltPkd_139_153, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_138_152"), + (CursorTy, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, + isPure = True}, + FunDecl {funName = "Addone_add_7", + funArgs = [(t_16_95_154, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_16_95_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_96_155, + IntTy)], + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, + IntTy)], + prim = AddP, + rands = [VarTriv "x_17_96_155", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_207", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), + (1, + LetUnpackT {binds = [(x1_18_97_157, + CursorTy), + (x2_19_98_158, + CursorTy)], + ptr = "tail_206", + bod = LetCallT {async = False, + binds = [(fltPkd_141_159, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x1_18_97_157"], + bod = LetCallT {async = False, + binds = [(fltPkd_142_160, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x2_19_98_158"], + bod = LetAllocT {lhs = "tailift_208", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_141_159"), + (CursorTy, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_52_99_161, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") + (IntAlts [(0, + LetUnpackT {binds = [(x_53_100_162, + IntTy)], + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), + (1, + LetUnpackT {binds = [(x_55_102_164, + CursorTy), + (x_56_103_165, + CursorTy)], + ptr = "tail_211", + bod = LetCallT {async = False, + binds = [(y_57_104_166, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_55_102_164"], + bod = LetCallT {async = False, + binds = [(y_58_105_167, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_57_104_166"), + (CursorTy, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_59_106_168, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") + (IntAlts [(0, + LetUnpackT {binds = [(x_60_107_169, + IntTy)], + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), + (1, + LetUnpackT {binds = [(x_62_109_171, + CursorTy), + (x_63_110_172, + CursorTy)], + ptr = "tail_216", + bod = LetCallT {async = False, + binds = [(y_64_111_173, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_62_109_171"], + bod = LetCallT {async = False, + binds = [(y_65_112_174, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_64_111_173"), + (CursorTy, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, + isPure = True}, + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_66_113_175, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") + (IntAlts [(0, + LetUnpackT {binds = [(x_67_114_176, + IntTy)], + ptr = "tail_221", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_69_115_177, + CursorTy), + (x_70_116_178, + CursorTy)], + ptr = "tail_221", + bod = LetCallT {async = False, + binds = [(y_71_117_179, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_69_115_177"], + bod = LetCallT {async = False, + binds = [(y_72_118_180, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_70_116_178"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_220")}, + isPure = True}, + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_73_119_181, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") + (IntAlts [(0, + LetUnpackT {binds = [(x_74_120_182, + IntTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_79_125_187, + CursorTy), + (x_80_126_188, + CursorTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_81_129_191, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_82_131_193, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_223")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_135_143", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_136_144", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_134_145", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_135_143"), + (CursorTy, + VarTriv "fltPkd_136_144")], + bod = LetCallT {async = False, + binds = [(fltAppE_133_146, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "fltAppE_134_145"], + bod = LetCallT {async = False, + binds = [(tmp_app_195, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "fltAppE_133_146"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_195"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Final C codegen: 13391 characters. +================================================================================ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +typedef struct GibIntGibIntProd_struct { + GibInt field0; + GibInt field1; + } GibIntGibIntProd; +typedef struct GibIntGibCursorGibCursorProd_struct { + GibInt field0; + GibCursor field1; + GibCursor field2; + } GibIntGibCursorGibCursorProd; +typedef struct GibPackedTagGibCursorProd_struct { + GibPackedTag field0; + GibCursor field1; + } GibPackedTagGibCursorProd; +typedef struct GibCursorProd_struct { + GibCursor field0; + } GibCursorProd; +typedef struct GibCursorGibCursorProd_struct { + GibCursor field0; + GibCursor field1; + } GibCursorGibCursorProd; +GibCursor Addtwo_sub_5(GibCursor t_8_87_147); +GibCursor Addone_add_7(GibCursor t_16_95_154); +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + AddTree_Tree_4_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(8); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[1]; + + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, AddTree_Tree_4_T, 0); + exit(1); + } + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, AddTree_Tree_4_T, 1); + exit(1); + } + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ + gib_add_symbol(196, ")"); + gib_add_symbol(197, "(Node"); + gib_add_symbol(198, "(Leaf"); + gib_add_symbol(199, " "); +} +GibCursor Addtwo_sub_5(GibCursor t_8_87_147) +{ + GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; + GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); + + + switch_204: + ; + switch (tag_200) { + + case 0: + { + GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; + GibInt fltPkd_137_149 = x_9_88_148 - 2; + GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_202)->field0 = 0; + ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; + return tailift_202; + break; + } + + case 1: + { + GibCursor x1_10_89_150 = + ((GibCursorGibCursorProd *) tail_201)->field0; + GibCursor x2_11_90_151 = + ((GibCursorGibCursorProd *) tail_201)->field1; + GibCursor fltPkd_138_152 = Addtwo_sub_5(x1_10_89_150); + GibCursor fltPkd_139_153 = Addtwo_sub_5(x2_11_90_151); + GibPtr tailift_203 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = + fltPkd_138_152; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = + fltPkd_139_153; + return tailift_203; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_200"); + exit(1); + } + } +} +GibCursor Addone_add_7(GibCursor t_16_95_154) +{ + GibPackedTag tag_205 = *(GibPackedTag *) t_16_95_154; + GibCursor tail_206 = t_16_95_154 + sizeof(GibInt); + + + switch_209: + ; + switch (tag_205) { + + case 0: + { + GibInt x_17_96_155 = ((GibIntProd *) tail_206)->field0; + GibInt fltPkd_140_156 = x_17_96_155 + 1; + GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_207)->field0 = 0; + ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; + return tailift_207; + break; + } + + case 1: + { + GibCursor x1_18_97_157 = + ((GibCursorGibCursorProd *) tail_206)->field0; + GibCursor x2_19_98_158 = + ((GibCursorGibCursorProd *) tail_206)->field1; + GibCursor fltPkd_141_159 = Addone_add_7(x1_18_97_157); + GibCursor fltPkd_142_160 = Addone_add_7(x2_19_98_158); + GibPtr tailift_208 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = + fltPkd_141_159; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = + fltPkd_142_160; + return tailift_208; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_205"); + exit(1); + } + } +} +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) +{ + GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; + GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); + + + switch_214: + ; + switch (tag_210) { + + case 0: + { + GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; + GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_212)->field0 = 0; + ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; + return tailift_212; + break; + } + + case 1: + { + GibCursor x_55_102_164 = + ((GibCursorGibCursorProd *) tail_211)->field0; + GibCursor x_56_103_165 = + ((GibCursorGibCursorProd *) tail_211)->field1; + GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); + GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); + GibPtr tailift_213 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = + y_57_104_166; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = + y_58_105_167; + return tailift_213; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_210"); + exit(1); + } + } +} +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) +{ + GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; + GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); + + + switch_219: + ; + switch (tag_215) { + + case 0: + { + GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; + GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_217)->field0 = 0; + ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; + return tailift_217; + break; + } + + case 1: + { + GibCursor x_62_109_171 = + ((GibCursorGibCursorProd *) tail_216)->field0; + GibCursor x_63_110_172 = + ((GibCursorGibCursorProd *) tail_216)->field1; + GibCursor y_64_111_173 = + _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); + GibCursor y_65_112_174 = + _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); + GibPtr tailift_218 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = + y_64_111_173; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = + y_65_112_174; + return tailift_218; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_215"); + exit(1); + } + } +} +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) +{ + GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; + GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); + + + switch_222: + ; + switch (tag_220) { + + case 0: + { + GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; + + return 0; + break; + } + + case 1: + { + GibCursor x_69_115_177 = + ((GibCursorGibCursorProd *) tail_221)->field0; + GibCursor x_70_116_178 = + ((GibCursorGibCursorProd *) tail_221)->field1; + unsigned char y_71_117_179 = + _traverse_AddTree_Tree_4(x_69_115_177); + unsigned char y_72_118_180 = + _traverse_AddTree_Tree_4(x_70_116_178); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_220"); + exit(1); + } + } +} +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) +{ + GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; + GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); + + + switch_225: + ; + switch (tag_223) { + + case 0: + { + GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; + unsigned char wildcard_76_121_183 = gib_print_symbol(198); + unsigned char wildcard_78_122_184 = gib_print_symbol(199); + unsigned char y_75_123_185 = printf("%ld", x_74_120_182); + unsigned char wildcard_77_124_186 = gib_print_symbol(196); + + return 0; + break; + } + + case 1: + { + GibCursor x_79_125_187 = + ((GibCursorGibCursorProd *) tail_224)->field0; + GibCursor x_80_126_188 = + ((GibCursorGibCursorProd *) tail_224)->field1; + unsigned char wildcard_83_127_189 = gib_print_symbol(197); + unsigned char wildcard_86_128_190 = gib_print_symbol(199); + unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); + unsigned char wildcard_85_130_192 = gib_print_symbol(199); + unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); + unsigned char wildcard_84_132_194 = gib_print_symbol(196); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_223"); + exit(1); + } + } +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; + + GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; + + GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; + + GibCursor fltAppE_133_146 = Addtwo_sub_5(fltAppE_134_145); + GibCursor tmp_app_195 = Addone_add_7(fltAppE_133_146); + + _print_AddTree_Tree_4(tmp_app_195); + printf("\n"); + return 0; + + int exit_1 = gib_exit(); + + return exit_1; +} + +Compiling RTS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +make: Nothing to be done for 'all'. + + + + +Compiling the program +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng + + + +In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] + #warning "Simple write barrier is disabled." + ^~~~~~~ + + +(Node (Leaf 0) (Leaf 1)) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 356e93a21..213d566e9 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -183,6 +183,35 @@ type TypeSynEnv = M.Map TyCon Ty0 -- ======================================================== +getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool, Maybe [Var]) +getImportMeta imports = do + let parseSpecs :: Maybe (H.ImportSpecList a)-> Maybe [Var] + parseSpecs maybeSpec = do + case maybeSpec of + Just (H.ImportSpecList _ _ specList) -> + Just $ map (\spec -> case spec of + H.IVar _ n -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + H.IAbs _ _ n -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + H.IThingAll _ n -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + H.IThingWith _ n _ -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + ) specList + Nothing -> Nothing + M.fromList $ map + (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased spec) -> + case aliased of + Just (H.ModuleName _ importAs) -> + ((toVar importName), ((toVar importAs), qualified, (parseSpecs spec))) + Nothing -> ((toVar importName), ((toVar importName), qualified, (parseSpecs spec))) + ) + imports -- ======================================================== @@ -204,6 +233,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports dbgPrintLn 2 $ "desugaring module: " ++ mod_name dbgPrintLn 2 $ "- imports: " ++ (show import_names) dbgPrintLn 2 $ "- aliases: " ++ (show aliases) + dbgPrintLn 2 $ "- imports: " ++ (show (getImportMeta imports)) imported_progs :: [PassM Prog0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports let prog = do @@ -439,10 +469,10 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} --when (isJust importAs) $ -- error $ -- "Module aliases not supported yet. Offending import: " ++ prettyPrint decl - when (isJust importSpecs) $ - error $ - "Selective imports not supported yet. Offending import: " ++ - prettyPrint decl + --when (isJust importSpecs) $ + -- error $ + -- "Selective imports not supported yet. Offending import: " ++ + -- prettyPrint decl (ParseState imported) <- readIORef pstate_ref mod_fp <- if mod_name `elem` stdlibModules diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 12b58ae9a..f01e22c71 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -29,17 +29,23 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- resolve aliases in imported functions let importMeta = getImportMeta imports let initImportedNames :: [(Var, (Var, Bool))] = [] - let applyImportMeta :: Var -> M.Map Var (Var, Bool) -> (Var, (Var, Bool)) - applyImportMeta v importMap = do + let applyImportMeta :: Var -> [(Var, (Var, Bool))] -> [(Var, (Var, Bool))] + applyImportMeta v acc = do let (mod, name) = parseOutMod v case mod of Just modName -> - case (M.lookup modName importMap) of - Just (alias, qual) -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual)) + case (M.lookup modName importMeta) of + Just (alias, qual, specs) -> + case specs of + Just spec -> if (elem name spec) then acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] + else acc + Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] Nothing -> error $ "could not find module or alias: " ++ (show modName) Nothing -> error "how did we get here?" - let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs - let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs + let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (M.keys idefs))) initImportedNames imported_progs + let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (foldr applyImportMeta [] (M.keys ifuns))) initImportedNames imported_progs + --let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs + --let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs -- build def env let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (map (\v -> (v, False)) (M.keys defs))) @@ -75,13 +81,33 @@ fillImports (Prog defs funs main) localMod imports imported_progs = return $ Prog defs'' funs'' main' -getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool) +getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool, Maybe [Var]) getImportMeta imports = do + let parseSpecs :: Maybe (H.ImportSpecList a)-> Maybe [Var] + parseSpecs maybeSpec = do + case maybeSpec of + Just (H.ImportSpecList _ _ specList) -> + Just $ map (\spec -> case spec of + H.IVar _ n -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + H.IAbs _ _ n -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + H.IThingAll _ n -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + H.IThingWith _ n _ -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + ) specList + Nothing -> Nothing M.fromList $ map - (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased _) -> + (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased spec) -> case aliased of - Just (H.ModuleName _ importAs) -> ((toVar importName), ((toVar importAs), qualified)) - Nothing -> ((toVar importName), ((toVar importName), qualified)) + Just (H.ModuleName _ importAs) -> + ((toVar importName), ((toVar importAs), qualified, (parseSpecs spec))) + Nothing -> ((toVar importName), ((toVar importName), qualified, (parseSpecs spec))) ) imports From c8bb2d1b6e8cdd58c664ee29d418d4d6e5ed7fb4 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 29 Nov 2023 18:13:06 -0800 Subject: [PATCH 12/68] finished test cases --- gibbon-compiler/examples/AddTree.hs | 2 - gibbon-compiler/examples/Addone.hs | 10 - gibbon-compiler/examples/addimport.hs | 6 - gibbon-compiler/examples/imports/AddTree.hs | 8 + gibbon-compiler/examples/imports/Addone.hs | 15 + .../examples/{ => imports}/Addtwo.hs | 4 +- .../imports/AllThreeImportModifications.hs | 6 + .../examples/imports/ImportAliased.hs | 6 + .../examples/imports/ImportQualified.hs | 6 + .../imports/ImportQualifiedAndSpecified.hs | 6 + .../examples/imports/ImportSpecified.hs | 6 + .../examples/imports/import_tests.md | 9 + gibbon-compiler/examples/imports/ir.log | 282 ++ .../imports/{ => no-modifiers}/Bar.hs | 0 .../imports/{ => no-modifiers}/Baz.hs | 0 .../imports/{ => no-modifiers}/Foo.ans | 0 .../imports/{ => no-modifiers}/Foo.hs | 0 gibbon-compiler/gibbon.cabal | 1 + gibbon-compiler/ir.log | 4408 ++++++----------- gibbon-compiler/src/Gibbon/Compiler.hs | 4 +- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 2 +- .../src/Gibbon/Passes/FreshConstructors.hs | 131 + .../src/Gibbon/Passes/ModuleFillImports.hs | 99 +- .../src/Gibbon/Passes/ModuleRename.hs | 43 +- 24 files changed, 2177 insertions(+), 2877 deletions(-) delete mode 100644 gibbon-compiler/examples/AddTree.hs delete mode 100644 gibbon-compiler/examples/Addone.hs delete mode 100644 gibbon-compiler/examples/addimport.hs create mode 100644 gibbon-compiler/examples/imports/AddTree.hs create mode 100644 gibbon-compiler/examples/imports/Addone.hs rename gibbon-compiler/examples/{ => imports}/Addtwo.hs (81%) create mode 100644 gibbon-compiler/examples/imports/AllThreeImportModifications.hs create mode 100644 gibbon-compiler/examples/imports/ImportAliased.hs create mode 100644 gibbon-compiler/examples/imports/ImportQualified.hs create mode 100644 gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs create mode 100644 gibbon-compiler/examples/imports/ImportSpecified.hs create mode 100644 gibbon-compiler/examples/imports/import_tests.md create mode 100644 gibbon-compiler/examples/imports/ir.log rename gibbon-compiler/examples/imports/{ => no-modifiers}/Bar.hs (100%) rename gibbon-compiler/examples/imports/{ => no-modifiers}/Baz.hs (100%) rename gibbon-compiler/examples/imports/{ => no-modifiers}/Foo.ans (100%) rename gibbon-compiler/examples/imports/{ => no-modifiers}/Foo.hs (100%) create mode 100644 gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs diff --git a/gibbon-compiler/examples/AddTree.hs b/gibbon-compiler/examples/AddTree.hs deleted file mode 100644 index 1ac4ba955..000000000 --- a/gibbon-compiler/examples/AddTree.hs +++ /dev/null @@ -1,2 +0,0 @@ -module AddTree where - data Tree = Leaf Int | Node Tree Tree \ No newline at end of file diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs deleted file mode 100644 index a32a620e5..000000000 --- a/gibbon-compiler/examples/Addone.hs +++ /dev/null @@ -1,10 +0,0 @@ -module Addone where - import AddTree - - add :: Tree -> Tree - add t = case t of - Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add x1) (add x2) - - main :: Tree - main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs deleted file mode 100644 index 7d874a369..000000000 --- a/gibbon-compiler/examples/addimport.hs +++ /dev/null @@ -1,6 +0,0 @@ -module AddImport where - import Addtwo (sub) - import Addone - import AddTree - - gibbon_main = add (sub (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/AddTree.hs b/gibbon-compiler/examples/imports/AddTree.hs new file mode 100644 index 000000000..4da208e66 --- /dev/null +++ b/gibbon-compiler/examples/imports/AddTree.hs @@ -0,0 +1,8 @@ +module AddTree where + data Tree = Leaf Int | Node Tree Tree + + sum :: Tree -> Int + sum t = + case t of + Leaf v -> v + Node l r -> (sum l) + (sum r) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/Addone.hs b/gibbon-compiler/examples/imports/Addone.hs new file mode 100644 index 000000000..c073e31d9 --- /dev/null +++ b/gibbon-compiler/examples/imports/Addone.hs @@ -0,0 +1,15 @@ +module Addone where + import AddTree + + add :: Tree -> Tree + add t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add x1) (add x2) + + sub :: Tree -> Tree + sub t = case t of + Leaf x -> Leaf (x - 1) + Node x1 x2 -> Node (sub x1) (sub x2) + + gibbon_main :: Tree + gibbon_main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/imports/Addtwo.hs similarity index 81% rename from gibbon-compiler/examples/Addtwo.hs rename to gibbon-compiler/examples/imports/Addtwo.hs index 9056b48e1..9b022b537 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/imports/Addtwo.hs @@ -11,5 +11,5 @@ module Addtwo where Leaf x -> Leaf (x - 2) Node x1 x2 -> Node (sub x1) (sub x2) - main :: Tree - main = add (Node (Leaf 1) (Leaf 2)) + gibbon_main :: Tree + gibbon_main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs new file mode 100644 index 000000000..37764a7f3 --- /dev/null +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs @@ -0,0 +1,6 @@ +module AllThreeImportModifications where + import qualified Addtwo as T (add) + import qualified Addone as O (add) + import AddTree as Tree (Node, Lead) + + gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportAliased.hs b/gibbon-compiler/examples/imports/ImportAliased.hs new file mode 100644 index 000000000..e976a39b8 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportAliased.hs @@ -0,0 +1,6 @@ +module ImportAliased where + import qualified Addtwo as T + import qualified Addone as O + import AddTree as Tree + + gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualified.hs b/gibbon-compiler/examples/imports/ImportQualified.hs new file mode 100644 index 000000000..7b1e36334 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualified.hs @@ -0,0 +1,6 @@ +module ImportQualified where + import qualified Addtwo + import qualified Addone + import AddTree + + gibbon_main = sum (Addtwo.add (Addone.add (Node (Leaf 1) (Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs new file mode 100644 index 000000000..61755a076 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs @@ -0,0 +1,6 @@ +module ImportQualifiedAndSpecified where + import qualified Addtwo (add) + import qualified Addone (sub) + import AddTree + + gibbon_main = sum (Addtwo.add (Addone.sub (Node (Leaf 1) (Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportSpecified.hs b/gibbon-compiler/examples/imports/ImportSpecified.hs new file mode 100644 index 000000000..735426c15 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportSpecified.hs @@ -0,0 +1,6 @@ +module ImportSpecified where + import Addtwo (add) + import Addone (sub) + import AddTree + + gibbon_main = sum (add (sub (Node (Leaf 1) (Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/import_tests.md b/gibbon-compiler/examples/imports/import_tests.md new file mode 100644 index 000000000..c1e3ea8bd --- /dev/null +++ b/gibbon-compiler/examples/imports/import_tests.md @@ -0,0 +1,9 @@ +# Import Features +- no modifiers +- qualified +- specified +- aliased +- qualified & specified +- qualified & aliased +- specified & aliased +- qualified & specified & aliased \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ir.log b/gibbon-compiler/examples/imports/ir.log new file mode 100644 index 000000000..db7db6b2e --- /dev/null +++ b/gibbon-compiler/examples/imports/ir.log @@ -0,0 +1,282 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 +================================================================================ + +desugaring module: ImportAliased + +- imports: ["Addtwo","Addone","AddTree"] + +- aliases: fromList [(Var "Addtwo",Var "T"),(Var "Addone",Var "O"),(Var "AddTree",Var "Tree")] + +- imports: fromList [(Var "Addtwo",(Var "T",True,Nothing)),(Var "Addone",(Var "O",True,Nothing)),(Var "AddTree",(Var "Tree",False,Nothing))] + +================================================================================ + +desugaring module: Addtwo + +- imports: ["AddTree"] + +- aliases: fromList [(Var "AddTree",Var "AddTree")] + +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + +================================================================================ + +desugaring module: AddTree + +- imports: [] + +- aliases: fromList [] + +- imports: fromList [] + +================================================================================ + +desugaring module: Addone + +- imports: ["AddTree"] + +- aliases: fromList [(Var "AddTree",Var "AddTree")] + +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(AddTree.Tree, + DDef {tyName = "AddTree.Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "AddTree.Tree" []), + (False, PackedTy "AddTree.Tree" [])])]})], + fundefs = [(Addtwo.add, + FunDef {funName = "Addtwo.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addtwo.add" [] [VarE "x1"], + AppE "Addtwo.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.sub, + FunDef {funName = "Addtwo.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addtwo.sub" [] [VarE "x1"], + AppE "Addtwo.sub" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addone.add, + FunDef {funName = "Addone.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addone.add" [] [VarE "x1"], + AppE "Addone.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addone.sub, + FunDef {funName = "Addone.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addone.sub" [] [VarE "x1"], + AppE "Addone.sub" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (AddTree.sum, + FunDef {funName = "AddTree.sum", + funArgs = [t], + funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), + funBody = CaseE (VarE "t") + [("Leaf", [(v, MetaTv $1)], VarE "v"), + ("Node", + [(l, MetaTv $2),(r, MetaTv $3)], + PrimAppE AddP + [AppE "sum" [] [VarE "l"], + AppE "sum" [] [VarE "r"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (AppE "AddTree.sum" + [] + [AppE "Addtwo.add" + [] + [AppE "Addone.add" + [] + [DataConE (MetaTv $0) + "Tree.Node" + [DataConE (MetaTv $1) "Tree.Leaf" [LitE 1], + DataConE (MetaTv $2) "Tree.Leaf" [LitE 2]]]]], + MetaTv $3)} + + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_5 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 2) + Node x1::$4 x2::$5 -> + (Node $3 (Addtwo_add_5 [] x1) (Addtwo_add_5 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_6 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 2) + Node x1::$10 x2::$11 -> + (Node $9 (Addtwo_sub_6 [] x1) (Addtwo_sub_6 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 1) + Node x1::$4 x2::$5 -> + (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_sub_8 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 1) + Node x1::$10 x2::$11 -> + (Node $9 (Addone_sub_8 [] x1) (Addone_sub_8 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) +AddTree_sum_9 t = + case t of + Leaf v::$1 -> + v + Node l::$2 r::$3 -> + (sum [] l) + (sum [] r) + +gibbon_main :: $3 +gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_5 t_10 = + case t_10 of + Leaf x_11::$2 -> + (Leaf $1 x_11 + 2) + Node x1_12::$4 x2_13::$5 -> + (Node $3 (Addtwo_add_5 [] x1_12) (Addtwo_add_5 [] x2_13)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_6 t_14 = + case t_14 of + Leaf x_15::$8 -> + (Leaf $7 x_15 - 2) + Node x1_16::$10 x2_17::$11 -> + (Node $9 (Addtwo_sub_6 [] x1_16) (Addtwo_sub_6 [] x2_17)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_18 = + case t_18 of + Leaf x_19::$2 -> + (Leaf $1 x_19 + 1) + Node x1_20::$4 x2_21::$5 -> + (Node $3 (Addone_add_7 [] x1_20) (Addone_add_7 [] x2_21)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_sub_8 t_22 = + case t_22 of + Leaf x_23::$8 -> + (Leaf $7 x_23 - 1) + Node x1_24::$10 x2_25::$11 -> + (Node $9 (Addone_sub_8 [] x1_24) (Addone_sub_8 [] x2_25)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) +AddTree_sum_9 t_26 = + case t_26 of + Leaf v_27::$1 -> + v_27 + Node l_28::$2 r_29::$3 -> + (sum [] l_28) + (sum [] r_29) + +gibbon_main :: $3 +gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) + + [compiler] Running pass, typecheck +gibbon: L0.Typecheck: + Unknown function: sum in Var "AddTree_sum_9" +CallStack (from HasCallStack): + error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/examples/imports/Bar.hs b/gibbon-compiler/examples/imports/no-modifiers/Bar.hs similarity index 100% rename from gibbon-compiler/examples/imports/Bar.hs rename to gibbon-compiler/examples/imports/no-modifiers/Bar.hs diff --git a/gibbon-compiler/examples/imports/Baz.hs b/gibbon-compiler/examples/imports/no-modifiers/Baz.hs similarity index 100% rename from gibbon-compiler/examples/imports/Baz.hs rename to gibbon-compiler/examples/imports/no-modifiers/Baz.hs diff --git a/gibbon-compiler/examples/imports/Foo.ans b/gibbon-compiler/examples/imports/no-modifiers/Foo.ans similarity index 100% rename from gibbon-compiler/examples/imports/Foo.ans rename to gibbon-compiler/examples/imports/no-modifiers/Foo.ans diff --git a/gibbon-compiler/examples/imports/Foo.hs b/gibbon-compiler/examples/imports/no-modifiers/Foo.hs similarity index 100% rename from gibbon-compiler/examples/imports/Foo.hs rename to gibbon-compiler/examples/imports/no-modifiers/Foo.hs diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index c3dfa7a1b..e2f240354 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -60,6 +60,7 @@ library Gibbon.NewL2.FromOldL2 -- compiler passes, roughly in the order they're run + Gibbon.Passes.FreshConstructors Gibbon.Passes.ModuleRename Gibbon.Passes.ModuleFillImports Gibbon.Passes.Freshen diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index bfe86e8f7..d7325d4eb 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -2,26 +2,6 @@ ! We set DEBUG based on command-line verbose arg: 4 ================================================================================ -desugaring module: AddImport - -- imports: ["Addtwo","Addone","AddTree"] - -- aliases: fromList [(Var "Addtwo",Var "Addtwo"),(Var "Addone",Var "Addone"),(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "Addtwo",(Var "Addtwo",False,Just [Var "sub"])),(Var "Addone",(Var "Addone",False,Nothing)),(Var "AddTree",(Var "AddTree",False,Nothing))] - -================================================================================ - -desugaring module: Addtwo - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - -================================================================================ - desugaring module: AddTree - imports: [] @@ -30,3007 +10,1947 @@ desugaring module: AddTree - imports: fromList [] -================================================================================ - -desugaring module: Addone - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - [compiler] pipeline starting, parsed program: ================================================================================ Prog {ddefs = [(AddTree.Tree, DDef {tyName = "AddTree.Tree", tyArgs = [], - dataCons = [("Leaf", [(False, IntTy)]), - ("Node", + dataCons = [("AddTree.Leaf", [(False, IntTy)]), + ("AddTree.Node", [(False, PackedTy "AddTree.Tree" []), (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(Addtwo.sub, - FunDef {funName = "Addtwo.sub", + fundefs = [(AddTree.sum, + FunDef {funName = "AddTree.sum", funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), + funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addtwo.sub" [] [VarE "x1"], - AppE "Addtwo.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.add, - FunDef {funName = "Addtwo.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addtwo.add" [] [VarE "x1"], - AppE "Addtwo.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addone.add, - FunDef {funName = "Addone.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addone.add" [] [VarE "x1"], - AppE "Addone.add" [] [VarE "x2"]])], + [("AddTree.Leaf", [(v, MetaTv $1)], VarE "v"), + ("AddTree.Node", + [(l, MetaTv $2),(r, MetaTv $3)], + PrimAppE AddP + [AppE "AddTree.sum" [] [VarE "l"], + AppE "AddTree.sum" [] [VarE "r"]])], funMeta = FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Addone.add" - [] - [AppE "Addtwo.sub" - [] - [DataConE (MetaTv $0) - "Node" - [DataConE (MetaTv $1) "Leaf" [LitE 1], - DataConE (MetaTv $2) "Leaf" [LitE 2]]]], - MetaTv $3)} + mainExp = Nothing} - [compiler] Running pass, renameModules + [compiler] Running pass, freshConstructors Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree.Tree = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree.Tree []) (Packed AddTree.Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t = +AddTree.sum :: forall. ((Packed AddTree.Tree []) -> Int) +AddTree.sum t = case t of - Leaf x::$8 -> - (Leaf $7 x - 2) - Node x1::$10 x2::$11 -> - (Node $9 (Addtwo_sub_5 [] x1) (Addtwo_sub_5 [] x2)) + AddTree_Leaf_4 v::$1 -> + v + AddTree_Node_5 l::$2 r::$3 -> + (AddTree.sum [] l) + (AddTree.sum [] r) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 2) - Node x1::$4 x2::$5 -> - (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t = case t of - Leaf x::$2 -> - (Leaf $1 x + 1) - Node x1::$4 x2::$5 -> - (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) + AddTree_Leaf_4 v::$1 -> + v + AddTree_Node_5 l::$2 r::$3 -> + (AddTree_sum_7 [] l) + (AddTree_sum_7 [] r) -gibbon_main :: $3 -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, freshen Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::$8 -> - (Leaf $7 x_9 - 2) - Node x1_10::$10 x2_11::$11 -> - (Node $9 (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::$2 -> - (Leaf $1 x_13 + 2) - Node x1_14::$4 x2_15::$5 -> - (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::$2 -> - (Leaf $1 x_17 + 1) - Node x1_18::$4 x2_19::$5 -> - (Node $3 (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + AddTree_Leaf_4 v_9::$1 -> + v_9 + AddTree_Node_5 l_10::$2 r_11::$3 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -gibbon_main :: $3 -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, bindLambdas Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, monomorphize Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, specLambdas Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, desugarL0 Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::() -> - (Leaf () x_9 - 2) - Node x1_10::() x2_11::() -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9::() -> + v_9 + AddTree_Node_5 l_10::() r_11::() -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21::() -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 () y_22) + AddTree_Node_5 x_23::() x_24::() -> + let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 () y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28::() -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 () y_29) + AddTree_Node_5 x_30::() x_31::() -> + let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 () y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35::() -> + () + AddTree_Node_5 x_37::() x_38::() -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42::() -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47::() x_48::() -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 + 1) - Node x1_18::() x2_19::() -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, floatOutCase Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::() -> - (Leaf () x_9 - 2) - Node x1_10::() x2_11::() -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + AddTree_Leaf_4 v_9::() -> + v_9 + AddTree_Node_5 l_10::() r_11::() -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21::() -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 () y_22) + AddTree_Node_5 x_23::() x_24::() -> + let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 () y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28::() -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 () y_29) + AddTree_Node_5 x_30::() x_31::() -> + let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 () y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35::() -> + () + AddTree_Node_5 x_37::() x_38::() -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42::() -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47::() x_48::() -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 + 1) - Node x1_18::() x2_19::() -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, toL1 Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, benchMainExp Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, simplify -Removed unused functions: [Var "Addtwo_add_6"] +Removed unused functions: [Var "AddTree_sum_7"] Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 - 2) - Node x1_10_89 x2_11_90 -> - (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95 = - case t_16_95 of - Leaf x_17_96 -> - (Leaf x_17_96 + 1) - Node x1_18_97 x2_19_98 -> - (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59 = + case arg_20_59 of + AddTree_Leaf_4 x_21_60 -> + let y_22_61 :: Int = x_21_60 in + (AddTree_Leaf_4 y_22_61) + AddTree_Node_5 x_23_62 x_24_63 -> + let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in + let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in + (AddTree_Node_5 y_25_64 y_26_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = + case arg_27_66 of + AddTree_Leaf_4 x_28_67 -> + let y_29_68 :: Int = x_28_67 in + (AddTree_Leaf_4 y_29_68) + AddTree_Node_5 x_30_69 x_31_70 -> + let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in + let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in + (AddTree_Node_5 y_32_71 y_33_72) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73 = + case arg_34_73 of + AddTree_Leaf_4 x_35_74 -> + () + AddTree_Node_5 x_37_75 x_38_76 -> + let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in + let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79 = + case arg_41_79 of + AddTree_Leaf_4 x_42_80 -> + let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82 :: () = printsym(" ") in + let y_43_83 :: () = printint(x_42_80) in + let wildcard_45_84 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85 x_48_86 -> + let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88 :: () = printsym(" ") in + let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in + let wildcard_53_90 :: () = printsym(" ") in + let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in + let wildcard_52_92 :: () = printsym(")") in + () + [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 - 2) - Node x1_10_89 x2_11_90 -> - (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95 = - case t_16_95 of - Leaf x_17_96 -> - (Leaf x_17_96 + 1) - Node x1_18_97 x2_19_98 -> - (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59 = + case arg_20_59 of + AddTree_Leaf_4 x_21_60 -> + let y_22_61 :: Int = x_21_60 in + (AddTree_Leaf_4 y_22_61) + AddTree_Node_5 x_23_62 x_24_63 -> + let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in + let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in + (AddTree_Node_5 y_25_64 y_26_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = + case arg_27_66 of + AddTree_Leaf_4 x_28_67 -> + let y_29_68 :: Int = x_28_67 in + (AddTree_Leaf_4 y_29_68) + AddTree_Node_5 x_30_69 x_31_70 -> + let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in + let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in + (AddTree_Node_5 y_32_71 y_33_72) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73 = + case arg_34_73 of + AddTree_Leaf_4 x_35_74 -> + () + AddTree_Node_5 x_37_75 x_38_76 -> + let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in + let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79 = + case arg_41_79 of + AddTree_Leaf_4 x_42_80 -> + let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82 :: () = printsym(" ") in + let y_43_83 :: () = printint(x_42_80) in + let wildcard_45_84 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85 x_48_86 -> + let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88 :: () = printsym(" ") in + let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in + let wildcard_53_90 :: () = printsym(" ") in + let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in + let wildcard_52_92 :: () = printsym(")") in + () + [compiler] Running pass, flatten Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - let fltPkd_137 :: Int = x_9_88 - 2 in - (Leaf fltPkd_137) - Node x1_10_89 x2_11_90 -> - let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89) in - let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90) in - (Node fltPkd_138 fltPkd_139) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95 = - case t_16_95 of - Leaf x_17_96 -> - let fltPkd_140 :: Int = x_17_96 + 1 in - (Leaf fltPkd_140) - Node x1_18_97 x2_19_98 -> - let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97) in - let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98) in - (Node fltPkd_141 fltPkd_142) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in - let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134) in - (Addone_add_7 [] fltAppE_133) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59 = + case arg_20_59 of + AddTree_Leaf_4 x_21_60 -> + let y_22_61 :: Int = x_21_60 in + (AddTree_Leaf_4 y_22_61) + AddTree_Node_5 x_23_62 x_24_63 -> + let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in + let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in + (AddTree_Node_5 y_25_64 y_26_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = + case arg_27_66 of + AddTree_Leaf_4 x_28_67 -> + let y_29_68 :: Int = x_28_67 in + (AddTree_Leaf_4 y_29_68) + AddTree_Node_5 x_30_69 x_31_70 -> + let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in + let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in + (AddTree_Node_5 y_32_71 y_33_72) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73 = + case arg_34_73 of + AddTree_Leaf_4 x_35_74 -> + () + AddTree_Node_5 x_37_75 x_38_76 -> + let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in + let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79 = + case arg_41_79 of + AddTree_Leaf_4 x_42_80 -> + let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82 :: () = printsym(" ") in + let y_43_83 :: () = printint(x_42_80) in + let wildcard_45_84 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85 x_48_86 -> + let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88 :: () = printsym(" ") in + let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in + let wildcard_53_90 :: () = printsym(" ") in + let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in + let wildcard_52_92 :: () = printsym(")") in + () + [compiler] Running pass, simplify Removed unused functions: [] Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - let y_54_101_163 :: Int = x_53_100_162 in - (Leaf y_54_101_163) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - let y_61_108_170 :: Int = x_60_107_169 in - (Leaf y_61_108_170) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + let y_22_61_95 :: Int = x_21_60_94 in + (AddTree_Leaf_4 y_22_61_95) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + let y_29_68_102 :: Int = x_28_67_101 in + (AddTree_Leaf_4 y_29_68_102) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, inlineTriv Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, directL3 Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, unariser Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.flatten Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, lower Pass output: ================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", +Prog {infoTable = [("AddTree_Tree_6", + [("AddTree_Leaf_4", DataConInfo {dcon_tag = 0, scalar_bytes = 8, num_shortcut = 0, num_scalars = 1, num_packed = 0, field_tys = [IntTy]}), - ("Node", + ("AddTree_Node_5", DataConInfo {dcon_tag = 1, scalar_bytes = 0, num_shortcut = 2, num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addtwo_sub_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = SubP, - rands = [VarTriv "x_9_88_148", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addone_add_7", - funArgs = [(t_16_95_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_16_95_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_96_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_17_96_155", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_18_97_157, - CursorTy), - (x2_19_98_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x1_18_97_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x2_19_98_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], + symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), + (129, "(AddTree_Leaf_4"),(130, " ")], + fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", + funArgs = [(arg_20_59_93, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), + (tail_132, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") + rands = [VarTriv "arg_20_59_93"], + bod = Switch "switch_135" + (VarTriv "tag_131") (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, + LetUnpackT {binds = [(x_21_60_94, IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", + ptr = "tail_132", + bod = LetAllocT {lhs = "tailift_133", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), + VarTriv "x_21_60_94")], + bod = RetValsT [VarTriv "tailift_133"]}}), (1, - LetUnpackT {binds = [(x_55_102_164, + LetUnpackT {binds = [(x_23_62_96, CursorTy), - (x_56_103_165, + (x_24_63_97, CursorTy)], - ptr = "tail_211", + ptr = "tail_132", bod = LetCallT {async = False, - binds = [(y_57_104_166, + binds = [(y_25_64_98, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_23_62_96"], bod = LetCallT {async = False, - binds = [(y_58_105_167, + binds = [(y_26_65_99, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_24_63_97"], + bod = LetAllocT {lhs = "tailift_134", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_57_104_166"), + VarTriv "y_25_64_98"), (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, + VarTriv "y_26_65_99")], + bod = RetValsT [VarTriv "tailift_134"]}}}})]) + (Just ErrT "Unknown tag in: tag_131")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", + funArgs = [(arg_27_66_100, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), + (tail_137, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") + rands = [VarTriv "arg_27_66_100"], + bod = Switch "switch_140" + (VarTriv "tag_136") (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, + LetUnpackT {binds = [(x_28_67_101, IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", + ptr = "tail_137", + bod = LetAllocT {lhs = "tailift_138", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), + VarTriv "x_28_67_101")], + bod = RetValsT [VarTriv "tailift_138"]}}), (1, - LetUnpackT {binds = [(x_62_109_171, + LetUnpackT {binds = [(x_30_69_103, CursorTy), - (x_63_110_172, + (x_31_70_104, CursorTy)], - ptr = "tail_216", + ptr = "tail_137", bod = LetCallT {async = False, - binds = [(y_64_111_173, + binds = [(y_32_71_105, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_30_69_103"], bod = LetCallT {async = False, - binds = [(y_65_112_174, + binds = [(y_33_72_106, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_31_70_104"], + bod = LetAllocT {lhs = "tailift_139", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_64_111_173"), + VarTriv "y_32_71_105"), (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, + VarTriv "y_33_72_106")], + bod = RetValsT [VarTriv "tailift_139"]}}}})]) + (Just ErrT "Unknown tag in: tag_136")}, isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_6", + funArgs = [(arg_34_73_107, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), + (tail_142, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") + rands = [VarTriv "arg_34_73_107"], + bod = Switch "switch_143" + (VarTriv "tag_141") (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, + LetUnpackT {binds = [(x_35_74_108, IntTy)], - ptr = "tail_221", + ptr = "tail_142", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_69_115_177, + LetUnpackT {binds = [(x_37_75_109, CursorTy), - (x_70_116_178, + (x_38_76_110, CursorTy)], - ptr = "tail_221", + ptr = "tail_142", bod = LetCallT {async = False, - binds = [(y_71_117_179, + binds = [(y_39_77_111, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_37_75_109"], bod = LetCallT {async = False, - binds = [(y_72_118_180, + binds = [(y_40_78_112, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_38_76_110"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, + (Just ErrT "Unknown tag in: tag_141")}, isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_6", + funArgs = [(arg_41_79_113, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), + (tail_145, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") + rands = [VarTriv "arg_41_79_113"], + bod = Switch "switch_146" + (VarTriv "tag_144") (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, + LetUnpackT {binds = [(x_42_80_114, IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_44_81_115, ProdTy [])], prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, + rands = [SymTriv 129], + bod = LetPrimCallT {binds = [(wildcard_46_82_116, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, + rands = [SymTriv 130], + bod = LetPrimCallT {binds = [(y_43_83_117, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, + rands = [VarTriv "x_42_80_114"], + bod = LetPrimCallT {binds = [(wildcard_45_84_118, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_79_125_187, + LetUnpackT {binds = [(x_47_85_119, CursorTy), - (x_80_126_188, + (x_48_86_120, CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_51_87_121, ProdTy [])], prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, + rands = [SymTriv 128], + bod = LetPrimCallT {binds = [(wildcard_54_88_122, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_81_129_191, + binds = [(y_49_89_123, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_47_85_119"], + bod = LetPrimCallT {binds = [(wildcard_53_90_124, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_82_131_193, + binds = [(y_50_91_125, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_48_86_120"], + bod = LetPrimCallT {binds = [(wildcard_52_92_126, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, + (Just ErrT "Unknown tag in: tag_144")}, isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} + mainExp = Nothing} [compiler] Running pass, lateInlineTriv Pass output: ================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", +Prog {infoTable = [("AddTree_Tree_6", + [("AddTree_Leaf_4", DataConInfo {dcon_tag = 0, scalar_bytes = 8, num_shortcut = 0, num_scalars = 1, num_packed = 0, field_tys = [IntTy]}), - ("Node", + ("AddTree_Node_5", DataConInfo {dcon_tag = 1, scalar_bytes = 0, num_shortcut = 2, num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addtwo_sub_5", - funArgs = [(t_8_87_147, CursorTy)], + symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), + (129, "(AddTree_Leaf_4"),(130, " ")], + fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", + funArgs = [(arg_20_59_93, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), + (tail_132, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") + rands = [VarTriv "arg_20_59_93"], + bod = Switch "switch_135" + (VarTriv "tag_131") (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, + LetUnpackT {binds = [(x_21_60_94, IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = SubP, - rands = [VarTriv "x_9_88_148", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addone_add_7", - funArgs = [(t_16_95_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_16_95_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_96_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_17_96_155", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_18_97_157, - CursorTy), - (x2_19_98_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x1_18_97_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x2_19_98_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", + ptr = "tail_132", + bod = LetAllocT {lhs = "tailift_133", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), + VarTriv "x_21_60_94")], + bod = RetValsT [VarTriv "tailift_133"]}}), (1, - LetUnpackT {binds = [(x_55_102_164, + LetUnpackT {binds = [(x_23_62_96, CursorTy), - (x_56_103_165, + (x_24_63_97, CursorTy)], - ptr = "tail_211", + ptr = "tail_132", bod = LetCallT {async = False, - binds = [(y_57_104_166, + binds = [(y_25_64_98, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_23_62_96"], bod = LetCallT {async = False, - binds = [(y_58_105_167, + binds = [(y_26_65_99, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_24_63_97"], + bod = LetAllocT {lhs = "tailift_134", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_57_104_166"), + VarTriv "y_25_64_98"), (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, + VarTriv "y_26_65_99")], + bod = RetValsT [VarTriv "tailift_134"]}}}})]) + (Just ErrT "Unknown tag in: tag_131")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", + funArgs = [(arg_27_66_100, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), + (tail_137, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") + rands = [VarTriv "arg_27_66_100"], + bod = Switch "switch_140" + (VarTriv "tag_136") (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, + LetUnpackT {binds = [(x_28_67_101, IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", + ptr = "tail_137", + bod = LetAllocT {lhs = "tailift_138", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), + VarTriv "x_28_67_101")], + bod = RetValsT [VarTriv "tailift_138"]}}), (1, - LetUnpackT {binds = [(x_62_109_171, + LetUnpackT {binds = [(x_30_69_103, CursorTy), - (x_63_110_172, + (x_31_70_104, CursorTy)], - ptr = "tail_216", + ptr = "tail_137", bod = LetCallT {async = False, - binds = [(y_64_111_173, + binds = [(y_32_71_105, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_30_69_103"], bod = LetCallT {async = False, - binds = [(y_65_112_174, + binds = [(y_33_72_106, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_31_70_104"], + bod = LetAllocT {lhs = "tailift_139", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_64_111_173"), + VarTriv "y_32_71_105"), (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, + VarTriv "y_33_72_106")], + bod = RetValsT [VarTriv "tailift_139"]}}}})]) + (Just ErrT "Unknown tag in: tag_136")}, isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_6", + funArgs = [(arg_34_73_107, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), + (tail_142, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") + rands = [VarTriv "arg_34_73_107"], + bod = Switch "switch_143" + (VarTriv "tag_141") (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, + LetUnpackT {binds = [(x_35_74_108, IntTy)], - ptr = "tail_221", + ptr = "tail_142", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_69_115_177, + LetUnpackT {binds = [(x_37_75_109, CursorTy), - (x_70_116_178, + (x_38_76_110, CursorTy)], - ptr = "tail_221", + ptr = "tail_142", bod = LetCallT {async = False, - binds = [(y_71_117_179, + binds = [(y_39_77_111, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_37_75_109"], bod = LetCallT {async = False, - binds = [(y_72_118_180, + binds = [(y_40_78_112, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_38_76_110"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, + (Just ErrT "Unknown tag in: tag_141")}, isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_6", + funArgs = [(arg_41_79_113, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), + (tail_145, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") + rands = [VarTriv "arg_41_79_113"], + bod = Switch "switch_146" + (VarTriv "tag_144") (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, + LetUnpackT {binds = [(x_42_80_114, IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_44_81_115, ProdTy [])], prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, + rands = [SymTriv 129], + bod = LetPrimCallT {binds = [(wildcard_46_82_116, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, + rands = [SymTriv 130], + bod = LetPrimCallT {binds = [(y_43_83_117, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, + rands = [VarTriv "x_42_80_114"], + bod = LetPrimCallT {binds = [(wildcard_45_84_118, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_79_125_187, + LetUnpackT {binds = [(x_47_85_119, CursorTy), - (x_80_126_188, + (x_48_86_120, CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_51_87_121, ProdTy [])], prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, + rands = [SymTriv 128], + bod = LetPrimCallT {binds = [(wildcard_54_88_122, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_81_129_191, + binds = [(y_49_89_123, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_47_85_119"], + bod = LetPrimCallT {binds = [(wildcard_53_90_124, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_82_131_193, + binds = [(y_50_91_125, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_48_86_120"], + bod = LetPrimCallT {binds = [(wildcard_52_92_126, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, + (Just ErrT "Unknown tag in: tag_144")}, isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} + mainExp = Nothing} [compiler] Running pass, rearrangeFree Pass output: ================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", +Prog {infoTable = [("AddTree_Tree_6", + [("AddTree_Leaf_4", DataConInfo {dcon_tag = 0, scalar_bytes = 8, num_shortcut = 0, num_scalars = 1, num_packed = 0, field_tys = [IntTy]}), - ("Node", + ("AddTree_Node_5", DataConInfo {dcon_tag = 1, scalar_bytes = 0, num_shortcut = 2, num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addtwo_sub_5", - funArgs = [(t_8_87_147, CursorTy)], + symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), + (129, "(AddTree_Leaf_4"),(130, " ")], + fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", + funArgs = [(arg_20_59_93, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), + (tail_132, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") + rands = [VarTriv "arg_20_59_93"], + bod = Switch "switch_135" + (VarTriv "tag_131") (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, + LetUnpackT {binds = [(x_21_60_94, IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = SubP, - rands = [VarTriv "x_9_88_148", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addone_add_7", - funArgs = [(t_16_95_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_16_95_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_96_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_17_96_155", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_18_97_157, - CursorTy), - (x2_19_98_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x1_18_97_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x2_19_98_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", + ptr = "tail_132", + bod = LetAllocT {lhs = "tailift_133", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), + VarTriv "x_21_60_94")], + bod = RetValsT [VarTriv "tailift_133"]}}), (1, - LetUnpackT {binds = [(x_55_102_164, + LetUnpackT {binds = [(x_23_62_96, CursorTy), - (x_56_103_165, + (x_24_63_97, CursorTy)], - ptr = "tail_211", + ptr = "tail_132", bod = LetCallT {async = False, - binds = [(y_57_104_166, + binds = [(y_25_64_98, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_23_62_96"], bod = LetCallT {async = False, - binds = [(y_58_105_167, + binds = [(y_26_65_99, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_24_63_97"], + bod = LetAllocT {lhs = "tailift_134", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_57_104_166"), + VarTriv "y_25_64_98"), (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, + VarTriv "y_26_65_99")], + bod = RetValsT [VarTriv "tailift_134"]}}}})]) + (Just ErrT "Unknown tag in: tag_131")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", + funArgs = [(arg_27_66_100, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), + (tail_137, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") + rands = [VarTriv "arg_27_66_100"], + bod = Switch "switch_140" + (VarTriv "tag_136") (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, + LetUnpackT {binds = [(x_28_67_101, IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", + ptr = "tail_137", + bod = LetAllocT {lhs = "tailift_138", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), + VarTriv "x_28_67_101")], + bod = RetValsT [VarTriv "tailift_138"]}}), (1, - LetUnpackT {binds = [(x_62_109_171, + LetUnpackT {binds = [(x_30_69_103, CursorTy), - (x_63_110_172, + (x_31_70_104, CursorTy)], - ptr = "tail_216", + ptr = "tail_137", bod = LetCallT {async = False, - binds = [(y_64_111_173, + binds = [(y_32_71_105, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_30_69_103"], bod = LetCallT {async = False, - binds = [(y_65_112_174, + binds = [(y_33_72_106, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_31_70_104"], + bod = LetAllocT {lhs = "tailift_139", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_64_111_173"), + VarTriv "y_32_71_105"), (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, + VarTriv "y_33_72_106")], + bod = RetValsT [VarTriv "tailift_139"]}}}})]) + (Just ErrT "Unknown tag in: tag_136")}, isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_6", + funArgs = [(arg_34_73_107, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), + (tail_142, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") + rands = [VarTriv "arg_34_73_107"], + bod = Switch "switch_143" + (VarTriv "tag_141") (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, + LetUnpackT {binds = [(x_35_74_108, IntTy)], - ptr = "tail_221", + ptr = "tail_142", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_69_115_177, + LetUnpackT {binds = [(x_37_75_109, CursorTy), - (x_70_116_178, + (x_38_76_110, CursorTy)], - ptr = "tail_221", + ptr = "tail_142", bod = LetCallT {async = False, - binds = [(y_71_117_179, + binds = [(y_39_77_111, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_37_75_109"], bod = LetCallT {async = False, - binds = [(y_72_118_180, + binds = [(y_40_78_112, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_38_76_110"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, + (Just ErrT "Unknown tag in: tag_141")}, isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_6", + funArgs = [(arg_41_79_113, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), + (tail_145, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") + rands = [VarTriv "arg_41_79_113"], + bod = Switch "switch_146" + (VarTriv "tag_144") (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, + LetUnpackT {binds = [(x_42_80_114, IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_44_81_115, ProdTy [])], prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, + rands = [SymTriv 129], + bod = LetPrimCallT {binds = [(wildcard_46_82_116, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, + rands = [SymTriv 130], + bod = LetPrimCallT {binds = [(y_43_83_117, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, + rands = [VarTriv "x_42_80_114"], + bod = LetPrimCallT {binds = [(wildcard_45_84_118, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_79_125_187, + LetUnpackT {binds = [(x_47_85_119, CursorTy), - (x_80_126_188, + (x_48_86_120, CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_51_87_121, ProdTy [])], prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, + rands = [SymTriv 128], + bod = LetPrimCallT {binds = [(wildcard_54_88_122, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_81_129_191, + binds = [(y_49_89_123, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_47_85_119"], + bod = LetPrimCallT {binds = [(wildcard_53_90_124, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_82_131_193, + binds = [(y_50_91_125, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_48_86_120"], + bod = LetPrimCallT {binds = [(wildcard_52_92_126, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, + (Just ErrT "Unknown tag in: tag_144")}, isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Final C codegen: 13391 characters. + mainExp = Nothing} + + [compiler] Final C codegen: 9069 characters. ================================================================================ /* Gibbon program. */ @@ -3096,12 +2016,10 @@ typedef struct GibCursorGibCursorProd_struct { GibCursor field0; GibCursor field1; } GibCursorGibCursorProd; -GibCursor Addtwo_sub_5(GibCursor t_8_87_147); -GibCursor Addone_add_7(GibCursor t_16_95_154); -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); +GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93); +GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100); +unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107); +unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113); typedef enum { GibInt_T, GibFloat_T, @@ -3110,7 +2028,7 @@ typedef enum { GibVector_T, GibList_T, GibCursor_T, - AddTree_Tree_4_T, + AddTree_Tree_6_T, } GibDatatype; void info_table_initialize(void) { @@ -3123,240 +2041,140 @@ void info_table_initialize(void) GibDatatype field_tys[1]; - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 0, 8, 0, 1, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 0); + error, AddTree_Tree_6_T, 0); exit(1); } - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 1, 0, 2, 0, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 1); + error, AddTree_Tree_6_T, 1); exit(1); } gib_info_table_finalize(); } void symbol_table_initialize(void) { - gib_add_symbol(196, ")"); - gib_add_symbol(197, "(Node"); - gib_add_symbol(198, "(Leaf"); - gib_add_symbol(199, " "); + gib_add_symbol(127, ")"); + gib_add_symbol(128, "(AddTree_Node_5"); + gib_add_symbol(129, "(AddTree_Leaf_4"); + gib_add_symbol(130, " "); } -GibCursor Addtwo_sub_5(GibCursor t_8_87_147) +GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93) { - GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; - GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); + GibPackedTag tag_131 = *(GibPackedTag *) arg_20_59_93; + GibCursor tail_132 = arg_20_59_93 + sizeof(GibInt); - switch_204: + switch_135: ; - switch (tag_200) { + switch (tag_131) { case 0: { - GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; - GibInt fltPkd_137_149 = x_9_88_148 - 2; - GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_21_60_94 = ((GibIntProd *) tail_132)->field0; + GibPtr tailift_133 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_202)->field0 = 0; - ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; - return tailift_202; + ((GibIntGibIntProd *) tailift_133)->field0 = 0; + ((GibIntGibIntProd *) tailift_133)->field1 = x_21_60_94; + return tailift_133; break; } case 1: { - GibCursor x1_10_89_150 = - ((GibCursorGibCursorProd *) tail_201)->field0; - GibCursor x2_11_90_151 = - ((GibCursorGibCursorProd *) tail_201)->field1; - GibCursor fltPkd_138_152 = Addtwo_sub_5(x1_10_89_150); - GibCursor fltPkd_139_153 = Addtwo_sub_5(x2_11_90_151); - GibPtr tailift_203 = + GibCursor x_23_62_96 = + ((GibCursorGibCursorProd *) tail_132)->field0; + GibCursor x_24_63_97 = + ((GibCursorGibCursorProd *) tail_132)->field1; + GibCursor y_25_64_98 = _copy_AddTree_Tree_6(x_23_62_96); + GibCursor y_26_65_99 = _copy_AddTree_Tree_6(x_24_63_97); + GibPtr tailift_134 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = - fltPkd_138_152; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = - fltPkd_139_153; - return tailift_203; + ((GibIntGibCursorGibCursorProd *) tailift_134)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_134)->field1 = y_25_64_98; + ((GibIntGibCursorGibCursorProd *) tailift_134)->field2 = y_26_65_99; + return tailift_134; break; } default: { - printf("%s\n", "Unknown tag in: tag_200"); + printf("%s\n", "Unknown tag in: tag_131"); exit(1); } } } -GibCursor Addone_add_7(GibCursor t_16_95_154) +GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100) { - GibPackedTag tag_205 = *(GibPackedTag *) t_16_95_154; - GibCursor tail_206 = t_16_95_154 + sizeof(GibInt); + GibPackedTag tag_136 = *(GibPackedTag *) arg_27_66_100; + GibCursor tail_137 = arg_27_66_100 + sizeof(GibInt); - switch_209: + switch_140: ; - switch (tag_205) { + switch (tag_136) { case 0: { - GibInt x_17_96_155 = ((GibIntProd *) tail_206)->field0; - GibInt fltPkd_140_156 = x_17_96_155 + 1; - GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_28_67_101 = ((GibIntProd *) tail_137)->field0; + GibPtr tailift_138 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_207)->field0 = 0; - ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; - return tailift_207; + ((GibIntGibIntProd *) tailift_138)->field0 = 0; + ((GibIntGibIntProd *) tailift_138)->field1 = x_28_67_101; + return tailift_138; break; } case 1: { - GibCursor x1_18_97_157 = - ((GibCursorGibCursorProd *) tail_206)->field0; - GibCursor x2_19_98_158 = - ((GibCursorGibCursorProd *) tail_206)->field1; - GibCursor fltPkd_141_159 = Addone_add_7(x1_18_97_157); - GibCursor fltPkd_142_160 = Addone_add_7(x2_19_98_158); - GibPtr tailift_208 = + GibCursor x_30_69_103 = + ((GibCursorGibCursorProd *) tail_137)->field0; + GibCursor x_31_70_104 = + ((GibCursorGibCursorProd *) tail_137)->field1; + GibCursor y_32_71_105 = + _copy_without_ptrs_AddTree_Tree_6(x_30_69_103); + GibCursor y_33_72_106 = + _copy_without_ptrs_AddTree_Tree_6(x_31_70_104); + GibPtr tailift_139 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = - fltPkd_141_159; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = - fltPkd_142_160; - return tailift_208; + ((GibIntGibCursorGibCursorProd *) tailift_139)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_139)->field1 = + y_32_71_105; + ((GibIntGibCursorGibCursorProd *) tailift_139)->field2 = + y_33_72_106; + return tailift_139; break; } default: { - printf("%s\n", "Unknown tag in: tag_205"); + printf("%s\n", "Unknown tag in: tag_136"); exit(1); } } } -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) +unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107) { - GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; - GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); + GibPackedTag tag_141 = *(GibPackedTag *) arg_34_73_107; + GibCursor tail_142 = arg_34_73_107 + sizeof(GibInt); - switch_214: + switch_143: ; - switch (tag_210) { + switch (tag_141) { case 0: { - GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; - GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_212)->field0 = 0; - ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; - return tailift_212; - break; - } - - case 1: - { - GibCursor x_55_102_164 = - ((GibCursorGibCursorProd *) tail_211)->field0; - GibCursor x_56_103_165 = - ((GibCursorGibCursorProd *) tail_211)->field1; - GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); - GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); - GibPtr tailift_213 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = - y_57_104_166; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = - y_58_105_167; - return tailift_213; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_210"); - exit(1); - } - } -} -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) -{ - GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; - GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); - - - switch_219: - ; - switch (tag_215) { - - case 0: - { - GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; - GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_217)->field0 = 0; - ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; - return tailift_217; - break; - } - - case 1: - { - GibCursor x_62_109_171 = - ((GibCursorGibCursorProd *) tail_216)->field0; - GibCursor x_63_110_172 = - ((GibCursorGibCursorProd *) tail_216)->field1; - GibCursor y_64_111_173 = - _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); - GibCursor y_65_112_174 = - _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); - GibPtr tailift_218 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = - y_64_111_173; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = - y_65_112_174; - return tailift_218; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_215"); - exit(1); - } - } -} -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) -{ - GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; - GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); - - - switch_222: - ; - switch (tag_220) { - - case 0: - { - GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; + GibInt x_35_74_108 = ((GibIntProd *) tail_142)->field0; return 0; break; @@ -3364,14 +2182,12 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) case 1: { - GibCursor x_69_115_177 = - ((GibCursorGibCursorProd *) tail_221)->field0; - GibCursor x_70_116_178 = - ((GibCursorGibCursorProd *) tail_221)->field1; - unsigned char y_71_117_179 = - _traverse_AddTree_Tree_4(x_69_115_177); - unsigned char y_72_118_180 = - _traverse_AddTree_Tree_4(x_70_116_178); + GibCursor x_37_75_109 = + ((GibCursorGibCursorProd *) tail_142)->field0; + GibCursor x_38_76_110 = + ((GibCursorGibCursorProd *) tail_142)->field1; + unsigned char y_39_77_111 = _traverse_AddTree_Tree_6(x_37_75_109); + unsigned char y_40_78_112 = _traverse_AddTree_Tree_6(x_38_76_110); return 0; break; @@ -3379,28 +2195,28 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) default: { - printf("%s\n", "Unknown tag in: tag_220"); + printf("%s\n", "Unknown tag in: tag_141"); exit(1); } } } -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) +unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113) { - GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; - GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); + GibPackedTag tag_144 = *(GibPackedTag *) arg_41_79_113; + GibCursor tail_145 = arg_41_79_113 + sizeof(GibInt); - switch_225: + switch_146: ; - switch (tag_223) { + switch (tag_144) { case 0: { - GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; - unsigned char wildcard_76_121_183 = gib_print_symbol(198); - unsigned char wildcard_78_122_184 = gib_print_symbol(199); - unsigned char y_75_123_185 = printf("%ld", x_74_120_182); - unsigned char wildcard_77_124_186 = gib_print_symbol(196); + GibInt x_42_80_114 = ((GibIntProd *) tail_145)->field0; + unsigned char wildcard_44_81_115 = gib_print_symbol(129); + unsigned char wildcard_46_82_116 = gib_print_symbol(130); + unsigned char y_43_83_117 = printf("%ld", x_42_80_114); + unsigned char wildcard_45_84_118 = gib_print_symbol(127); return 0; break; @@ -3408,16 +2224,16 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) case 1: { - GibCursor x_79_125_187 = - ((GibCursorGibCursorProd *) tail_224)->field0; - GibCursor x_80_126_188 = - ((GibCursorGibCursorProd *) tail_224)->field1; - unsigned char wildcard_83_127_189 = gib_print_symbol(197); - unsigned char wildcard_86_128_190 = gib_print_symbol(199); - unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); - unsigned char wildcard_85_130_192 = gib_print_symbol(199); - unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); - unsigned char wildcard_84_132_194 = gib_print_symbol(196); + GibCursor x_47_85_119 = + ((GibCursorGibCursorProd *) tail_145)->field0; + GibCursor x_48_86_120 = + ((GibCursorGibCursorProd *) tail_145)->field1; + unsigned char wildcard_51_87_121 = gib_print_symbol(128); + unsigned char wildcard_54_88_122 = gib_print_symbol(130); + unsigned char y_49_89_123 = _print_AddTree_Tree_6(x_47_85_119); + unsigned char wildcard_53_90_124 = gib_print_symbol(130); + unsigned char y_50_91_125 = _print_AddTree_Tree_6(x_48_86_120); + unsigned char wildcard_52_92_126 = gib_print_symbol(127); return 0; break; @@ -3425,7 +2241,7 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) default: { - printf("%s\n", "Unknown tag in: tag_223"); + printf("%s\n", "Unknown tag in: tag_144"); exit(1); } } @@ -3437,29 +2253,6 @@ int main(int argc, char **argv) info_table_initialize(); symbol_table_initialize(); - GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; - - GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; - - GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; - - GibCursor fltAppE_133_146 = Addtwo_sub_5(fltAppE_134_145); - GibCursor tmp_app_195 = Addone_add_7(fltAppE_133_146); - - _print_AddTree_Tree_4(tmp_app_195); - printf("\n"); - return 0; - int exit_1 = gib_exit(); return exit_1; @@ -3468,25 +2261,10 @@ int main(int argc, char **argv) Compiling RTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 - -make: Nothing to be done for 'all'. - - - - -Compiling the program -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng - - - -In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] - #warning "Simple write barrier is disabled." - ^~~~~~~ +make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 +codegen: C RTS could not be compiled: +make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory +make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. -(Node (Leaf 0) (Leaf 1)) +Code: 2 diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 60377fbff..7932a0ea2 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -58,6 +58,7 @@ import qualified Gibbon.L0.Specialize2 as L0 import qualified Gibbon.L1.Typecheck as L1 import qualified Gibbon.L2.Typecheck as L2 import qualified Gibbon.L3.Typecheck as L3 +import Gibbon.Passes.FreshConstructors (freshConstructors) import Gibbon.Passes.ModuleRename (moduleRename) import Gibbon.Passes.Freshen (freshNames) import Gibbon.Passes.Flatten (flattenL1, flattenL2, flattenL3) @@ -604,9 +605,10 @@ passes config@Config{dynflags} l0 = do opt_layout_global = gopt Opt_Layout_Global dynflags use_solver = gopt Opt_Layout_Use_Solver dynflags tcProg3 = L3.tcProg isPacked + l0 <- go "freshConstructors" freshConstructors l0 l0 <- go "renameModules" moduleRename l0 l0 <- go "freshen" freshNames l0 - l0 <- goE0 "typecheck" L0.tcProg l0 + l0 <- goE0 "typecheck" L0.tcProg l0 l0 <- goE0 "bindLambdas" L0.bindLambdas l0 l0 <- goE0 "monomorphize" L0.monomorphize l0 -- l0 <- goE0 "closureConvert" L0.closureConvert l0 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 213d566e9..14519cb6c 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -241,7 +241,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - defs' = M.mapWithKey (\k dDef -> dDef {tyName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) + defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs new file mode 100644 index 000000000..18477ca45 --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs @@ -0,0 +1,131 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} + +module Gibbon.Passes.FreshConstructors (freshConstructors) where + +import qualified Data.List as L +import qualified Data.Map as M + +import Gibbon.Common +import Gibbon.L0.Syntax + +type VarEnv = M.Map Var Var + +freshConstructors :: Prog0 -> PassM Prog0 +freshConstructors (Prog defs funs main) = do + let constrs :: [Var] = (L.map (\(constrName, _) -> + (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> + acc ++ dataCons + ) [] (M.elems defs)) + ) + freshNames <- (mapM (\v -> gensym v) constrs) + let constrenv :: VarEnv = M.fromList $ zip constrs freshNames + + main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) + m' <- freshConstrsInExp m constrenv + return $ Just (m',ty) + defs' <- traverse (\v -> freshConstrsInDef v constrenv) defs + funs' <- traverse (\v -> freshConstrsInFun v constrenv) funs + + return $ Prog defs' funs' main' + +freshConstrsInDef :: DDef Ty0 -> VarEnv -> PassM (DDef Ty0) +freshConstrsInDef (DDef tyName tyArgs dataCons) constrenv = + do + let dataCons' = map (\(dataCon, vs) -> + case (M.lookup (toVar dataCon) constrenv) of + Just dataCon' -> ((fromVar dataCon'), vs) + Nothing -> error $ "shouldn't get here" + ) dataCons + pure $ DDef tyName tyArgs dataCons' + +-- + +freshConstrsInFun :: FunDef Exp0 -> VarEnv -> PassM (FunDef Exp0) +freshConstrsInFun (FunDef nam nargs funty bod meta) constrenv = + do + bod' <- freshConstrsInExp bod constrenv + pure $ FunDef nam nargs funty bod' meta + +freshConstrsInExp :: Exp0 -> VarEnv -> PassM Exp0 +freshConstrsInExp exp constrenv = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + --VarE v -> return $ VarE (varAppend (toVar "seen-") v) + VarE v -> return $ VarE v + + AppE v locs ls -> do + ls' <- traverse (\v -> freshConstrsInExp v constrenv) ls + return $ AppE v locs ls' + + PrimAppE p es -> do + es' <- traverse (\v -> freshConstrsInExp v constrenv) es + return $ PrimAppE p es' + + LetE (v,_locs,ty, e1) e2 -> do + e1' <- freshConstrsInExp e1 constrenv + e2' <- freshConstrsInExp e2 constrenv + return $ LetE (v, [], ty, e1') e2' + + IfE e1 e2 e3 -> do + e1' <- freshConstrsInExp e1 constrenv + e2' <- freshConstrsInExp e2 constrenv + e3' <- freshConstrsInExp e3 constrenv + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- freshConstrsInExp e constrenv + return $ ProjE i e' + + MkProdE es -> do + es' <- traverse (\v -> freshConstrsInExp v constrenv) es + return $ MkProdE es' + + CaseE e mp -> do + e' <- freshConstrsInExp e constrenv + mp' <- mapM (\(c,prs,ae) -> do + let c' = (fromVar (resolveNameInEnv (toVar c) constrenv)) + ae' <- freshConstrsInExp ae constrenv + return (c', prs, ae')) mp + return $ CaseE e' mp' + + DataConE loc c es -> do + let c' = (fromVar (resolveNameInEnv (toVar c) constrenv)) + es' <- traverse (\v -> freshConstrsInExp v constrenv) es + return $ DataConE loc c' es' + + TimeIt e t b -> do + e' <- freshConstrsInExp e constrenv + return $ TimeIt e' t b + WithArenaE v e -> do + e' <- freshConstrsInExp e constrenv + return $ WithArenaE v e' + SpawnE v locs ls -> do + ls' <- traverse (\v -> freshConstrsInExp v constrenv) ls + return $ SpawnE v locs ls' + SyncE -> return $ SyncE + + MapE (v, d, ve) e -> do + e' <- freshConstrsInExp e constrenv + ve' <- freshConstrsInExp ve constrenv + return $ MapE (v, d, ve') e' + FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do + e1' <- freshConstrsInExp e1 constrenv + e2' <- freshConstrsInExp e2 constrenv + e3' <- freshConstrsInExp e3 constrenv + return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' + Ext ext -> return $ Ext ext + +-- + +resolveNameInEnv :: Var -> VarEnv -> Var +resolveNameInEnv name e = + do case (M.lookup name e) of + --Just freshName -> (toVar ((fromVar freshName) ++ "*")) + Just freshName -> freshName + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in constructor env: " ++ (show e) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index f01e22c71..54d8711ce 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -42,15 +42,25 @@ fillImports (Prog defs funs main) localMod imports imported_progs = Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] Nothing -> error $ "could not find module or alias: " ++ (show modName) Nothing -> error "how did we get here?" + + let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs + let localConstrs = (L.map (\(constrName, _) -> + (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> + acc ++ dataCons + ) [] (M.elems defs)) + ) let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (M.keys idefs))) initImportedNames imported_progs let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (foldr applyImportMeta [] (M.keys ifuns))) initImportedNames imported_progs - --let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs - --let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs + + let initEnv :: VarEnv = M.empty + -- build constructor env + + let constrNameMap = M.fromList $ importedConstrs ++ (zip localConstrs (map (\v -> (v, False)) localConstrs)) + let (constrenv, _) = M.mapAccumWithKey buildEnv initEnv constrNameMap -- build def env let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (map (\v -> (v, False)) (M.keys defs))) - let initDefEnv :: VarEnv = M.empty - let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap + let (defenv, _) = M.mapAccumWithKey buildEnv initEnv defNameMap let transformDefKey :: Var -> Var transformDefKey k = do let (mod, name) = parseOutMod k @@ -58,8 +68,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- build fun env let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (map (\v -> (v, False)) (M.keys funs)) ) - let initFunEnv :: VarEnv = M.empty - let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap + let (funenv, _) = M.mapAccumWithKey buildEnv initEnv funNameMap let transformFunKey :: Var -> Var transformFunKey k = do let (mod, name) = parseOutMod k @@ -69,12 +78,12 @@ fillImports (Prog defs funs main) localMod imports imported_progs = main' <- case main of Nothing -> return Nothing Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) - m' <- resolveModInExp m defenv funenv + m' <- resolveModInExp m defenv funenv constrenv return $ Just (m',ty) defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs - funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs + funs' <- traverse (\v -> resolveModsInFuns v defenv funenv constrenv) funs let defs'' = M.mapKeys transformDefKey defs' let funs'' = M.mapKeys transformFunKey funs' @@ -118,12 +127,12 @@ resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' -resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = +resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv constrenv = do let nam' = parseAndResolve nam funenv let funty' = resolveModsInTyScheme funty defenv - bod' <- resolveModInExp bod defenv funenv + bod' <- resolveModInExp bod defenv funenv constrenv pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme @@ -161,8 +170,8 @@ resolveModInTy ty defenv = ListTy el_t -> ListTy $ resolveModInTy el_t defenv IntHashTy -> ty -resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> PassM Exp0 -resolveModInExp exp defenv funenv = +resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM Exp0 +resolveModInExp exp defenv funenv constrenv = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c @@ -174,37 +183,65 @@ resolveModInExp exp defenv funenv = AppE v locs ls -> do let (mod, fun) = parseOutMod v let v' = resolveNameInEnv mod fun funenv - ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls return $ AppE v' locs ls' - PrimAppE p es -> return $ PrimAppE p es + PrimAppE p es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es + return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do - e1' <- resolveModInExp e1 defenv funenv - e2' <- resolveModInExp e2 defenv funenv + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv return $ LetE (v, [], ty, e1') e2' - IfE e1 e2 e3 -> return $ IfE e1 e2 e3 - ProjE i e -> return $ ProjE i e - MkProdE es -> return $ MkProdE es + IfE e1 e2 e3 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + e3' <- resolveModInExp e3 defenv funenv constrenv + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ ProjE i e' + + MkProdE es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es + return $ MkProdE es' CaseE e mp -> do - e' <- resolveModInExp e defenv funenv + e' <- resolveModInExp e defenv funenv constrenv mp' <- mapM (\(c,prs,ae) -> do - ae' <- resolveModInExp ae defenv funenv - return (c, prs, ae')) mp + let c' = (fromVar (parseAndResolve (toVar c) constrenv)) + ae' <- resolveModInExp ae defenv funenv constrenv + return (c', prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- traverse (\v -> resolveModInExp v defenv funenv) es - return $ DataConE loc c es' - - TimeIt e t b -> return $ TimeIt e t b - WithArenaE v e -> return $ WithArenaE v e - SpawnE v locs ls -> return $ SpawnE v locs ls + let c' = (fromVar (parseAndResolve (toVar c) constrenv)) + es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es + return $ DataConE loc c' es' + + TimeIt e t b -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ TimeIt e' t b + WithArenaE v e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ WithArenaE v e' + SpawnE v locs ls -> do + ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls + return $ SpawnE v locs ls' SyncE -> return $ SyncE - MapE v e -> return $ MapE v e - FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + + MapE (v, d, ve) e -> do + e' <- resolveModInExp e defenv funenv constrenv + ve' <- resolveModInExp ve defenv funenv constrenv + return $ MapE (v, d, ve') e' + FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + e3' <- resolveModInExp e3 defenv funenv constrenv + return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' Ext ext -> return $ Ext ext diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 88abe2f2b..e634a2862 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -123,16 +123,28 @@ resolveModInExp exp defenv funenv = ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls return $ AppE v' locs ls' - PrimAppE p es -> return $ PrimAppE p es + PrimAppE p es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv) es + return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do e1' <- resolveModInExp e1 defenv funenv e2' <- resolveModInExp e2 defenv funenv return $ LetE (v, [], ty, e1') e2' - IfE e1 e2 e3 -> return $ IfE e1 e2 e3 - ProjE i e -> return $ ProjE i e - MkProdE es -> return $ MkProdE es + IfE e1 e2 e3 -> do + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv + e3' <- resolveModInExp e3 defenv funenv + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- resolveModInExp e defenv funenv + return $ ProjE i e' + + MkProdE es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv) es + return $ MkProdE es' CaseE e mp -> do e' <- resolveModInExp e defenv funenv @@ -145,12 +157,25 @@ resolveModInExp exp defenv funenv = es' <- traverse (\v -> resolveModInExp v defenv funenv) es return $ DataConE loc c es' - TimeIt e t b -> return $ TimeIt e t b - WithArenaE v e -> return $ WithArenaE v e - SpawnE v locs ls -> return $ SpawnE v locs ls + TimeIt e t b -> do + e' <- resolveModInExp e defenv funenv + return $ TimeIt e' t b + WithArenaE v e -> do + e' <- resolveModInExp e defenv funenv + return $ WithArenaE v e' + SpawnE v locs ls -> do + ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + return $ SpawnE v locs ls' SyncE -> return $ SyncE - MapE v e -> return $ MapE v e - FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + MapE (v, d, ve) e -> do + e' <- resolveModInExp e defenv funenv + ve' <- resolveModInExp ve defenv funenv + return $ MapE (v, d, ve') e' + FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv + e3' <- resolveModInExp e3 defenv funenv + return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' Ext ext -> return $ Ext ext From 97b9c39018ee3149ba34b62478d4ad7aa34c335b Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 7 Dec 2023 13:40:53 -0500 Subject: [PATCH 13/68] fix? handling local identifier --- gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs | 3 ++- gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 54d8711ce..0bea41744 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -281,7 +281,8 @@ resolveNameInEnv mod name e = Nothing -> case (foldr findUnqualified (False, "") modspace) of (True, n) -> n (False, _) -> error $ "can't find unquilified reference to " ++ (fromVar name) - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) + Nothing -> name + --Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) findUnqualified (n, q) (acc, out) = diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index e634a2862..61dcc4309 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -115,7 +115,7 @@ resolveModInExp exp defenv funenv = FloatE i -> return $ FloatE i LitSymE v -> return $ LitSymE v --VarE v -> return $ VarE (varAppend (toVar "seen-") v) - VarE v -> return $ VarE v + VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) AppE v locs ls -> do let (mod, fun) = parseOutMod v @@ -214,4 +214,5 @@ resolveNameInEnv mod name e = Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) Nothing -> if(M.size modspace == 1) then head $ M.elems modspace else error $ "can't find " ++ (fromVar name) - Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file + Nothing -> name + --Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file From 2659da70b1fe22f00e3bb74b6f8c29c730fb6a8d Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 7 Dec 2023 18:51:26 -0500 Subject: [PATCH 14/68] some testing --- gibbon-compiler/examples/imports/AddTree.hs | 2 +- .../imports/AllThreeImportModifications.ans | 1 + .../imports/AllThreeImportModifications.hs | 2 +- .../examples/imports/ImportAliased.ans | 1 + .../examples/imports/ImportQualified.ans | 1 + .../imports/ImportQualifiedAndSpecified.ans | 1 + .../examples/imports/ImportSpecified.ans | 1 + gibbon-compiler/examples/imports/ir.log | 282 ------------------ .../src/Gibbon/Passes/ModuleFillImports.hs | 3 +- .../tests/test-gibbon-examples.yaml | 20 +- 10 files changed, 26 insertions(+), 288 deletions(-) create mode 100644 gibbon-compiler/examples/imports/AllThreeImportModifications.ans create mode 100644 gibbon-compiler/examples/imports/ImportAliased.ans create mode 100644 gibbon-compiler/examples/imports/ImportQualified.ans create mode 100644 gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans create mode 100644 gibbon-compiler/examples/imports/ImportSpecified.ans delete mode 100644 gibbon-compiler/examples/imports/ir.log diff --git a/gibbon-compiler/examples/imports/AddTree.hs b/gibbon-compiler/examples/imports/AddTree.hs index 4da208e66..9acdf78cc 100644 --- a/gibbon-compiler/examples/imports/AddTree.hs +++ b/gibbon-compiler/examples/imports/AddTree.hs @@ -1,5 +1,5 @@ module AddTree where - data Tree = Leaf Int | Node Tree Tree + data Tree = Node Tree Tree | Leaf Int sum :: Tree -> Int sum t = diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.ans b/gibbon-compiler/examples/imports/AllThreeImportModifications.ans new file mode 100644 index 000000000..f11c82a4c --- /dev/null +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.ans @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs index 37764a7f3..987a05acd 100644 --- a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs @@ -1,6 +1,6 @@ module AllThreeImportModifications where import qualified Addtwo as T (add) import qualified Addone as O (add) - import AddTree as Tree (Node, Lead) + import AddTree as Tree (Node, Leaf) gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportAliased.ans b/gibbon-compiler/examples/imports/ImportAliased.ans new file mode 100644 index 000000000..f11c82a4c --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportAliased.ans @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualified.ans b/gibbon-compiler/examples/imports/ImportQualified.ans new file mode 100644 index 000000000..f11c82a4c --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualified.ans @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans new file mode 100644 index 000000000..7813681f5 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportSpecified.ans b/gibbon-compiler/examples/imports/ImportSpecified.ans new file mode 100644 index 000000000..7813681f5 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportSpecified.ans @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ir.log b/gibbon-compiler/examples/imports/ir.log deleted file mode 100644 index db7db6b2e..000000000 --- a/gibbon-compiler/examples/imports/ir.log +++ /dev/null @@ -1,282 +0,0 @@ - ! Responding to env Var: GIBBON_DEBUG=4 - ! We set DEBUG based on command-line verbose arg: 4 -================================================================================ - -desugaring module: ImportAliased - -- imports: ["Addtwo","Addone","AddTree"] - -- aliases: fromList [(Var "Addtwo",Var "T"),(Var "Addone",Var "O"),(Var "AddTree",Var "Tree")] - -- imports: fromList [(Var "Addtwo",(Var "T",True,Nothing)),(Var "Addone",(Var "O",True,Nothing)),(Var "AddTree",(Var "Tree",False,Nothing))] - -================================================================================ - -desugaring module: Addtwo - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - -================================================================================ - -desugaring module: AddTree - -- imports: [] - -- aliases: fromList [] - -- imports: fromList [] - -================================================================================ - -desugaring module: Addone - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - - [compiler] pipeline starting, parsed program: -================================================================================ -Prog {ddefs = [(AddTree.Tree, - DDef {tyName = "AddTree.Tree", - tyArgs = [], - dataCons = [("Leaf", [(False, IntTy)]), - ("Node", - [(False, PackedTy "AddTree.Tree" []), - (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(Addtwo.add, - FunDef {funName = "Addtwo.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addtwo.add" [] [VarE "x1"], - AppE "Addtwo.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.sub, - FunDef {funName = "Addtwo.sub", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addtwo.sub" [] [VarE "x1"], - AppE "Addtwo.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addone.add, - FunDef {funName = "Addone.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addone.add" [] [VarE "x1"], - AppE "Addone.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addone.sub, - FunDef {funName = "Addone.sub", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addone.sub" [] [VarE "x1"], - AppE "Addone.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (AddTree.sum, - FunDef {funName = "AddTree.sum", - funArgs = [t], - funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), - funBody = CaseE (VarE "t") - [("Leaf", [(v, MetaTv $1)], VarE "v"), - ("Node", - [(l, MetaTv $2),(r, MetaTv $3)], - PrimAppE AddP - [AppE "sum" [] [VarE "l"], - AppE "sum" [] [VarE "r"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "AddTree.sum" - [] - [AppE "Addtwo.add" - [] - [AppE "Addone.add" - [] - [DataConE (MetaTv $0) - "Tree.Node" - [DataConE (MetaTv $1) "Tree.Leaf" [LitE 1], - DataConE (MetaTv $2) "Tree.Leaf" [LitE 2]]]]], - MetaTv $3)} - - [compiler] Running pass, renameModules -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_5 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 2) - Node x1::$4 x2::$5 -> - (Node $3 (Addtwo_add_5 [] x1) (Addtwo_add_5 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_6 t = - case t of - Leaf x::$8 -> - (Leaf $7 x - 2) - Node x1::$10 x2::$11 -> - (Node $9 (Addtwo_sub_6 [] x1) (Addtwo_sub_6 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 1) - Node x1::$4 x2::$5 -> - (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_sub_8 t = - case t of - Leaf x::$8 -> - (Leaf $7 x - 1) - Node x1::$10 x2::$11 -> - (Node $9 (Addone_sub_8 [] x1) (Addone_sub_8 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) -AddTree_sum_9 t = - case t of - Leaf v::$1 -> - v - Node l::$2 r::$3 -> - (sum [] l) + (sum [] r) - -gibbon_main :: $3 -gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) - - [compiler] Running pass, freshen -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_5 t_10 = - case t_10 of - Leaf x_11::$2 -> - (Leaf $1 x_11 + 2) - Node x1_12::$4 x2_13::$5 -> - (Node $3 (Addtwo_add_5 [] x1_12) (Addtwo_add_5 [] x2_13)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_6 t_14 = - case t_14 of - Leaf x_15::$8 -> - (Leaf $7 x_15 - 2) - Node x1_16::$10 x2_17::$11 -> - (Node $9 (Addtwo_sub_6 [] x1_16) (Addtwo_sub_6 [] x2_17)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_18 = - case t_18 of - Leaf x_19::$2 -> - (Leaf $1 x_19 + 1) - Node x1_20::$4 x2_21::$5 -> - (Node $3 (Addone_add_7 [] x1_20) (Addone_add_7 [] x2_21)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_sub_8 t_22 = - case t_22 of - Leaf x_23::$8 -> - (Leaf $7 x_23 - 1) - Node x1_24::$10 x2_25::$11 -> - (Node $9 (Addone_sub_8 [] x1_24) (Addone_sub_8 [] x2_25)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) -AddTree_sum_9 t_26 = - case t_26 of - Leaf v_27::$1 -> - v_27 - Node l_28::$2 r_29::$3 -> - (sum [] l_28) + (sum [] r_29) - -gibbon_main :: $3 -gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) - - [compiler] Running pass, typecheck -gibbon: L0.Typecheck: - Unknown function: sum in Var "AddTree_sum_9" -CallStack (from HasCallStack): - error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 0bea41744..a47ea8587 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -181,8 +181,7 @@ resolveModInExp exp defenv funenv constrenv = VarE v -> return $ VarE v AppE v locs ls -> do - let (mod, fun) = parseOutMod v - let v' = resolveNameInEnv mod fun funenv + let v' = parseAndResolve v funenv ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls return $ AppE v' locs ls' diff --git a/gibbon-compiler/tests/test-gibbon-examples.yaml b/gibbon-compiler/tests/test-gibbon-examples.yaml index ff123bb0d..6ec2dc3e9 100644 --- a/gibbon-compiler/tests/test-gibbon-examples.yaml +++ b/gibbon-compiler/tests/test-gibbon-examples.yaml @@ -330,9 +330,25 @@ tests: - name: Tuples.hs answer-file: examples/Tuples.hs.ans - - name: Foo.hs + - name: AllThreeImportModifications.hs dir: examples/imports/ - answer-file: examples/imports/Foo.ans + answer-file: examples/imports/AllThreeImportModifications.ans + + - name: ImportQualifiedAndSpecified.hs + dir: examples/imports/ + answer-file: examples/imports/ImportQualifiedAndSpecified.ans + + - name: ImportAliased.hs + dir: examples/imports/ + answer-file: examples/imports/ImportAliased.ans + + - name: ImportQualified.hs + dir: examples/imports/ + answer-file: examples/imports/ImportQualified.ans + + - name: ImportSpecified.hs + dir: examples/imports/ + answer-file: examples/imports/ImportSpecified.ans - name: NeedsClosure.hs dir: examples/poly From c3e9aca5e905fb2d205a221e5f9595eff8ab917c Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 18:34:50 -0500 Subject: [PATCH 15/68] fixed interp --- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 4 ++-- gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs | 7 +++++-- gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 14519cb6c..66c9aaa22 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -281,7 +281,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports funs''' (M.keys userOrderings') imported_progs' <- mapM id imported_progs - Prog defs'' funs'''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' + Prog defs'' funs''''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' let (defs0, funs0) = foldr (\Prog {ddefs, fundefs} (defs1, funs1) -> @@ -320,7 +320,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports error $ "Conflicting definitions of " ++ show (S.toList em2) ++ " found in " ++ mod_name) - (defs'', funs'''') + (defs'', funs''''') imported_progs' return $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index a47ea8587..df412875c 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -178,7 +178,8 @@ resolveModInExp exp defenv funenv constrenv = FloatE i -> return $ FloatE i LitSymE v -> return $ LitSymE v --VarE v -> return $ VarE (varAppend (toVar "seen-") v) - VarE v -> return $ VarE v + --VarE v -> return $ VarE v + VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) AppE v locs ls -> do let v' = parseAndResolve v funenv @@ -280,7 +281,9 @@ resolveNameInEnv mod name e = Nothing -> case (foldr findUnqualified (False, "") modspace) of (True, n) -> n (False, _) -> error $ "can't find unquilified reference to " ++ (fromVar name) - Nothing -> name + Nothing -> case mod of + Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) + Nothing -> name --Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 61dcc4309..218ad021a 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -214,5 +214,7 @@ resolveNameInEnv mod name e = Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) Nothing -> if(M.size modspace == 1) then head $ M.elems modspace else error $ "can't find " ++ (fromVar name) - Nothing -> name + Nothing -> case mod of + Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) + Nothing -> name --Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file From 22cc52676c9ae0a22417be5c533707face1c90f5 Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 18:53:13 -0500 Subject: [PATCH 16/68] fixing a test (did not specify the sum function) --- gibbon-compiler/examples/imports/AllThreeImportModifications.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs index 987a05acd..472ad4f79 100644 --- a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs @@ -1,6 +1,6 @@ module AllThreeImportModifications where import qualified Addtwo as T (add) import qualified Addone as O (add) - import AddTree as Tree (Node, Leaf) + import AddTree as Tree (sum, Node, Leaf) gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file From ddbae71d06bf2d4779cee87371dd4f2868efee8c Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 20:05:13 -0500 Subject: [PATCH 17/68] added ext parsing --- .../src/Gibbon/Passes/FreshConstructors.hs | 29 ++++++++++++++- .../src/Gibbon/Passes/ModuleFillImports.hs | 36 +++++++++++++++++-- .../src/Gibbon/Passes/ModuleRename.hs | 32 ++++++++++++++++- 3 files changed, 93 insertions(+), 4 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs index 18477ca45..febd2899e 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs @@ -119,7 +119,34 @@ freshConstrsInExp exp constrenv = e2' <- freshConstrsInExp e2 constrenv e3' <- freshConstrsInExp e3 constrenv return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> return $ Ext ext + Ext ext -> case ext of + LambdaE args bod -> do + bod' <- freshConstrsInExp bod constrenv + return $ Ext $ LambdaE args bod' + PolyAppE a b -> do + return $ Ext $ PolyAppE a b + FunRefE tyapps f -> do + return $ Ext $ FunRefE tyapps f + BenchE fn tyapps args b -> do + args' <- mapM (\arg -> freshConstrsInExp arg constrenv) args + return $ Ext $ BenchE fn tyapps args' b + ParE0 ls -> do + ls' <- mapM (\l -> freshConstrsInExp l constrenv) ls + return $ Ext $ ParE0 ls' + PrintPacked ty arg -> do + arg' <- freshConstrsInExp arg constrenv + return $ Ext $ PrintPacked ty arg' + CopyPacked ty arg -> do + arg' <- freshConstrsInExp arg constrenv + return $ Ext $ CopyPacked ty arg' + TravPacked ty arg -> do + arg' <- freshConstrsInExp arg constrenv + return $ Ext $ TravPacked ty arg' + L p e -> do + e' <- freshConstrsInExp e constrenv + return $ Ext $ L p e' + LinearExt a -> do + return $ Ext $ LinearExt a -- diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index df412875c..c95e7760a 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -218,7 +218,7 @@ resolveModInExp exp defenv funenv constrenv = return $ CaseE e' mp' DataConE loc c es -> do - let c' = (fromVar (parseAndResolve (toVar c) constrenv)) + let c' = fromVar (parseAndResolve (toVar c) constrenv) es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es return $ DataConE loc c' es' @@ -242,7 +242,39 @@ resolveModInExp exp defenv funenv constrenv = e2' <- resolveModInExp e2 defenv funenv constrenv e3' <- resolveModInExp e3 defenv funenv constrenv return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> return $ Ext ext + --Ext ext -> return $ Ext ext + Ext ext -> case ext of + LambdaE args bod -> do + bod' <- resolveModInExp bod defenv funenv constrenv + return $ Ext $ LambdaE args bod' + PolyAppE a b -> do + return $ Ext $ PolyAppE a b + FunRefE tyapps f -> do + return $ Ext $ FunRefE tyapps f + BenchE fn tyapps args b -> do + args' <- mapM (\arg -> resolveModInExp arg defenv funenv constrenv) args + return $ Ext $ BenchE fn tyapps args' b + ParE0 ls -> do + ls' <- mapM (\l -> resolveModInExp l defenv funenv constrenv) ls + return $ Ext $ ParE0 ls' + PrintPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv constrenv + return $ Ext $ PrintPacked ty' arg' + CopyPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv constrenv + return $ Ext $ CopyPacked ty' arg' + TravPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv constrenv + return $ Ext $ TravPacked ty' arg' + L p e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ Ext $ L p e' + LinearExt a -> do + return $ Ext $ LinearExt a + -- environment interactions diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 218ad021a..98ccde891 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -176,7 +176,37 @@ resolveModInExp exp defenv funenv = e2' <- resolveModInExp e2 defenv funenv e3' <- resolveModInExp e3 defenv funenv return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> return $ Ext ext + Ext ext -> case ext of + LambdaE args bod -> do + bod' <- resolveModInExp bod defenv funenv + return $ Ext $ LambdaE args bod' + PolyAppE a b -> do + return $ Ext $ PolyAppE a b + FunRefE tyapps f -> do + return $ Ext $ FunRefE tyapps f + BenchE fn tyapps args b -> do + args' <- mapM (\arg -> resolveModInExp arg defenv funenv) args + return $ Ext $ BenchE fn tyapps args' b + ParE0 ls -> do + ls' <- mapM (\l -> resolveModInExp l defenv funenv) ls + return $ Ext $ ParE0 ls' + PrintPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv + return $ Ext $ PrintPacked ty' arg' + CopyPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv + return $ Ext $ CopyPacked ty' arg' + TravPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv + return $ Ext $ TravPacked ty' arg' + L p e -> do + e' <- resolveModInExp e defenv funenv + return $ Ext $ L p e' + LinearExt a -> do + return $ Ext $ LinearExt a -- environment interactions From cd2ec7979629e8c567025674c08d0a6a308983da Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 20:32:19 -0500 Subject: [PATCH 18/68] fixed an issue with LetE --- gibbon-compiler/ir.log | 2270 ----------------- .../src/Gibbon/Passes/ModuleFillImports.hs | 3 +- .../src/Gibbon/Passes/ModuleRename.hs | 6 +- 3 files changed, 5 insertions(+), 2274 deletions(-) delete mode 100644 gibbon-compiler/ir.log diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log deleted file mode 100644 index d7325d4eb..000000000 --- a/gibbon-compiler/ir.log +++ /dev/null @@ -1,2270 +0,0 @@ - ! Responding to env Var: GIBBON_DEBUG=4 - ! We set DEBUG based on command-line verbose arg: 4 -================================================================================ - -desugaring module: AddTree - -- imports: [] - -- aliases: fromList [] - -- imports: fromList [] - - [compiler] pipeline starting, parsed program: -================================================================================ -Prog {ddefs = [(AddTree.Tree, - DDef {tyName = "AddTree.Tree", - tyArgs = [], - dataCons = [("AddTree.Leaf", [(False, IntTy)]), - ("AddTree.Node", - [(False, PackedTy "AddTree.Tree" []), - (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(AddTree.sum, - FunDef {funName = "AddTree.sum", - funArgs = [t], - funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), - funBody = CaseE (VarE "t") - [("AddTree.Leaf", [(v, MetaTv $1)], VarE "v"), - ("AddTree.Node", - [(l, MetaTv $2),(r, MetaTv $3)], - PrimAppE AddP - [AppE "AddTree.sum" [] [VarE "l"], - AppE "AddTree.sum" [] [VarE "r"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing} - - [compiler] Running pass, freshConstructors -Pass output: -================================================================================ -data AddTree.Tree = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree.Tree []) (Packed AddTree.Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree.sum :: forall. ((Packed AddTree.Tree []) -> Int) -AddTree.sum t = - case t of - AddTree_Leaf_4 v::$1 -> - v - AddTree_Node_5 l::$2 r::$3 -> - (AddTree.sum [] l) + (AddTree.sum [] r) - - - [compiler] Running pass, renameModules -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t = - case t of - AddTree_Leaf_4 v::$1 -> - v - AddTree_Node_5 l::$2 r::$3 -> - (AddTree_sum_7 [] l) + (AddTree_sum_7 [] r) - - - [compiler] Running pass, freshen -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::$1 -> - v_9 - AddTree_Node_5 l_10::$2 r_11::$3 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, bindLambdas -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, monomorphize -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, specLambdas -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, desugarL0 -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::() -> - v_9 - AddTree_Node_5 l_10::() r_11::() -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21::() -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 () y_22) - AddTree_Node_5 x_23::() x_24::() -> - let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 () y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28::() -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 () y_29) - AddTree_Node_5 x_30::() x_31::() -> - let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 () y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35::() -> - () - AddTree_Node_5 x_37::() x_38::() -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42::() -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47::() x_48::() -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, floatOutCase -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::() -> - v_9 - AddTree_Node_5 l_10::() r_11::() -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21::() -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 () y_22) - AddTree_Node_5 x_23::() x_24::() -> - let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 () y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28::() -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 () y_29) - AddTree_Node_5 x_30::() x_31::() -> - let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 () y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35::() -> - () - AddTree_Node_5 x_37::() x_38::() -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42::() -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47::() x_48::() -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, toL1 -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, benchMainExp -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, simplify -Removed unused functions: [Var "AddTree_sum_7"] -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59 = - case arg_20_59 of - AddTree_Leaf_4 x_21_60 -> - let y_22_61 :: Int = x_21_60 in - (AddTree_Leaf_4 y_22_61) - AddTree_Node_5 x_23_62 x_24_63 -> - let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in - let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in - (AddTree_Node_5 y_25_64 y_26_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = - case arg_27_66 of - AddTree_Leaf_4 x_28_67 -> - let y_29_68 :: Int = x_28_67 in - (AddTree_Leaf_4 y_29_68) - AddTree_Node_5 x_30_69 x_31_70 -> - let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in - let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in - (AddTree_Node_5 y_32_71 y_33_72) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73 = - case arg_34_73 of - AddTree_Leaf_4 x_35_74 -> - () - AddTree_Node_5 x_37_75 x_38_76 -> - let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in - let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79 = - case arg_41_79 of - AddTree_Leaf_4 x_42_80 -> - let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82 :: () = printsym(" ") in - let y_43_83 :: () = printint(x_42_80) in - let wildcard_45_84 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85 x_48_86 -> - let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88 :: () = printsym(" ") in - let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in - let wildcard_53_90 :: () = printsym(" ") in - let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in - let wildcard_52_92 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59 = - case arg_20_59 of - AddTree_Leaf_4 x_21_60 -> - let y_22_61 :: Int = x_21_60 in - (AddTree_Leaf_4 y_22_61) - AddTree_Node_5 x_23_62 x_24_63 -> - let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in - let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in - (AddTree_Node_5 y_25_64 y_26_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = - case arg_27_66 of - AddTree_Leaf_4 x_28_67 -> - let y_29_68 :: Int = x_28_67 in - (AddTree_Leaf_4 y_29_68) - AddTree_Node_5 x_30_69 x_31_70 -> - let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in - let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in - (AddTree_Node_5 y_32_71 y_33_72) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73 = - case arg_34_73 of - AddTree_Leaf_4 x_35_74 -> - () - AddTree_Node_5 x_37_75 x_38_76 -> - let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in - let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79 = - case arg_41_79 of - AddTree_Leaf_4 x_42_80 -> - let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82 :: () = printsym(" ") in - let y_43_83 :: () = printint(x_42_80) in - let wildcard_45_84 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85 x_48_86 -> - let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88 :: () = printsym(" ") in - let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in - let wildcard_53_90 :: () = printsym(" ") in - let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in - let wildcard_52_92 :: () = printsym(")") in - () - - - [compiler] Running pass, flatten -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59 = - case arg_20_59 of - AddTree_Leaf_4 x_21_60 -> - let y_22_61 :: Int = x_21_60 in - (AddTree_Leaf_4 y_22_61) - AddTree_Node_5 x_23_62 x_24_63 -> - let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in - let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in - (AddTree_Node_5 y_25_64 y_26_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = - case arg_27_66 of - AddTree_Leaf_4 x_28_67 -> - let y_29_68 :: Int = x_28_67 in - (AddTree_Leaf_4 y_29_68) - AddTree_Node_5 x_30_69 x_31_70 -> - let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in - let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in - (AddTree_Node_5 y_32_71 y_33_72) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73 = - case arg_34_73 of - AddTree_Leaf_4 x_35_74 -> - () - AddTree_Node_5 x_37_75 x_38_76 -> - let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in - let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79 = - case arg_41_79 of - AddTree_Leaf_4 x_42_80 -> - let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82 :: () = printsym(" ") in - let y_43_83 :: () = printint(x_42_80) in - let wildcard_45_84 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85 x_48_86 -> - let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88 :: () = printsym(" ") in - let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in - let wildcard_53_90 :: () = printsym(" ") in - let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in - let wildcard_52_92 :: () = printsym(")") in - () - - - [compiler] Running pass, simplify -Removed unused functions: [] -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - let y_22_61_95 :: Int = x_21_60_94 in - (AddTree_Leaf_4 y_22_61_95) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - let y_29_68_102 :: Int = x_28_67_101 in - (AddTree_Leaf_4 y_29_68_102) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, inlineTriv -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, directL3 -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, unariser -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.flatten -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, lower -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_6", - [("AddTree_Leaf_4", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("AddTree_Node_5", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), - (129, "(AddTree_Leaf_4"),(130, " ")], - fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", - funArgs = [(arg_20_59_93, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), - (tail_132, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_20_59_93"], - bod = Switch "switch_135" - (VarTriv "tag_131") - (IntAlts [(0, - LetUnpackT {binds = [(x_21_60_94, - IntTy)], - ptr = "tail_132", - bod = LetAllocT {lhs = "tailift_133", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_21_60_94")], - bod = RetValsT [VarTriv "tailift_133"]}}), - (1, - LetUnpackT {binds = [(x_23_62_96, - CursorTy), - (x_24_63_97, - CursorTy)], - ptr = "tail_132", - bod = LetCallT {async = False, - binds = [(y_25_64_98, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_23_62_96"], - bod = LetCallT {async = False, - binds = [(y_26_65_99, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_24_63_97"], - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_25_64_98"), - (CursorTy, - VarTriv "y_26_65_99")], - bod = RetValsT [VarTriv "tailift_134"]}}}})]) - (Just ErrT "Unknown tag in: tag_131")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", - funArgs = [(arg_27_66_100, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), - (tail_137, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_27_66_100"], - bod = Switch "switch_140" - (VarTriv "tag_136") - (IntAlts [(0, - LetUnpackT {binds = [(x_28_67_101, - IntTy)], - ptr = "tail_137", - bod = LetAllocT {lhs = "tailift_138", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_28_67_101")], - bod = RetValsT [VarTriv "tailift_138"]}}), - (1, - LetUnpackT {binds = [(x_30_69_103, - CursorTy), - (x_31_70_104, - CursorTy)], - ptr = "tail_137", - bod = LetCallT {async = False, - binds = [(y_32_71_105, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_30_69_103"], - bod = LetCallT {async = False, - binds = [(y_33_72_106, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_31_70_104"], - bod = LetAllocT {lhs = "tailift_139", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_32_71_105"), - (CursorTy, - VarTriv "y_33_72_106")], - bod = RetValsT [VarTriv "tailift_139"]}}}})]) - (Just ErrT "Unknown tag in: tag_136")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_6", - funArgs = [(arg_34_73_107, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), - (tail_142, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_34_73_107"], - bod = Switch "switch_143" - (VarTriv "tag_141") - (IntAlts [(0, - LetUnpackT {binds = [(x_35_74_108, - IntTy)], - ptr = "tail_142", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_37_75_109, - CursorTy), - (x_38_76_110, - CursorTy)], - ptr = "tail_142", - bod = LetCallT {async = False, - binds = [(y_39_77_111, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_37_75_109"], - bod = LetCallT {async = False, - binds = [(y_40_78_112, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_38_76_110"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_141")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_6", - funArgs = [(arg_41_79_113, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), - (tail_145, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_41_79_113"], - bod = Switch "switch_146" - (VarTriv "tag_144") - (IntAlts [(0, - LetUnpackT {binds = [(x_42_80_114, - IntTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_44_81_115, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 129], - bod = LetPrimCallT {binds = [(wildcard_46_82_116, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetPrimCallT {binds = [(y_43_83_117, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_42_80_114"], - bod = LetPrimCallT {binds = [(wildcard_45_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_47_85_119, - CursorTy), - (x_48_86_120, - CursorTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_51_87_121, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 128], - bod = LetPrimCallT {binds = [(wildcard_54_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_49_89_123, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_47_85_119"], - bod = LetPrimCallT {binds = [(wildcard_53_90_124, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_50_91_125, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_48_86_120"], - bod = LetPrimCallT {binds = [(wildcard_52_92_126, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_144")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Running pass, lateInlineTriv -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_6", - [("AddTree_Leaf_4", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("AddTree_Node_5", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), - (129, "(AddTree_Leaf_4"),(130, " ")], - fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", - funArgs = [(arg_20_59_93, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), - (tail_132, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_20_59_93"], - bod = Switch "switch_135" - (VarTriv "tag_131") - (IntAlts [(0, - LetUnpackT {binds = [(x_21_60_94, - IntTy)], - ptr = "tail_132", - bod = LetAllocT {lhs = "tailift_133", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_21_60_94")], - bod = RetValsT [VarTriv "tailift_133"]}}), - (1, - LetUnpackT {binds = [(x_23_62_96, - CursorTy), - (x_24_63_97, - CursorTy)], - ptr = "tail_132", - bod = LetCallT {async = False, - binds = [(y_25_64_98, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_23_62_96"], - bod = LetCallT {async = False, - binds = [(y_26_65_99, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_24_63_97"], - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_25_64_98"), - (CursorTy, - VarTriv "y_26_65_99")], - bod = RetValsT [VarTriv "tailift_134"]}}}})]) - (Just ErrT "Unknown tag in: tag_131")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", - funArgs = [(arg_27_66_100, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), - (tail_137, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_27_66_100"], - bod = Switch "switch_140" - (VarTriv "tag_136") - (IntAlts [(0, - LetUnpackT {binds = [(x_28_67_101, - IntTy)], - ptr = "tail_137", - bod = LetAllocT {lhs = "tailift_138", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_28_67_101")], - bod = RetValsT [VarTriv "tailift_138"]}}), - (1, - LetUnpackT {binds = [(x_30_69_103, - CursorTy), - (x_31_70_104, - CursorTy)], - ptr = "tail_137", - bod = LetCallT {async = False, - binds = [(y_32_71_105, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_30_69_103"], - bod = LetCallT {async = False, - binds = [(y_33_72_106, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_31_70_104"], - bod = LetAllocT {lhs = "tailift_139", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_32_71_105"), - (CursorTy, - VarTriv "y_33_72_106")], - bod = RetValsT [VarTriv "tailift_139"]}}}})]) - (Just ErrT "Unknown tag in: tag_136")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_6", - funArgs = [(arg_34_73_107, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), - (tail_142, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_34_73_107"], - bod = Switch "switch_143" - (VarTriv "tag_141") - (IntAlts [(0, - LetUnpackT {binds = [(x_35_74_108, - IntTy)], - ptr = "tail_142", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_37_75_109, - CursorTy), - (x_38_76_110, - CursorTy)], - ptr = "tail_142", - bod = LetCallT {async = False, - binds = [(y_39_77_111, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_37_75_109"], - bod = LetCallT {async = False, - binds = [(y_40_78_112, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_38_76_110"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_141")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_6", - funArgs = [(arg_41_79_113, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), - (tail_145, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_41_79_113"], - bod = Switch "switch_146" - (VarTriv "tag_144") - (IntAlts [(0, - LetUnpackT {binds = [(x_42_80_114, - IntTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_44_81_115, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 129], - bod = LetPrimCallT {binds = [(wildcard_46_82_116, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetPrimCallT {binds = [(y_43_83_117, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_42_80_114"], - bod = LetPrimCallT {binds = [(wildcard_45_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_47_85_119, - CursorTy), - (x_48_86_120, - CursorTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_51_87_121, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 128], - bod = LetPrimCallT {binds = [(wildcard_54_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_49_89_123, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_47_85_119"], - bod = LetPrimCallT {binds = [(wildcard_53_90_124, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_50_91_125, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_48_86_120"], - bod = LetPrimCallT {binds = [(wildcard_52_92_126, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_144")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Running pass, rearrangeFree -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_6", - [("AddTree_Leaf_4", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("AddTree_Node_5", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), - (129, "(AddTree_Leaf_4"),(130, " ")], - fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", - funArgs = [(arg_20_59_93, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), - (tail_132, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_20_59_93"], - bod = Switch "switch_135" - (VarTriv "tag_131") - (IntAlts [(0, - LetUnpackT {binds = [(x_21_60_94, - IntTy)], - ptr = "tail_132", - bod = LetAllocT {lhs = "tailift_133", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_21_60_94")], - bod = RetValsT [VarTriv "tailift_133"]}}), - (1, - LetUnpackT {binds = [(x_23_62_96, - CursorTy), - (x_24_63_97, - CursorTy)], - ptr = "tail_132", - bod = LetCallT {async = False, - binds = [(y_25_64_98, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_23_62_96"], - bod = LetCallT {async = False, - binds = [(y_26_65_99, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_24_63_97"], - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_25_64_98"), - (CursorTy, - VarTriv "y_26_65_99")], - bod = RetValsT [VarTriv "tailift_134"]}}}})]) - (Just ErrT "Unknown tag in: tag_131")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", - funArgs = [(arg_27_66_100, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), - (tail_137, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_27_66_100"], - bod = Switch "switch_140" - (VarTriv "tag_136") - (IntAlts [(0, - LetUnpackT {binds = [(x_28_67_101, - IntTy)], - ptr = "tail_137", - bod = LetAllocT {lhs = "tailift_138", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_28_67_101")], - bod = RetValsT [VarTriv "tailift_138"]}}), - (1, - LetUnpackT {binds = [(x_30_69_103, - CursorTy), - (x_31_70_104, - CursorTy)], - ptr = "tail_137", - bod = LetCallT {async = False, - binds = [(y_32_71_105, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_30_69_103"], - bod = LetCallT {async = False, - binds = [(y_33_72_106, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_31_70_104"], - bod = LetAllocT {lhs = "tailift_139", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_32_71_105"), - (CursorTy, - VarTriv "y_33_72_106")], - bod = RetValsT [VarTriv "tailift_139"]}}}})]) - (Just ErrT "Unknown tag in: tag_136")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_6", - funArgs = [(arg_34_73_107, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), - (tail_142, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_34_73_107"], - bod = Switch "switch_143" - (VarTriv "tag_141") - (IntAlts [(0, - LetUnpackT {binds = [(x_35_74_108, - IntTy)], - ptr = "tail_142", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_37_75_109, - CursorTy), - (x_38_76_110, - CursorTy)], - ptr = "tail_142", - bod = LetCallT {async = False, - binds = [(y_39_77_111, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_37_75_109"], - bod = LetCallT {async = False, - binds = [(y_40_78_112, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_38_76_110"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_141")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_6", - funArgs = [(arg_41_79_113, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), - (tail_145, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_41_79_113"], - bod = Switch "switch_146" - (VarTriv "tag_144") - (IntAlts [(0, - LetUnpackT {binds = [(x_42_80_114, - IntTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_44_81_115, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 129], - bod = LetPrimCallT {binds = [(wildcard_46_82_116, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetPrimCallT {binds = [(y_43_83_117, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_42_80_114"], - bod = LetPrimCallT {binds = [(wildcard_45_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_47_85_119, - CursorTy), - (x_48_86_120, - CursorTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_51_87_121, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 128], - bod = LetPrimCallT {binds = [(wildcard_54_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_49_89_123, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_47_85_119"], - bod = LetPrimCallT {binds = [(wildcard_53_90_124, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_50_91_125, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_48_86_120"], - bod = LetPrimCallT {binds = [(wildcard_52_92_126, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_144")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Final C codegen: 9069 characters. -================================================================================ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef struct GibIntProd_struct { - GibInt field0; - } GibIntProd; -typedef struct GibIntGibIntProd_struct { - GibInt field0; - GibInt field1; - } GibIntGibIntProd; -typedef struct GibIntGibCursorGibCursorProd_struct { - GibInt field0; - GibCursor field1; - GibCursor field2; - } GibIntGibCursorGibCursorProd; -typedef struct GibPackedTagGibCursorProd_struct { - GibPackedTag field0; - GibCursor field1; - } GibPackedTagGibCursorProd; -typedef struct GibCursorProd_struct { - GibCursor field0; - } GibCursorProd; -typedef struct GibCursorGibCursorProd_struct { - GibCursor field0; - GibCursor field1; - } GibCursorGibCursorProd; -GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93); -GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100); -unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107); -unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113); -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - AddTree_Tree_6_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(8); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[1]; - - error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 0, 8, 0, 1, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_6_T, 0); - exit(1); - } - error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 1, 0, 2, 0, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_6_T, 1); - exit(1); - } - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ - gib_add_symbol(127, ")"); - gib_add_symbol(128, "(AddTree_Node_5"); - gib_add_symbol(129, "(AddTree_Leaf_4"); - gib_add_symbol(130, " "); -} -GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93) -{ - GibPackedTag tag_131 = *(GibPackedTag *) arg_20_59_93; - GibCursor tail_132 = arg_20_59_93 + sizeof(GibInt); - - - switch_135: - ; - switch (tag_131) { - - case 0: - { - GibInt x_21_60_94 = ((GibIntProd *) tail_132)->field0; - GibPtr tailift_133 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_133)->field0 = 0; - ((GibIntGibIntProd *) tailift_133)->field1 = x_21_60_94; - return tailift_133; - break; - } - - case 1: - { - GibCursor x_23_62_96 = - ((GibCursorGibCursorProd *) tail_132)->field0; - GibCursor x_24_63_97 = - ((GibCursorGibCursorProd *) tail_132)->field1; - GibCursor y_25_64_98 = _copy_AddTree_Tree_6(x_23_62_96); - GibCursor y_26_65_99 = _copy_AddTree_Tree_6(x_24_63_97); - GibPtr tailift_134 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_134)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_134)->field1 = y_25_64_98; - ((GibIntGibCursorGibCursorProd *) tailift_134)->field2 = y_26_65_99; - return tailift_134; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_131"); - exit(1); - } - } -} -GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100) -{ - GibPackedTag tag_136 = *(GibPackedTag *) arg_27_66_100; - GibCursor tail_137 = arg_27_66_100 + sizeof(GibInt); - - - switch_140: - ; - switch (tag_136) { - - case 0: - { - GibInt x_28_67_101 = ((GibIntProd *) tail_137)->field0; - GibPtr tailift_138 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_138)->field0 = 0; - ((GibIntGibIntProd *) tailift_138)->field1 = x_28_67_101; - return tailift_138; - break; - } - - case 1: - { - GibCursor x_30_69_103 = - ((GibCursorGibCursorProd *) tail_137)->field0; - GibCursor x_31_70_104 = - ((GibCursorGibCursorProd *) tail_137)->field1; - GibCursor y_32_71_105 = - _copy_without_ptrs_AddTree_Tree_6(x_30_69_103); - GibCursor y_33_72_106 = - _copy_without_ptrs_AddTree_Tree_6(x_31_70_104); - GibPtr tailift_139 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_139)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_139)->field1 = - y_32_71_105; - ((GibIntGibCursorGibCursorProd *) tailift_139)->field2 = - y_33_72_106; - return tailift_139; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_136"); - exit(1); - } - } -} -unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107) -{ - GibPackedTag tag_141 = *(GibPackedTag *) arg_34_73_107; - GibCursor tail_142 = arg_34_73_107 + sizeof(GibInt); - - - switch_143: - ; - switch (tag_141) { - - case 0: - { - GibInt x_35_74_108 = ((GibIntProd *) tail_142)->field0; - - return 0; - break; - } - - case 1: - { - GibCursor x_37_75_109 = - ((GibCursorGibCursorProd *) tail_142)->field0; - GibCursor x_38_76_110 = - ((GibCursorGibCursorProd *) tail_142)->field1; - unsigned char y_39_77_111 = _traverse_AddTree_Tree_6(x_37_75_109); - unsigned char y_40_78_112 = _traverse_AddTree_Tree_6(x_38_76_110); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_141"); - exit(1); - } - } -} -unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113) -{ - GibPackedTag tag_144 = *(GibPackedTag *) arg_41_79_113; - GibCursor tail_145 = arg_41_79_113 + sizeof(GibInt); - - - switch_146: - ; - switch (tag_144) { - - case 0: - { - GibInt x_42_80_114 = ((GibIntProd *) tail_145)->field0; - unsigned char wildcard_44_81_115 = gib_print_symbol(129); - unsigned char wildcard_46_82_116 = gib_print_symbol(130); - unsigned char y_43_83_117 = printf("%ld", x_42_80_114); - unsigned char wildcard_45_84_118 = gib_print_symbol(127); - - return 0; - break; - } - - case 1: - { - GibCursor x_47_85_119 = - ((GibCursorGibCursorProd *) tail_145)->field0; - GibCursor x_48_86_120 = - ((GibCursorGibCursorProd *) tail_145)->field1; - unsigned char wildcard_51_87_121 = gib_print_symbol(128); - unsigned char wildcard_54_88_122 = gib_print_symbol(130); - unsigned char y_49_89_123 = _print_AddTree_Tree_6(x_47_85_119); - unsigned char wildcard_53_90_124 = gib_print_symbol(130); - unsigned char y_50_91_125 = _print_AddTree_Tree_6(x_48_86_120); - unsigned char wildcard_52_92_126 = gib_print_symbol(127); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_144"); - exit(1); - } - } -} -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - int exit_1 = gib_exit(); - - return exit_1; -} - -Compiling RTS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 - -codegen: C RTS could not be compiled: -make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory -make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. - -Code: 2 diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index c95e7760a..676b24234 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -191,9 +191,10 @@ resolveModInExp exp defenv funenv constrenv = return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do + let ty' = resolveModInTy ty defenv e1' <- resolveModInExp e1 defenv funenv constrenv e2' <- resolveModInExp e2 defenv funenv constrenv - return $ LetE (v, [], ty, e1') e2' + return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do e1' <- resolveModInExp e1 defenv funenv constrenv diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 98ccde891..34472f7bd 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -118,8 +118,7 @@ resolveModInExp exp defenv funenv = VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) AppE v locs ls -> do - let (mod, fun) = parseOutMod v - let v' = resolveNameInEnv mod fun funenv + let v' = parseAndResolve v funenv ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls return $ AppE v' locs ls' @@ -128,9 +127,10 @@ resolveModInExp exp defenv funenv = return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do + let ty' = resolveModInTy ty defenv e1' <- resolveModInExp e1 defenv funenv e2' <- resolveModInExp e2 defenv funenv - return $ LetE (v, [], ty, e1') e2' + return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do e1' <- resolveModInExp e1 defenv funenv From b1147412aa97cf189e8b6e49055742e80f3e0d82 Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 21:09:24 -0500 Subject: [PATCH 19/68] some oddness --- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 1 + gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 66c9aaa22..ca6369e7b 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -323,6 +323,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports (defs'', funs''''') imported_progs' return $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + dbgPrintLn 2 $ "===" pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 676b24234..1f7671a93 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -40,7 +40,8 @@ fillImports (Prog defs funs main) localMod imports imported_progs = Just spec -> if (elem name spec) then acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] else acc Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] - Nothing -> error $ "could not find module or alias: " ++ (show modName) + --Nothing -> error $ "could not find module or alias: " ++ (show modName) ++ " for name " ++ (show v) ++ " in " ++ (show importMeta) + Nothing -> acc Nothing -> error "how did we get here?" let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs From 2f4992cb94b784fbe297aee5e45525874aa0cc82 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 11 Jan 2024 07:13:08 -0500 Subject: [PATCH 20/68] more bug fixing --- gibbon-compiler/examples/imports/failing.md | 61 +++++++++++++++++++ gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 17 +++--- .../src/Gibbon/Passes/ModuleFillImports.hs | 34 ++++++++--- .../src/Gibbon/Passes/ModuleRename.hs | 20 ++++-- 4 files changed, 110 insertions(+), 22 deletions(-) create mode 100644 gibbon-compiler/examples/imports/failing.md diff --git a/gibbon-compiler/examples/imports/failing.md b/gibbon-compiler/examples/imports/failing.md new file mode 100644 index 000000000..cf4309c80 --- /dev/null +++ b/gibbon-compiler/examples/imports/failing.md @@ -0,0 +1,61 @@ +# Poly +### `/poly/Poly1.hs` + +Problem seems to be with the type names, numbers and Nothing, Cons, Nil, Right all match + +``` +< '#(10 #t 11 #f 2 4 (Poly1_Nothing_77_v_323) (Poly1_Right_76_v_342 20) (Poly1_Right_76_v_334 1) 12 #f 0 3 (Poly1_Cons_74_v_329 1 (Poly1_Cons_74_v_329 2 (Poly1_Nil_73_v_329))) (Poly1_Cons_74_v_329 1 (Poly1_Cons_74_v_329 2 (Poly1_Nil_73_v_329))) (Poly1_Right_76_v_334 1) (Poly1_Cons_74_v_329 11 (Poly1_Cons_74_v_329 12 (Poly1_Nil_73_v_329)))) +--- +> '#(10 #t 11 #f 2 4 (Nothing_v_295 ) (Right_v_315 20) (Right_v_306 1) 12 #f 0 3 (Cons_v_301 1(Cons_v_301 2(Nil_v_301 ))) (Cons_v_301 1(Cons_v_301 2(Nil_v_301 ))) (Right_v_306 1) (Cons_v_301 11(Cons_v_301 12(Nil_v_301 )))) +\ No newline at end of file +``` + +# Eval l/r +### `eval_l.hs` + +### `eval_r.hs` + +these are failing to properly import a module in interp mode this seems to stem from the fact the the imported file does not have a module declaration,,, so internally it renames with "Main" but the true Main module expects "Eval" b/c that's the name in the import statement. + +solving this by having the Main module tell each imported module how to name themselves ... this I think could get convoluted b/c a module decalred internally as A could be imported as B ... perhaps a subjective design decision but this seems to work + +# ArrowTy +### `layout1ContentSearch.hs` +``` +Couldn't match type 'ArrowTy [VectorTy (MetaTv $839)] + IntTy' with 'IntTy' + Expected type: IntTy + Actual type: ArrowTy [VectorTy (MetaTv $839)] IntTy + In the expression: + VarE "Gibbon_Vector_length_132" in Var "GenerateLayout1_mkBlogs_layout1_107" +``` + +This all seems to come from a similair pattern but it looks like the bug doesn't have anything to do with the error. The issue is scope: `Gibbon_Vector_length_132` is some global name but there is a `length` that is one of the function arguements. The rename pass matches length to the global function, causing the error. My solution was to force the global name to be qualified within the scope where `length` exists. So the global `Gibbon.Vector.length` can be accessed if qualified, but simple reference to `length` will use the function arguement `length` + +### `layout1ContentSearchRunPipeline.hs` + +### `layout1FilterBlogs.hs` + +### `layout1TagSearch.hs` + +### `layout2ContentSearch.hs` + +### `layout2FilterBlogs.hs` + +### `layout2TagSearch.hs` + +### `layout3ContentSearch.hs` + +### `layout3FilterBlogs.hs` + +### `layout3TagSearch.hs` + +### `layout4ContentSearch.hs` + +### `layout4FilterBlogs.hs` + +### `layout4TagSearch.hs` + +### `layout5ContentSearch.hs` + +### `layout5FilterBlogs.hs` \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index ca6369e7b..4cbb3da7d 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -68,7 +68,7 @@ it expects A.B.D to be at A/B/A/B/D.hs. parseFile :: Config -> FilePath -> IO (PassM Prog0) parseFile cfg path = do pstate0_ref <- newIORef emptyParseState - parseFile' cfg pstate0_ref [] path + parseFile' cfg pstate0_ref [] path "Main" data ParseState = ParseState @@ -90,8 +90,8 @@ parseMode = } parseFile' :: - Config -> IORef ParseState -> [String] -> FilePath -> IO (PassM Prog0) -parseFile' cfg pstate_ref import_route path = do + Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM Prog0) +parseFile' cfg pstate_ref import_route path mod_name = do when (gopt Opt_GhcTc (dynflags cfg)) $ typecheckWithGhc cfg path str <- readFile path let cleaned = removeLinearArrows str @@ -100,7 +100,7 @@ parseFile' cfg pstate_ref import_route path = do parseFileContentsWithCommentsAndCPP defaultCpphsOptions parseMode cleaned case parsed of ParseOk (hs, _comments) -> - desugarModule cfg pstate_ref import_route (takeDirectory path) hs + desugarModule cfg pstate_ref import_route (takeDirectory path) hs mod_name ParseFailed loc er -> do error ("haskell-src-exts failed: " ++ er ++ ", at " ++ prettyPrint loc) @@ -222,8 +222,9 @@ desugarModule :: -> [String] -> FilePath -> Module a + -> String -> IO (PassM Prog0) -desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) = do +desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) mod_name = do let type_syns = foldl collectTypeSynonyms M.empty decls -- Since top-level functions and their types can't be declared in -- single top-level declaration we first collect types and then collect @@ -327,7 +328,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) - mod_name = moduleName head_mb + --mod_name = moduleName head_mb import_names = (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ _ _) -> importName) imports) aliases = M.fromList (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ aliased _) -> @@ -439,7 +440,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports in case element of Nothing -> fn Just dcon -> fn {funMeta = funMeta {funOptLayout = Single dcon}} -desugarModule _ _ _ _ m = error $ "desugarModule: " ++ prettyPrint m +desugarModule _ _ _ _ m _ = error $ "desugarModule: " ++ prettyPrint m stdlibModules :: [String] stdlibModules = @@ -488,7 +489,7 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} pure prog Nothing -> do dbgTrace 5 ("Importing " ++ mod_name ++ " from " ++ mod_fp) (pure ()) - prog0 <- parseFile' cfg pstate_ref import_route mod_fp + prog0 <- parseFile' cfg pstate_ref import_route mod_fp mod_name (ParseState imported') <- readIORef pstate_ref let (prog0', _) = defaultRunPassM prog0 let imported'' = M.insert (mod_name, mod_fp) prog0' imported' diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 1f7671a93..836a32d42 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -41,7 +41,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = else acc Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] --Nothing -> error $ "could not find module or alias: " ++ (show modName) ++ " for name " ++ (show v) ++ " in " ++ (show importMeta) - Nothing -> acc + Nothing -> acc ++ [(name, (v, False))] Nothing -> error "how did we get here?" let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs @@ -78,8 +78,8 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- main main' <- case main of Nothing -> return Nothing - Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) - m' <- resolveModInExp m defenv funenv constrenv + Just (m,ty) -> do --error $ "fun env: " ++ (show importedFuns) ++ "\n import meta" ++ (show importMeta) + m' <- (resolveModInExp m defenv funenv constrenv) return $ Just (m',ty) @@ -133,7 +133,8 @@ resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv constrenv = do let nam' = parseAndResolve nam funenv let funty' = resolveModsInTyScheme funty defenv - bod' <- resolveModInExp bod defenv funenv constrenv + let funenv' = foldr appendEnv funenv nargs + bod' <- resolveModInExp bod defenv funenv' constrenv pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme @@ -163,7 +164,7 @@ resolveModInTy ty defenv = ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) - ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) $ resolveModInTy t defenv + ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) (resolveModInTy t defenv) PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys @@ -184,7 +185,7 @@ resolveModInExp exp defenv funenv constrenv = AppE v locs ls -> do let v' = parseAndResolve v funenv - ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls + ls' <- traverse (\e -> resolveModInExp e defenv funenv constrenv) ls return $ AppE v' locs ls' PrimAppE p es -> do @@ -192,9 +193,10 @@ resolveModInExp exp defenv funenv constrenv = return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do + let funenv' = appendEnv v funenv let ty' = resolveModInTy ty defenv - e1' <- resolveModInExp e1 defenv funenv constrenv - e2' <- resolveModInExp e2 defenv funenv constrenv + e1' <- resolveModInExp e1 defenv funenv' constrenv + e2' <- resolveModInExp e2 defenv funenv' constrenv return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do @@ -281,6 +283,20 @@ resolveModInExp exp defenv funenv constrenv = -- environment interactions +appendEnv :: Var -> VarEnv -> VarEnv +appendEnv v env = + case (M.lookup v env) of + Just m -> case foldr findUnqualified (False, "") m of + (True, n) -> do + let (mod, _) = parseOutMod n + case mod of + Just modname -> do + (M.insert v (M.insert (toVar "") (v, False) (M.insert modname (n, True) m)) env) + Nothing -> do + (M.insert v (M.insert (toVar "") (v, False) m) env) + (False, _) -> (M.insert v (M.insert (toVar "") (v, False) m) env) + Nothing -> (M.insert v (M.singleton (toVar "") (v, False)) env) + buildEnv :: VarEnv -> Var -> (Var, Bool) -> (VarEnv, (Var, Bool)) buildEnv env k v = do let (mod, name) = parseOutMod k @@ -323,5 +339,5 @@ resolveNameInEnv mod name e = findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) findUnqualified (n, q) (acc, out) = if (not q) && (not acc) then (True, n) - else if (not q) && acc then error $ "Ambiguous reference" + else if (not q) && acc then error $ "Ambiguous reference : " ++ (fromVar n) ++ " and " ++ (fromVar out) else (acc, out) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 34472f7bd..7a4c92b99 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -69,7 +69,8 @@ resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = do let nam' = parseAndResolve nam funenv let funty' = resolveModsInTyScheme funty defenv - bod' <- resolveModInExp bod defenv funenv + let funenv' = foldr appendEnv funenv nargs + bod' <- resolveModInExp bod defenv funenv' pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme @@ -128,8 +129,9 @@ resolveModInExp exp defenv funenv = LetE (v,_locs,ty, e1) e2 -> do let ty' = resolveModInTy ty defenv - e1' <- resolveModInExp e1 defenv funenv - e2' <- resolveModInExp e2 defenv funenv + let funenv' = appendEnv v funenv + e1' <- resolveModInExp e1 defenv funenv' + e2' <- resolveModInExp e2 defenv funenv' return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do @@ -211,6 +213,12 @@ resolveModInExp exp defenv funenv = -- environment interactions +appendEnv :: Var -> VarEnv -> VarEnv +appendEnv v env = + case (M.lookup v env) of + Just m -> (M.insert v (M.insert (toVar "") v m) env) + Nothing -> (M.insert v (M.singleton (toVar "") v) env) + buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) buildEnv env k v = do let (mod, name) = parseOutMod k @@ -242,8 +250,10 @@ resolveNameInEnv mod name e = Just m -> case (M.lookup m modspace) of Just n -> n Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) - Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find " ++ (fromVar name) + Nothing -> case (M.lookup (toVar "") modspace) of + Just n -> n + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find/ambiguous reference " ++ (fromVar name) Nothing -> case mod of Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) Nothing -> name From 19d4a65fecba0083d1851dabea677ab0e21f89dc Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 11 Jan 2024 08:43:44 -0500 Subject: [PATCH 21/68] add fixed linear ext handling --- .../src/Gibbon/Passes/ModuleFillImports.hs | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 836a32d42..ae9db7746 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -41,7 +41,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = else acc Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] --Nothing -> error $ "could not find module or alias: " ++ (show modName) ++ " for name " ++ (show v) ++ " in " ++ (show importMeta) - Nothing -> acc ++ [(name, (v, False))] + Nothing -> acc ++ [(v, (v, False))] Nothing -> error "how did we get here?" let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs @@ -78,7 +78,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- main main' <- case main of Nothing -> return Nothing - Just (m,ty) -> do --error $ "fun env: " ++ (show importedFuns) ++ "\n import meta" ++ (show importMeta) + Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) m' <- (resolveModInExp m defenv funenv constrenv) return $ Just (m',ty) @@ -131,11 +131,11 @@ resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM (FunDef Exp0) resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv constrenv = do - let nam' = parseAndResolve nam funenv - let funty' = resolveModsInTyScheme funty defenv - let funenv' = foldr appendEnv funenv nargs - bod' <- resolveModInExp bod defenv funenv' constrenv - pure $ FunDef nam' nargs funty' bod' meta + let nam' = parseAndResolve nam funenv + let funty' = resolveModsInTyScheme funty defenv + let funenv' = foldr appendEnv funenv nargs + bod' <- resolveModInExp bod defenv funenv' constrenv + pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme resolveModsInTyScheme (ForAll tvs ty) defenv = do @@ -276,8 +276,22 @@ resolveModInExp exp defenv funenv constrenv = L p e -> do e' <- resolveModInExp e defenv funenv constrenv return $ Ext $ L p e' - LinearExt a -> do - return $ Ext $ LinearExt a + LinearExt a -> case a of + ReverseAppE e1 e2 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + return $ Ext $ LinearExt (ReverseAppE e1' e2') + LseqE e1 e2 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + return $ Ext $ LinearExt (ReverseAppE e1' e2') + AliasE e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ Ext $ LinearExt (AliasE e') + ToLinearE e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ Ext $ LinearExt (ToLinearE e') + @@ -320,6 +334,7 @@ parseOutMod v = do case (L.elemIndices '.' str) of [] -> (Nothing, v) x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) + --x -> (Just (toVar (L.drop ((L.last x)+1) str)), (toVar (L.take (L.last x) str))) resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var resolveNameInEnv mod name e = From 9bc6837afb30bc8e662dbbea512f06892f071de4 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 11 Jan 2024 09:54:56 -0500 Subject: [PATCH 22/68] let _default contructors pass through --- gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs index febd2899e..15d169e94 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs @@ -155,4 +155,4 @@ resolveNameInEnv name e = do case (M.lookup name e) of --Just freshName -> (toVar ((fromVar freshName) ++ "*")) Just freshName -> freshName - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in constructor env: " ++ (show e) \ No newline at end of file + Nothing -> name --error $ "can't find " ++ (fromVar name) ++ " in constructor env: " ++ (show e) \ No newline at end of file From 09c85cb7883900dceda7a96f687a083002ff1441 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 25 Oct 2023 08:09:25 -0700 Subject: [PATCH 23/68] collision example --- IR.log | 2308 +++++++++++++++++ benchmarks/AddImport.c | 93 + benchmarks/Addone.c | 76 + benchmarks/Addtwo.c | 76 + gibbon-compiler/IR.log | 3 + gibbon-compiler/examples/Addone.hs | 10 + gibbon-compiler/examples/Addtwo.hs | 10 + gibbon-compiler/examples/addimport.hs | 7 + .../src/Gibbon/Passes/ModuleRename.hs | 423 +++ 9 files changed, 3006 insertions(+) create mode 100644 IR.log create mode 100644 benchmarks/AddImport.c create mode 100644 benchmarks/Addone.c create mode 100644 benchmarks/Addtwo.c create mode 100644 gibbon-compiler/IR.log create mode 100644 gibbon-compiler/examples/Addone.hs create mode 100644 gibbon-compiler/examples/Addtwo.hs create mode 100644 gibbon-compiler/examples/addimport.hs create mode 100644 gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs diff --git a/IR.log b/IR.log new file mode 100644 index 000000000..5baf44ccb --- /dev/null +++ b/IR.log @@ -0,0 +1,2308 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 +cleaned: +module Addimport where + import Addone + import Addtwo + + + main :: Tree + main = Addtwo.add1 2 (Addtwo.add1 (Node (Leaf 1) (Leaf 2))) + +parsed: +ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 8 64, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 4 5 4 5,SrcSpan ".hs" 7 5 7 5,SrcSpan ".hs" 8 5 8 5,SrcSpan ".hs" 8 64 8 64]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 23, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 18 2 23]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 17, srcInfoPoints = []}) "Addimport") Nothing Nothing)) [] [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 18, srcInfoPoints = [SrcSpan ".hs" 3 5 3 11]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 12 3 18, srcInfoPoints = []}) "Addone", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing},ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 5 4 18, srcInfoPoints = [SrcSpan ".hs" 4 5 4 11]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 12 4 18, srcInfoPoints = []}) "Addtwo", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}] [TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 5 7 17, srcInfoPoints = [SrcSpan ".hs" 7 10 7 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 5 7 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 64, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 10 8 64, srcInfoPoints = [SrcSpan ".hs" 8 10 8 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 64, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 25, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) (Qual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) "Addtwo") (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) "add1"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 25, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 25, srcInfoPoints = []}) 2 "2"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 26 8 64, srcInfoPoints = [SrcSpan ".hs" 8 26 8 27,SrcSpan ".hs" 8 63 8 64]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 63, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) (Qual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) "Addtwo") (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 39 8 63, srcInfoPoints = [SrcSpan ".hs" 8 39 8 40,SrcSpan ".hs" 8 62 8 63]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 62, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 53, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 45 8 53, srcInfoPoints = [SrcSpan ".hs" 8 45 8 46,SrcSpan ".hs" 8 52 8 53]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 52, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 51 8 52, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 51 8 52, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 54 8 62, srcInfoPoints = [SrcSpan ".hs" 8 54 8 55,SrcSpan ".hs" 8 61 8 62]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 61, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 60 8 61, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 60 8 61, srcInfoPoints = []}) 2 "2")))))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) + +cleaned: +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) + + +parsed: +ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 12 0, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 5 5 5 5,SrcSpan ".hs" 6 5 6 5,SrcSpan ".hs" 10 5 10 5,SrcSpan ".hs" 11 5 11 5,SrcSpan ".hs" 12 1 12 0]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 20, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 15 2 20]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Addone") Nothing Nothing)) [] [] [DataDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 42, srcInfoPoints = [SrcSpan ".hs" 3 15 3 16,SrcSpan ".hs" 3 26 3 27]}) (DataType (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 9, srcInfoPoints = []})) Nothing (DHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) "Tree")) [QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 21, srcInfoPoints = []}) "Leaf") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) "Int"))]),QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 32, srcInfoPoints = []}) "Node") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) "Tree")),TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) "Tree"))])] [],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 25, srcInfoPoints = [SrcSpan ".hs" 5 10 5 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 9, srcInfoPoints = []}) "add1"] (TyFun (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 25, srcInfoPoints = [SrcSpan ".hs" 5 18 5 20]}) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) "Tree"))) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) "Tree")))),FunBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) [Match (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 6 9, srcInfoPoints = []}) "add1") [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) "t")] (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 12 8 51, srcInfoPoints = [SrcSpan ".hs" 6 12 6 13]}) (Case (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 14 8 51, srcInfoPoints = [SrcSpan ".hs" 6 14 6 18,SrcSpan ".hs" 6 21 6 23,SrcSpan ".hs" 7 13 7 13,SrcSpan ".hs" 8 13 8 13,SrcSpan ".hs" 10 5 10 0]}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) "t"))) [Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 39, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 19, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Leaf")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) "x")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 24 7 39, srcInfoPoints = [SrcSpan ".hs" 7 24 7 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) "Leaf"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 32 7 39, srcInfoPoints = [SrcSpan ".hs" 7 32 7 33,SrcSpan ".hs" 7 38 7 39]}) (InfixApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 38, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) "x"))) (QVarOp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (Symbol (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) "+"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) 1 "1")))))) Nothing,Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 51, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 23, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) "Node")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) "x1"),PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) "x2")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 51, srcInfoPoints = [SrcSpan ".hs" 8 24 8 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 51, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 41, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 32 8 41, srcInfoPoints = [SrcSpan ".hs" 8 32 8 33,SrcSpan ".hs" 8 40 8 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 40, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) "x1")))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 42 8 51, srcInfoPoints = [SrcSpan ".hs" 8 42 8 43,SrcSpan ".hs" 8 50 8 51]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 50, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) "x2"))))))) Nothing])) Nothing],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 17, srcInfoPoints = [SrcSpan ".hs" 10 10 10 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 41, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 10 11 41, srcInfoPoints = [SrcSpan ".hs" 11 10 11 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 41, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 17 11 41, srcInfoPoints = [SrcSpan ".hs" 11 17 11 18,SrcSpan ".hs" 11 40 11 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 40, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 31, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 23 11 31, srcInfoPoints = [SrcSpan ".hs" 11 23 11 24,SrcSpan ".hs" 11 30 11 31]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 30, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 32 11 40, srcInfoPoints = [SrcSpan ".hs" 11 32 11 33,SrcSpan ".hs" 11 39 11 40]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) 2 "2")))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) + +cleaned: +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) + + +parsed: +ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 12 0, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 5 5 5 5,SrcSpan ".hs" 6 5 6 5,SrcSpan ".hs" 10 5 10 5,SrcSpan ".hs" 11 5 11 5,SrcSpan ".hs" 12 1 12 0]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 20, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 15 2 20]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Addone") Nothing Nothing)) [] [] [DataDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 42, srcInfoPoints = [SrcSpan ".hs" 3 15 3 16,SrcSpan ".hs" 3 26 3 27]}) (DataType (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 9, srcInfoPoints = []})) Nothing (DHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) "Tree")) [QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 21, srcInfoPoints = []}) "Leaf") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) "Int"))]),QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 32, srcInfoPoints = []}) "Node") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) "Tree")),TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) "Tree"))])] [],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 25, srcInfoPoints = [SrcSpan ".hs" 5 10 5 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 9, srcInfoPoints = []}) "add1"] (TyFun (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 25, srcInfoPoints = [SrcSpan ".hs" 5 18 5 20]}) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) "Tree"))) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) "Tree")))),FunBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) [Match (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 6 9, srcInfoPoints = []}) "add1") [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) "t")] (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 12 8 51, srcInfoPoints = [SrcSpan ".hs" 6 12 6 13]}) (Case (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 14 8 51, srcInfoPoints = [SrcSpan ".hs" 6 14 6 18,SrcSpan ".hs" 6 21 6 23,SrcSpan ".hs" 7 13 7 13,SrcSpan ".hs" 8 13 8 13,SrcSpan ".hs" 10 5 10 0]}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) "t"))) [Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 39, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 19, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Leaf")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) "x")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 24 7 39, srcInfoPoints = [SrcSpan ".hs" 7 24 7 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) "Leaf"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 32 7 39, srcInfoPoints = [SrcSpan ".hs" 7 32 7 33,SrcSpan ".hs" 7 38 7 39]}) (InfixApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 38, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) "x"))) (QVarOp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (Symbol (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) "+"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) 1 "1")))))) Nothing,Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 51, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 23, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) "Node")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) "x1"),PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) "x2")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 51, srcInfoPoints = [SrcSpan ".hs" 8 24 8 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 51, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 41, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 32 8 41, srcInfoPoints = [SrcSpan ".hs" 8 32 8 33,SrcSpan ".hs" 8 40 8 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 40, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) "x1")))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 42 8 51, srcInfoPoints = [SrcSpan ".hs" 8 42 8 43,SrcSpan ".hs" 8 50 8 51]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 50, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) "x2"))))))) Nothing])) Nothing],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 17, srcInfoPoints = [SrcSpan ".hs" 10 10 10 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 41, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 10 11 41, srcInfoPoints = [SrcSpan ".hs" 11 10 11 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 41, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 17 11 41, srcInfoPoints = [SrcSpan ".hs" 11 17 11 18,SrcSpan ".hs" 11 40 11 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 40, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 31, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 23 11 31, srcInfoPoints = [SrcSpan ".hs" 11 23 11 24,SrcSpan ".hs" 11 30 11 31]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 30, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 32 11 40, srcInfoPoints = [SrcSpan ".hs" 11 32 11 33,SrcSpan ".hs" 11 39 11 40]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) 2 "2")))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) + +config: Config {input = Unspecified, mode = ToExe, benchInput = Nothing, arrayInput = Nothing, verbosity = 4, cc = "gcc", optc = " -O3 -flto ", cfile = Nothing, exefile = Nothing, backend = C, dynflags = DynFlags {generalFlags = fromList [], debugFlags = fromList []}, srcFile = Nothing} + + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(Tree, + DDef {tyName = "Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], + fundefs = [(add1, + FunDef {funName = "add1", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "add1" [] [VarE "x1"], + AppE "add1" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing} + + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0 = + case t_0 of + Leaf x_1::$2 -> + (Leaf $1 x_1 + 1) + Node x1_2::$4 x2_3::$5 -> + (Node $3 (add1 [] x1_2) (add1 [] x2_3)) + + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::$2 -> + (Leaf $1 x_1_5 + 1) + Node x1_2_6::$4 x2_3_7::$5 -> + (Node $3 (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, bindLambdas +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, monomorphize +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, specLambdas +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::Int -> + (Leaf () x_1_5 + 1) + Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + + + [compiler] Running pass, desugarL0 +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::() -> + (Leaf () x_1_5 + 1) + Node x1_2_6::() x2_3_7::() -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17::() -> + let y_18 :: Int = x_17 in + (Leaf () y_18) + Node x_19::() x_20::() -> + let y_21 :: (Packed Tree []) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree []) = (_copy_Tree [] x_20) in + (Node () y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24::() -> + let y_25 :: Int = x_24 in + (Leaf () y_25) + Node x_26::() x_27::() -> + let y_28 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_27) in + (Node () y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: forall. ((Packed Tree []) -> ()) +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31::() -> + () + Node x_33::() x_34::() -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: forall. ((Packed Tree []) -> ()) +_print_Tree arg_37 = + case arg_37 of + Leaf x_38::() -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43::() x_44::() -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, floatOutCase +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5::() -> + (Leaf () x_1_5 + 1) + Node x1_2_6::() x2_3_7::() -> + (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17::() -> + let y_18 :: Int = x_17 in + (Leaf () y_18) + Node x_19::() x_20::() -> + let y_21 :: (Packed Tree []) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree []) = (_copy_Tree [] x_20) in + (Node () y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24::() -> + let y_25 :: Int = x_24 in + (Leaf () y_25) + Node x_26::() x_27::() -> + let y_28 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_27) in + (Node () y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: forall. ((Packed Tree []) -> ()) +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31::() -> + () + Node x_33::() x_34::() -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: forall. ((Packed Tree []) -> ()) +_print_Tree arg_37 = + case arg_37 of + Leaf x_38::() -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43::() x_44::() -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, toL1 +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, benchMainExp +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +add1 :: (Packed Tree) -> (Packed Tree) +add1 t_0_4 = + case t_0_4 of + Leaf x_1_5 -> + (Leaf x_1_5 + 1) + Node x1_2_6 x2_3_7 -> + (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16 = + case arg_16 of + Leaf x_17 -> + let y_18 :: Int = x_17 in + (Leaf y_18) + Node x_19 x_20 -> + let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in + let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in + (Node y_21 y_22) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23 = + case arg_23 of + Leaf x_24 -> + let y_25 :: Int = x_24 in + (Leaf y_25) + Node x_26 x_27 -> + let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in + let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in + (Node y_28 y_29) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30 = + case arg_30 of + Leaf x_31 -> + () + Node x_33 x_34 -> + let y_35 :: () = (_traverse_Tree [] x_33) in + let y_36 :: () = (_traverse_Tree [] x_34) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37 = + case arg_37 of + Leaf x_38 -> + let wildcard_40 :: () = printsym("(Leaf") in + let wildcard_42 :: () = printsym(" ") in + let y_39 :: () = printint(x_38) in + let wildcard_41 :: () = printsym(")") in + () + Node x_43 x_44 -> + let wildcard_47 :: () = printsym("(Node") in + let wildcard_50 :: () = printsym(" ") in + let y_45 :: () = (_print_Tree [] x_43) in + let wildcard_49 :: () = printsym(" ") in + let y_46 :: () = (_print_Tree [] x_44) in + let wildcard_48 :: () = printsym(")") in + () + + + [compiler] Running pass, simplify +Removed unused functions: [Var "add1"] +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55 = + case arg_16_55 of + Leaf x_17_56 -> + let y_18_57 :: Int = x_17_56 in + (Leaf y_18_57) + Node x_19_58 x_20_59 -> + let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in + let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in + (Node y_21_60 y_22_61) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62 = + case arg_23_62 of + Leaf x_24_63 -> + let y_25_64 :: Int = x_24_63 in + (Leaf y_25_64) + Node x_26_65 x_27_66 -> + let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in + let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in + (Node y_28_67 y_29_68) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69 = + case arg_30_69 of + Leaf x_31_70 -> + () + Node x_33_71 x_34_72 -> + let y_35_73 :: () = (_traverse_Tree [] x_33_71) in + let y_36_74 :: () = (_traverse_Tree [] x_34_72) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75 = + case arg_37_75 of + Leaf x_38_76 -> + let wildcard_40_77 :: () = printsym("(Leaf") in + let wildcard_42_78 :: () = printsym(" ") in + let y_39_79 :: () = printint(x_38_76) in + let wildcard_41_80 :: () = printsym(")") in + () + Node x_43_81 x_44_82 -> + let wildcard_47_83 :: () = printsym("(Node") in + let wildcard_50_84 :: () = printsym(" ") in + let y_45_85 :: () = (_print_Tree [] x_43_81) in + let wildcard_49_86 :: () = printsym(" ") in + let y_46_87 :: () = (_print_Tree [] x_44_82) in + let wildcard_48_88 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55 = + case arg_16_55 of + Leaf x_17_56 -> + let y_18_57 :: Int = x_17_56 in + (Leaf y_18_57) + Node x_19_58 x_20_59 -> + let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in + let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in + (Node y_21_60 y_22_61) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62 = + case arg_23_62 of + Leaf x_24_63 -> + let y_25_64 :: Int = x_24_63 in + (Leaf y_25_64) + Node x_26_65 x_27_66 -> + let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in + let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in + (Node y_28_67 y_29_68) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69 = + case arg_30_69 of + Leaf x_31_70 -> + () + Node x_33_71 x_34_72 -> + let y_35_73 :: () = (_traverse_Tree [] x_33_71) in + let y_36_74 :: () = (_traverse_Tree [] x_34_72) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75 = + case arg_37_75 of + Leaf x_38_76 -> + let wildcard_40_77 :: () = printsym("(Leaf") in + let wildcard_42_78 :: () = printsym(" ") in + let y_39_79 :: () = printint(x_38_76) in + let wildcard_41_80 :: () = printsym(")") in + () + Node x_43_81 x_44_82 -> + let wildcard_47_83 :: () = printsym("(Node") in + let wildcard_50_84 :: () = printsym(" ") in + let y_45_85 :: () = (_print_Tree [] x_43_81) in + let wildcard_49_86 :: () = printsym(" ") in + let y_46_87 :: () = (_print_Tree [] x_44_82) in + let wildcard_48_88 :: () = printsym(")") in + () + + + [compiler] Running pass, flatten +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55 = + case arg_16_55 of + Leaf x_17_56 -> + let y_18_57 :: Int = x_17_56 in + (Leaf y_18_57) + Node x_19_58 x_20_59 -> + let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in + let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in + (Node y_21_60 y_22_61) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62 = + case arg_23_62 of + Leaf x_24_63 -> + let y_25_64 :: Int = x_24_63 in + (Leaf y_25_64) + Node x_26_65 x_27_66 -> + let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in + let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in + (Node y_28_67 y_29_68) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69 = + case arg_30_69 of + Leaf x_31_70 -> + () + Node x_33_71 x_34_72 -> + let y_35_73 :: () = (_traverse_Tree [] x_33_71) in + let y_36_74 :: () = (_traverse_Tree [] x_34_72) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75 = + case arg_37_75 of + Leaf x_38_76 -> + let wildcard_40_77 :: () = printsym("(Leaf") in + let wildcard_42_78 :: () = printsym(" ") in + let y_39_79 :: () = printint(x_38_76) in + let wildcard_41_80 :: () = printsym(")") in + () + Node x_43_81 x_44_82 -> + let wildcard_47_83 :: () = printsym("(Node") in + let wildcard_50_84 :: () = printsym(" ") in + let y_45_85 :: () = (_print_Tree [] x_43_81) in + let wildcard_49_86 :: () = printsym(" ") in + let y_46_87 :: () = (_print_Tree [] x_44_82) in + let wildcard_48_88 :: () = printsym(")") in + () + + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + let y_18_57_91 :: Int = x_17_56_90 in + (Leaf y_18_57_91) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + let y_25_64_98 :: Int = x_24_63_97 in + (Leaf y_25_64_98) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, inlineTriv +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree) (Packed Tree) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: (Packed Tree) -> (Packed Tree) +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: (Packed Tree) -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: (Packed Tree) -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, directL3 +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, unariser +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.flatten +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Tree = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Tree :: Cursor -> Cursor +_copy_Tree arg_16_55_89 = + case arg_16_55_89 of + Leaf x_17_56_90 -> + (Leaf x_17_56_90) + Node x_19_58_92 x_20_59_93 -> + let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in + let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in + (Node y_21_60_94 y_22_61_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Tree :: Cursor -> Cursor +_copy_without_ptrs_Tree arg_23_62_96 = + case arg_23_62_96 of + Leaf x_24_63_97 -> + (Leaf x_24_63_97) + Node x_26_65_99 x_27_66_100 -> + let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in + let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in + (Node y_28_67_101 y_29_68_102) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Tree :: Cursor -> () +_traverse_Tree arg_30_69_103 = + case arg_30_69_103 of + Leaf x_31_70_104 -> + () + Node x_33_71_105 x_34_72_106 -> + let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in + let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Tree :: Cursor -> () +_print_Tree arg_37_75_109 = + case arg_37_75_109 of + Leaf x_38_76_110 -> + let wildcard_40_77_111 :: () = printsym("(Leaf") in + let wildcard_42_78_112 :: () = printsym(" ") in + let y_39_79_113 :: () = printint(x_38_76_110) in + let wildcard_41_80_114 :: () = printsym(")") in + () + Node x_43_81_115 x_44_82_116 -> + let wildcard_47_83_117 :: () = printsym("(Node") in + let wildcard_50_84_118 :: () = printsym(" ") in + let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in + let wildcard_49_86_120 :: () = printsym(" ") in + let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in + let wildcard_48_88_122 :: () = printsym(")") in + () + + + [compiler] Running pass, lower +Pass output: +================================================================================ +Prog {infoTable = [("Tree", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), + (126, " ")], + fundefs = [FunDecl {funName = "_copy_Tree", + funArgs = [(arg_16_55_89, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), + (tail_128, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_16_55_89"], + bod = Switch "switch_131" + (VarTriv "tag_127") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_56_90, + IntTy)], + ptr = "tail_128", + bod = LetAllocT {lhs = "tailift_129", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_17_56_90")], + bod = RetValsT [VarTriv "tailift_129"]}}), + (1, + LetUnpackT {binds = [(x_19_58_92, + CursorTy), + (x_20_59_93, + CursorTy)], + ptr = "tail_128", + bod = LetCallT {async = False, + binds = [(y_21_60_94, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_19_58_92"], + bod = LetCallT {async = False, + binds = [(y_22_61_95, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_20_59_93"], + bod = LetAllocT {lhs = "tailift_130", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_21_60_94"), + (CursorTy, + VarTriv "y_22_61_95")], + bod = RetValsT [VarTriv "tailift_130"]}}}})]) + (Just ErrT "Unknown tag in: tag_127")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Tree", + funArgs = [(arg_23_62_96, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), + (tail_133, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_23_62_96"], + bod = Switch "switch_136" + (VarTriv "tag_132") + (IntAlts [(0, + LetUnpackT {binds = [(x_24_63_97, + IntTy)], + ptr = "tail_133", + bod = LetAllocT {lhs = "tailift_134", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_24_63_97")], + bod = RetValsT [VarTriv "tailift_134"]}}), + (1, + LetUnpackT {binds = [(x_26_65_99, + CursorTy), + (x_27_66_100, + CursorTy)], + ptr = "tail_133", + bod = LetCallT {async = False, + binds = [(y_28_67_101, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_26_65_99"], + bod = LetCallT {async = False, + binds = [(y_29_68_102, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_27_66_100"], + bod = LetAllocT {lhs = "tailift_135", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_28_67_101"), + (CursorTy, + VarTriv "y_29_68_102")], + bod = RetValsT [VarTriv "tailift_135"]}}}})]) + (Just ErrT "Unknown tag in: tag_132")}, + isPure = True}, + FunDecl {funName = "_traverse_Tree", + funArgs = [(arg_30_69_103, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), + (tail_138, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_30_69_103"], + bod = Switch "switch_139" + (VarTriv "tag_137") + (IntAlts [(0, + LetUnpackT {binds = [(x_31_70_104, + IntTy)], + ptr = "tail_138", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_33_71_105, + CursorTy), + (x_34_72_106, + CursorTy)], + ptr = "tail_138", + bod = LetCallT {async = False, + binds = [(y_35_73_107, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_33_71_105"], + bod = LetCallT {async = False, + binds = [(y_36_74_108, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_34_72_106"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_137")}, + isPure = True}, + FunDecl {funName = "_print_Tree", + funArgs = [(arg_37_75_109, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), + (tail_141, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_37_75_109"], + bod = Switch "switch_142" + (VarTriv "tag_140") + (IntAlts [(0, + LetUnpackT {binds = [(x_38_76_110, + IntTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_40_77_111, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 125], + bod = LetPrimCallT {binds = [(wildcard_42_78_112, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetPrimCallT {binds = [(y_39_79_113, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_38_76_110"], + bod = LetPrimCallT {binds = [(wildcard_41_80_114, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_43_81_115, + CursorTy), + (x_44_82_116, + CursorTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_47_83_117, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 124], + bod = LetPrimCallT {binds = [(wildcard_50_84_118, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_45_85_119, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_43_81_115"], + bod = LetPrimCallT {binds = [(wildcard_49_86_120, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_46_87_121, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_44_82_116"], + bod = LetPrimCallT {binds = [(wildcard_48_88_122, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_140")}, + isPure = True}], + mainExp = Nothing} + + [compiler] Running pass, lateInlineTriv +Pass output: +================================================================================ +Prog {infoTable = [("Tree", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), + (126, " ")], + fundefs = [FunDecl {funName = "_copy_Tree", + funArgs = [(arg_16_55_89, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), + (tail_128, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_16_55_89"], + bod = Switch "switch_131" + (VarTriv "tag_127") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_56_90, + IntTy)], + ptr = "tail_128", + bod = LetAllocT {lhs = "tailift_129", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_17_56_90")], + bod = RetValsT [VarTriv "tailift_129"]}}), + (1, + LetUnpackT {binds = [(x_19_58_92, + CursorTy), + (x_20_59_93, + CursorTy)], + ptr = "tail_128", + bod = LetCallT {async = False, + binds = [(y_21_60_94, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_19_58_92"], + bod = LetCallT {async = False, + binds = [(y_22_61_95, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_20_59_93"], + bod = LetAllocT {lhs = "tailift_130", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_21_60_94"), + (CursorTy, + VarTriv "y_22_61_95")], + bod = RetValsT [VarTriv "tailift_130"]}}}})]) + (Just ErrT "Unknown tag in: tag_127")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Tree", + funArgs = [(arg_23_62_96, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), + (tail_133, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_23_62_96"], + bod = Switch "switch_136" + (VarTriv "tag_132") + (IntAlts [(0, + LetUnpackT {binds = [(x_24_63_97, + IntTy)], + ptr = "tail_133", + bod = LetAllocT {lhs = "tailift_134", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_24_63_97")], + bod = RetValsT [VarTriv "tailift_134"]}}), + (1, + LetUnpackT {binds = [(x_26_65_99, + CursorTy), + (x_27_66_100, + CursorTy)], + ptr = "tail_133", + bod = LetCallT {async = False, + binds = [(y_28_67_101, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_26_65_99"], + bod = LetCallT {async = False, + binds = [(y_29_68_102, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_27_66_100"], + bod = LetAllocT {lhs = "tailift_135", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_28_67_101"), + (CursorTy, + VarTriv "y_29_68_102")], + bod = RetValsT [VarTriv "tailift_135"]}}}})]) + (Just ErrT "Unknown tag in: tag_132")}, + isPure = True}, + FunDecl {funName = "_traverse_Tree", + funArgs = [(arg_30_69_103, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), + (tail_138, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_30_69_103"], + bod = Switch "switch_139" + (VarTriv "tag_137") + (IntAlts [(0, + LetUnpackT {binds = [(x_31_70_104, + IntTy)], + ptr = "tail_138", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_33_71_105, + CursorTy), + (x_34_72_106, + CursorTy)], + ptr = "tail_138", + bod = LetCallT {async = False, + binds = [(y_35_73_107, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_33_71_105"], + bod = LetCallT {async = False, + binds = [(y_36_74_108, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_34_72_106"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_137")}, + isPure = True}, + FunDecl {funName = "_print_Tree", + funArgs = [(arg_37_75_109, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), + (tail_141, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_37_75_109"], + bod = Switch "switch_142" + (VarTriv "tag_140") + (IntAlts [(0, + LetUnpackT {binds = [(x_38_76_110, + IntTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_40_77_111, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 125], + bod = LetPrimCallT {binds = [(wildcard_42_78_112, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetPrimCallT {binds = [(y_39_79_113, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_38_76_110"], + bod = LetPrimCallT {binds = [(wildcard_41_80_114, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_43_81_115, + CursorTy), + (x_44_82_116, + CursorTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_47_83_117, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 124], + bod = LetPrimCallT {binds = [(wildcard_50_84_118, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_45_85_119, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_43_81_115"], + bod = LetPrimCallT {binds = [(wildcard_49_86_120, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_46_87_121, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_44_82_116"], + bod = LetPrimCallT {binds = [(wildcard_48_88_122, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_140")}, + isPure = True}], + mainExp = Nothing} + + [compiler] Running pass, rearrangeFree +Pass output: +================================================================================ +Prog {infoTable = [("Tree", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), + (126, " ")], + fundefs = [FunDecl {funName = "_copy_Tree", + funArgs = [(arg_16_55_89, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), + (tail_128, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_16_55_89"], + bod = Switch "switch_131" + (VarTriv "tag_127") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_56_90, + IntTy)], + ptr = "tail_128", + bod = LetAllocT {lhs = "tailift_129", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_17_56_90")], + bod = RetValsT [VarTriv "tailift_129"]}}), + (1, + LetUnpackT {binds = [(x_19_58_92, + CursorTy), + (x_20_59_93, + CursorTy)], + ptr = "tail_128", + bod = LetCallT {async = False, + binds = [(y_21_60_94, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_19_58_92"], + bod = LetCallT {async = False, + binds = [(y_22_61_95, + CursorTy)], + rator = "_copy_Tree", + rands = [VarTriv "x_20_59_93"], + bod = LetAllocT {lhs = "tailift_130", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_21_60_94"), + (CursorTy, + VarTriv "y_22_61_95")], + bod = RetValsT [VarTriv "tailift_130"]}}}})]) + (Just ErrT "Unknown tag in: tag_127")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Tree", + funArgs = [(arg_23_62_96, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), + (tail_133, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_23_62_96"], + bod = Switch "switch_136" + (VarTriv "tag_132") + (IntAlts [(0, + LetUnpackT {binds = [(x_24_63_97, + IntTy)], + ptr = "tail_133", + bod = LetAllocT {lhs = "tailift_134", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_24_63_97")], + bod = RetValsT [VarTriv "tailift_134"]}}), + (1, + LetUnpackT {binds = [(x_26_65_99, + CursorTy), + (x_27_66_100, + CursorTy)], + ptr = "tail_133", + bod = LetCallT {async = False, + binds = [(y_28_67_101, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_26_65_99"], + bod = LetCallT {async = False, + binds = [(y_29_68_102, + CursorTy)], + rator = "_copy_without_ptrs_Tree", + rands = [VarTriv "x_27_66_100"], + bod = LetAllocT {lhs = "tailift_135", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_28_67_101"), + (CursorTy, + VarTriv "y_29_68_102")], + bod = RetValsT [VarTriv "tailift_135"]}}}})]) + (Just ErrT "Unknown tag in: tag_132")}, + isPure = True}, + FunDecl {funName = "_traverse_Tree", + funArgs = [(arg_30_69_103, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), + (tail_138, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_30_69_103"], + bod = Switch "switch_139" + (VarTriv "tag_137") + (IntAlts [(0, + LetUnpackT {binds = [(x_31_70_104, + IntTy)], + ptr = "tail_138", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_33_71_105, + CursorTy), + (x_34_72_106, + CursorTy)], + ptr = "tail_138", + bod = LetCallT {async = False, + binds = [(y_35_73_107, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_33_71_105"], + bod = LetCallT {async = False, + binds = [(y_36_74_108, + ProdTy [])], + rator = "_traverse_Tree", + rands = [VarTriv "x_34_72_106"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_137")}, + isPure = True}, + FunDecl {funName = "_print_Tree", + funArgs = [(arg_37_75_109, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), + (tail_141, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_37_75_109"], + bod = Switch "switch_142" + (VarTriv "tag_140") + (IntAlts [(0, + LetUnpackT {binds = [(x_38_76_110, + IntTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_40_77_111, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 125], + bod = LetPrimCallT {binds = [(wildcard_42_78_112, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetPrimCallT {binds = [(y_39_79_113, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_38_76_110"], + bod = LetPrimCallT {binds = [(wildcard_41_80_114, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_43_81_115, + CursorTy), + (x_44_82_116, + CursorTy)], + ptr = "tail_141", + bod = LetPrimCallT {binds = [(wildcard_47_83_117, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 124], + bod = LetPrimCallT {binds = [(wildcard_50_84_118, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_45_85_119, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_43_81_115"], + bod = LetPrimCallT {binds = [(wildcard_49_86_120, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 126], + bod = LetCallT {async = False, + binds = [(y_46_87_121, + ProdTy [])], + rator = "_print_Tree", + rands = [VarTriv "x_44_82_116"], + bod = LetPrimCallT {binds = [(wildcard_48_88_122, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 123], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_140")}, + isPure = True}], + mainExp = Nothing} + + [compiler] Final C codegen: 8787 characters. +================================================================================ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +typedef struct GibIntGibIntProd_struct { + GibInt field0; + GibInt field1; + } GibIntGibIntProd; +typedef struct GibIntGibCursorGibCursorProd_struct { + GibInt field0; + GibCursor field1; + GibCursor field2; + } GibIntGibCursorGibCursorProd; +typedef struct GibPackedTagGibCursorProd_struct { + GibPackedTag field0; + GibCursor field1; + } GibPackedTagGibCursorProd; +typedef struct GibCursorProd_struct { + GibCursor field0; + } GibCursorProd; +typedef struct GibCursorGibCursorProd_struct { + GibCursor field0; + GibCursor field1; + } GibCursorGibCursorProd; +GibCursor _copy_Tree(GibCursor arg_16_55_89); +GibCursor _copy_without_ptrs_Tree(GibCursor arg_23_62_96); +unsigned char _traverse_Tree(GibCursor arg_30_69_103); +unsigned char _print_Tree(GibCursor arg_37_75_109); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + Tree_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(8); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[1]; + + error = gib_info_table_insert_packed_dcon(Tree_T, 0, 8, 0, 1, 0, field_tys, + 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Tree_T, 0); + exit(1); + } + error = gib_info_table_insert_packed_dcon(Tree_T, 1, 0, 2, 0, 0, field_tys, + 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Tree_T, 1); + exit(1); + } + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ + gib_add_symbol(123, ")"); + gib_add_symbol(124, "(Node"); + gib_add_symbol(125, "(Leaf"); + gib_add_symbol(126, " "); +} +GibCursor _copy_Tree(GibCursor arg_16_55_89) +{ + GibPackedTag tag_127 = *(GibPackedTag *) arg_16_55_89; + GibCursor tail_128 = arg_16_55_89 + sizeof(GibInt); + + + switch_131: + ; + switch (tag_127) { + + case 0: + { + GibInt x_17_56_90 = ((GibIntProd *) tail_128)->field0; + GibPtr tailift_129 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_129)->field0 = 0; + ((GibIntGibIntProd *) tailift_129)->field1 = x_17_56_90; + return tailift_129; + break; + } + + case 1: + { + GibCursor x_19_58_92 = + ((GibCursorGibCursorProd *) tail_128)->field0; + GibCursor x_20_59_93 = + ((GibCursorGibCursorProd *) tail_128)->field1; + GibCursor y_21_60_94 = _copy_Tree(x_19_58_92); + GibCursor y_22_61_95 = _copy_Tree(x_20_59_93); + GibPtr tailift_130 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_130)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_130)->field1 = y_21_60_94; + ((GibIntGibCursorGibCursorProd *) tailift_130)->field2 = y_22_61_95; + return tailift_130; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_127"); + exit(1); + } + } +} +GibCursor _copy_without_ptrs_Tree(GibCursor arg_23_62_96) +{ + GibPackedTag tag_132 = *(GibPackedTag *) arg_23_62_96; + GibCursor tail_133 = arg_23_62_96 + sizeof(GibInt); + + + switch_136: + ; + switch (tag_132) { + + case 0: + { + GibInt x_24_63_97 = ((GibIntProd *) tail_133)->field0; + GibPtr tailift_134 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_134)->field0 = 0; + ((GibIntGibIntProd *) tailift_134)->field1 = x_24_63_97; + return tailift_134; + break; + } + + case 1: + { + GibCursor x_26_65_99 = + ((GibCursorGibCursorProd *) tail_133)->field0; + GibCursor x_27_66_100 = + ((GibCursorGibCursorProd *) tail_133)->field1; + GibCursor y_28_67_101 = _copy_without_ptrs_Tree(x_26_65_99); + GibCursor y_29_68_102 = _copy_without_ptrs_Tree(x_27_66_100); + GibPtr tailift_135 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_135)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_135)->field1 = + y_28_67_101; + ((GibIntGibCursorGibCursorProd *) tailift_135)->field2 = + y_29_68_102; + return tailift_135; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_132"); + exit(1); + } + } +} +unsigned char _traverse_Tree(GibCursor arg_30_69_103) +{ + GibPackedTag tag_137 = *(GibPackedTag *) arg_30_69_103; + GibCursor tail_138 = arg_30_69_103 + sizeof(GibInt); + + + switch_139: + ; + switch (tag_137) { + + case 0: + { + GibInt x_31_70_104 = ((GibIntProd *) tail_138)->field0; + + return 0; + break; + } + + case 1: + { + GibCursor x_33_71_105 = + ((GibCursorGibCursorProd *) tail_138)->field0; + GibCursor x_34_72_106 = + ((GibCursorGibCursorProd *) tail_138)->field1; + unsigned char y_35_73_107 = _traverse_Tree(x_33_71_105); + unsigned char y_36_74_108 = _traverse_Tree(x_34_72_106); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_137"); + exit(1); + } + } +} +unsigned char _print_Tree(GibCursor arg_37_75_109) +{ + GibPackedTag tag_140 = *(GibPackedTag *) arg_37_75_109; + GibCursor tail_141 = arg_37_75_109 + sizeof(GibInt); + + + switch_142: + ; + switch (tag_140) { + + case 0: + { + GibInt x_38_76_110 = ((GibIntProd *) tail_141)->field0; + unsigned char wildcard_40_77_111 = gib_print_symbol(125); + unsigned char wildcard_42_78_112 = gib_print_symbol(126); + unsigned char y_39_79_113 = printf("%ld", x_38_76_110); + unsigned char wildcard_41_80_114 = gib_print_symbol(123); + + return 0; + break; + } + + case 1: + { + GibCursor x_43_81_115 = + ((GibCursorGibCursorProd *) tail_141)->field0; + GibCursor x_44_82_116 = + ((GibCursorGibCursorProd *) tail_141)->field1; + unsigned char wildcard_47_83_117 = gib_print_symbol(124); + unsigned char wildcard_50_84_118 = gib_print_symbol(126); + unsigned char y_45_85_119 = _print_Tree(x_43_81_115); + unsigned char wildcard_49_86_120 = gib_print_symbol(126); + unsigned char y_46_87_121 = _print_Tree(x_44_82_116); + unsigned char wildcard_48_88_122 = gib_print_symbol(123); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_140"); + exit(1); + } + } +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + int exit_1 = gib_exit(); + + return exit_1; +} + +Compiling RTS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +make: Nothing to be done for 'all'. + + + + +Compiling the program +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng + + + +In file included from /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.c:3:0: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] + #warning "Simple write barrier is disabled." + ^~~~~~~ + + diff --git a/benchmarks/AddImport.c b/benchmarks/AddImport.c new file mode 100644 index 000000000..59ad8c64e --- /dev/null +++ b/benchmarks/AddImport.c @@ -0,0 +1,93 @@ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +GibInt add1(GibInt x_1_10_13); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(7); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[0]; + + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ } +GibInt add1(GibInt x_1_10_13) +{ + GibInt flt_15 = x_1_10_13 + 1; + + return flt_15; +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + GibInt fltAppE_11_12 = add1(0); + GibInt tmp_app_14 = add1(fltAppE_11_12); + + printf("%ld", tmp_app_14); + printf("\n"); + return 0; + + int exit_1 = gib_exit(); + + return exit_1; +} \ No newline at end of file diff --git a/benchmarks/Addone.c b/benchmarks/Addone.c new file mode 100644 index 000000000..bb458c5cc --- /dev/null +++ b/benchmarks/Addone.c @@ -0,0 +1,76 @@ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(7); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[0]; + + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ } +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + int exit_1 = gib_exit(); + + return exit_1; +} \ No newline at end of file diff --git a/benchmarks/Addtwo.c b/benchmarks/Addtwo.c new file mode 100644 index 000000000..bb458c5cc --- /dev/null +++ b/benchmarks/Addtwo.c @@ -0,0 +1,76 @@ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(7); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[0]; + + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ } +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + int exit_1 = gib_exit(); + + return exit_1; +} \ No newline at end of file diff --git a/gibbon-compiler/IR.log b/gibbon-compiler/IR.log new file mode 100644 index 000000000..359ac2ee4 --- /dev/null +++ b/gibbon-compiler/IR.log @@ -0,0 +1,3 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 +gibbon: /home/timmy/git/gibbon/gibbon-compiler/./examples/addone.hs: openFile: does not exist (No such file or directory) diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs new file mode 100644 index 000000000..d8060f609 --- /dev/null +++ b/gibbon-compiler/examples/Addone.hs @@ -0,0 +1,10 @@ +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs new file mode 100644 index 000000000..d8060f609 --- /dev/null +++ b/gibbon-compiler/examples/Addtwo.hs @@ -0,0 +1,10 @@ +module Addone where + data Tree = Leaf Int | Node Tree Tree + + add1 :: Tree -> Tree + add1 t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add1 x1) (add1 x2) + + main :: Tree + main = add1 (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs new file mode 100644 index 000000000..008bce52d --- /dev/null +++ b/gibbon-compiler/examples/addimport.hs @@ -0,0 +1,7 @@ +module Addimport where + import Addone + import Addtwo + + + main :: Tree + main = Addtwo.add1 2 (Addtwo.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs new file mode 100644 index 000000000..d72d735df --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -0,0 +1,423 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} + +-- | Unique names. + +module Gibbon.Passes.ModuleRename (renameNames) where + +import Gibbon.Pretty + +import Control.Exception +import Data.Foldable ( foldrM ) +import Prelude hiding (exp) +import qualified Data.List as L +import qualified Data.Map as M + +import Gibbon.Common +import Gibbon.L0.Syntax +import qualified Gibbon.L1.Syntax as L1 + +-------------------------------------------------------------------------------- + +type VarEnv = M.Map Var Var +type TyVarEnv t = M.Map TyVar t + +renameNames :: Prog0 -> PassM Prog0 +renameNames (Prog defs funs main) = + let _ = dbgPrintLn 2 (show defs) + in + do main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- freshExp M.empty M.empty m + return $ Just (m',ty) + defs' <- traverse freshDDef defs + funs' <- M.mapKeys cleanFunName <$> traverse freshFun funs + return $ Prog defs' funs' main' + +freshDDef :: DDef Ty0 -> PassM (DDef Ty0) +freshDDef DDef{tyName,tyArgs,dataCons} = do + rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tyArgs + let env :: TyVarEnv Ty0 + env = M.fromList $ zip tyArgs (map TyVar rigid_tyvars) + dataCons' <- mapM (\(dcon,vs) -> (dcon,) <$> mapM (go (sdoc (dcon,vs)) rigid_tyvars env) vs) dataCons + pure (DDef tyName rigid_tyvars dataCons') + where + go :: String -> [TyVar] -> TyVarEnv Ty0 -> (t, Ty0) -> PassM (t, Ty0) + go msg bound env (b, ty) = do + (_, ty') <- freshTy env ty + let free_tvs = tyVarsInTy ty' L.\\ bound + if free_tvs == [] + then pure (b, ty') + else error $ "freshDDef: Unbound type variables " ++ sdoc free_tvs + ++ " in the constructor:\n" ++ msg + +freshFun :: FunDef Exp0 -> PassM (FunDef Exp0) +freshFun (FunDef nam nargs funty bod meta) = + do nargs' <- mapM gensym nargs + let msubst = (M.fromList $ zip nargs nargs') + (tvenv, funty') <- freshTyScheme funty + funty'' <- freshDictTyScheme msubst funty' + bod' <- freshExp msubst tvenv bod + let nam' = cleanFunName nam + pure $ FunDef nam' nargs' funty'' bod' meta + +-- +freshTyScheme :: TyScheme -> PassM (TyVarEnv Ty0, TyScheme) +freshTyScheme (ForAll tvs ty) = do + rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tvs + let env = M.fromList $ zip tvs (map TyVar rigid_tyvars) + (env', ty') <- freshTy env ty + pure (env', ForAll rigid_tyvars ty') + +freshTy :: TyVarEnv Ty0 -> Ty0 -> PassM (TyVarEnv Ty0, Ty0) +freshTy env ty = + case ty of + IntTy -> pure (env, ty) + CharTy -> pure (env, ty) + FloatTy -> pure (env, ty) + SymTy0 -> pure (env, ty) + BoolTy -> pure (env, ty) + ArenaTy -> pure (env, ty) + SymSetTy -> pure (env, ty) + SymHashTy -> pure (env, ty) + TyVar tv -> case M.lookup tv env of + Nothing -> do tv' <- newTyVar + pure (env, TyVar tv') + Just tv' -> pure (env, tv') + MetaTv{} -> pure (env, ty) + ProdTy tys -> do (env', tys') <- freshTys env tys + pure (env', ProdTy tys') + SymDictTy v t -> do (env', t') <- freshTy env t + pure (env', SymDictTy v t') + PDictTy k v -> do (env', k') <- freshTy env k + (env'', v') <- freshTy env' v + pure (env'', PDictTy k' v') + ArrowTy tys t -> do (env', tys') <- freshTys env tys + (env'', [t']) <- freshTys env' [t] + pure (env'', ArrowTy tys' t') + PackedTy tycon tys -> do (env', tys') <- freshTys env tys + pure (env', PackedTy tycon tys') + VectorTy el_t -> do (env', el_t') <- freshTy env el_t + pure (env', VectorTy el_t') + ListTy el_t -> do (env', el_t') <- freshTy env el_t + pure (env', ListTy el_t') + IntHashTy -> pure (env, ty) + +freshTys :: TyVarEnv (TyOf Exp0) -> [Ty0] -> PassM (TyVarEnv (TyOf Exp0), [Ty0]) +freshTys env tys = + foldrM + (\t (env', acc) -> do + (env'', t') <- freshTy env' t + pure (env' <> env'', t' : acc)) + (env, []) + tys + +freshDictTy :: Monad m => M.Map Var Var -> Ty0 -> m Ty0 +freshDictTy m ty = + case ty of + IntTy -> pure ty + CharTy -> pure ty + FloatTy -> pure ty + SymTy0 -> pure ty + BoolTy -> pure ty + ArenaTy -> pure ty + TyVar _tv -> pure ty + MetaTv{} -> pure ty + ProdTy tys -> + do tys' <- mapM (freshDictTy m) tys + pure (ProdTy tys') + SymDictTy (Just v) t -> + do t' <- freshDictTy m t + case M.lookup v m of + Just v' -> pure $ SymDictTy (Just v') t' + Nothing -> pure ty + SymDictTy Nothing t -> + do t' <- freshDictTy m t + pure $ SymDictTy Nothing t' + PDictTy k v -> + do k' <- freshDictTy m k + v' <- freshDictTy m v + pure $ PDictTy k' v' + ArrowTy tys t -> + do tys' <- mapM (freshDictTy m) tys + t' <- freshDictTy m t + pure $ ArrowTy tys' t' + PackedTy tycon tys -> + do tys' <- mapM (freshDictTy m) tys + pure $ PackedTy tycon tys' + VectorTy el_t -> + do el_t' <- freshDictTy m el_t + pure $ VectorTy el_t' + ListTy el_t -> + do el_t' <- freshDictTy m el_t + pure $ ListTy el_t' + SymSetTy -> pure ty + SymHashTy -> pure ty + IntHashTy -> pure ty + +freshDictTyScheme :: Monad m => + M.Map Var Var -> TyScheme -> m TyScheme +freshDictTyScheme m (ForAll tvs ty) = + do ty' <- freshDictTy m ty + pure $ ForAll tvs ty' + +freshExp :: VarEnv -> TyVarEnv Ty0 -> Exp0 -> PassM Exp0 +freshExp venv tvenv exp = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + + VarE v -> + case M.lookup v venv of + Nothing -> return $ VarE (cleanFunName v) + Just v' -> return $ VarE (cleanFunName v') + + AppE v locs ls -> assert ([] == locs) $ do + ls' <- mapM go ls + case M.lookup v venv of + Nothing -> return $ AppE (cleanFunName v) [] ls' + Just v' -> return $ AppE (cleanFunName v') [] ls' + + PrimAppE p es -> do + es' <- mapM go es + return $ PrimAppE p es' + + LetE (v,_locs,ty, e1) e2 -> do + let user_tvs = filter isUserTv $ tyVarsInTy ty + rigid_tyvars <- mapM (\(UserTv w) -> + case M.lookup (UserTv w) tvenv of + Just (TyVar tv) -> pure tv + Just oth -> error $ "freshExp: UserTv bound to: " ++ sdoc oth + Nothing -> BoundTv <$> gensym w) + user_tvs + let env = M.fromList $ zip user_tvs (map TyVar rigid_tyvars) + tvenv' = env <> tvenv + + (_tvenv'', ty') <- freshTy tvenv' ty + e1' <- freshExp venv tvenv' e1 + v' <- gensym (cleanFunName v) + e2' <- freshExp (M.insert v v' venv) tvenv e2 + ty'' <- case ty' of + SymDictTy (Just w) ty2 -> case M.lookup w venv of + Nothing -> return ty' + Just w' -> return $ SymDictTy (Just w') ty2 + _ -> return ty' + return $ LetE (v',[],ty'',e1') e2' + + IfE e1 e2 e3 -> do + e1' <- go e1 + e2' <- go e2 + e3' <- go e3 + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- go e + return $ ProjE i e' + + MkProdE es -> do + es' <- mapM go es + return $ MkProdE es' + + CaseE e mp -> do + e' <- go e + mp' <- mapM (\(c,prs,ae) -> do + let (args,locs) = unzip prs + args' <- mapM gensym args + let venv' = M.fromList (zip args args') `M.union` venv + ae' <- freshExp venv' tvenv ae + return (c, zip args' locs, ae')) mp + return $ CaseE e' mp' + + DataConE loc c es -> do + es' <- mapM go es + return $ DataConE loc c es' + + TimeIt e t b -> do + e' <- go e + return $ TimeIt e' t b + + WithArenaE v e -> do + v' <- gensym v + e' <- freshExp (M.insert v v' venv) tvenv e + return $ WithArenaE v' e' + + SpawnE v locs ls -> assert ([] == locs) $ do + ls' <- mapM go ls + case M.lookup v venv of + Nothing -> return $ SpawnE (cleanFunName v) [] ls' + Just v' -> return $ SpawnE (cleanFunName v') [] ls' + + SyncE -> pure SyncE + + MapE (v,t,b) e -> do + b' <- go b + e' <- go e + return $ MapE (v,t,b') e' + + FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do + e1' <- go e1 + e2' <- go e2 + e3' <- go e3 + return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' + + -- Ext ext -> Ext <$> gFreshenExp venv tvenv ext + + Ext ext -> + case ext of + LambdaE args bod -> do + (venv', vs, ts) <- foldrM + (\(v,t) (acc1, acc2, acc3) -> do + v' <- gensym v + let acc1' = M.insert v v' acc1 + (_tvenv', t') <- freshTy tvenv t + pure (acc1', v':acc2, t': acc3)) + (venv,[],[]) args + Ext <$> (LambdaE (zip vs ts) <$> (freshExp venv' tvenv bod)) + FunRefE tyapps f -> + case M.lookup f venv of + Nothing -> pure $ Ext $ FunRefE tyapps (cleanFunName f) + Just f' -> pure $ Ext $ FunRefE tyapps (cleanFunName f') + PolyAppE{} -> error "freshExp: TODO, PolyAppE." + + BenchE fn tyapps args b -> do + args' <- mapM go args + pure $ Ext (BenchE (cleanFunName fn) tyapps args' b) + + ParE0 ls -> Ext <$> ParE0 <$> mapM go ls + L p e -> Ext <$> (L p) <$> go e + PrintPacked ty arg -> do + (tvenv', ty') <- freshTy tvenv ty + arg' <- freshExp venv tvenv' arg + pure $ Ext $ PrintPacked ty' arg' + CopyPacked ty arg -> do + (tvenv', ty') <- freshTy tvenv ty + arg' <- freshExp venv tvenv' arg + pure $ Ext $ CopyPacked ty' arg' + TravPacked ty arg -> do + (tvenv', ty') <- freshTy tvenv ty + arg' <- freshExp venv tvenv' arg + pure $ Ext $ TravPacked ty' arg' + LinearExt{} -> error $ "freshenExp: a linear types extension wasn't desugared: " ++ sdoc exp + + where go = freshExp venv tvenv + + +-- copy-paste. + +freshNames1 :: L1.Prog1 -> PassM L1.Prog1 +freshNames1 (L1.Prog defs funs main) = + do main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- freshExp1 M.empty m + return $ Just (m',ty) + funs' <- traverse freshFun1 funs + return $ L1.Prog defs funs' main' + +freshFun1 :: L1.FunDef1 -> PassM L1.FunDef1 +freshFun1 (FunDef nam nargs (targ,ty) bod meta) = do + nargs' <- mapM gensym nargs + let msubst = (M.fromList $ zip nargs nargs') + bod' <- freshExp1 msubst bod + -- let nam' = cleanFunName nam + return $ FunDef nam nargs' (targ,ty) bod' meta + + +freshExp1 :: VarEnv -> L1.Exp1 -> PassM L1.Exp1 +freshExp1 vs exp = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + + VarE v -> + case M.lookup v vs of + Nothing -> return $ VarE v + Just v' -> return $ VarE v' + + AppE v locs ls -> assert ([] == locs) $ do + ls' <- mapM (freshExp1 vs) ls + case M.lookup v vs of + Nothing -> return $ AppE (cleanFunName v) [] ls' + Just v' -> return $ AppE (cleanFunName v') [] ls' + + PrimAppE p es -> do + es' <- mapM (freshExp1 vs) es + return $ PrimAppE p es' + + LetE (v,locs,t, e1) e2 -> assert ([]==locs) $ do + e1' <- freshExp1 vs e1 + v' <- gensym v + e2' <- freshExp1 (M.insert v v' vs) e2 + return $ LetE (v',[],t,e1') e2' + + IfE e1 e2 e3 -> do + e1' <- freshExp1 vs e1 + e2' <- freshExp1 vs e2 + e3' <- freshExp1 vs e3 + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- freshExp1 vs e + return $ ProjE i e' + + MkProdE es -> do + es' <- mapM (freshExp1 vs) es + return $ MkProdE es' + + CaseE e mp -> do + e' <- freshExp1 vs e + -- Here we freshen locations: + mp' <- mapM (\(c,prs,ae) -> + let (args,_) = unzip prs in + do + args' <- mapM gensym args + let vs' = (M.fromList $ zip args args') `M.union` vs + ae' <- freshExp1 vs' ae + return (c, map (,()) args', ae')) mp + return $ CaseE e' mp' + + DataConE () c es -> do + es' <- mapM (freshExp1 vs) es + return $ DataConE () c es' + + TimeIt e t b -> do + e' <- freshExp1 vs e + return $ TimeIt e' t b + + SpawnE v locs ls -> assert ([] == locs) $ do + ls' <- mapM (freshExp1 vs) ls + case M.lookup v vs of + Nothing -> return $ SpawnE (cleanFunName v) [] ls' + Just v' -> return $ SpawnE (cleanFunName v') [] ls' + + SyncE -> pure SyncE + + MapE (v,t,b) e -> do + b' <- freshExp1 vs b + e' <- freshExp1 vs e + return $ MapE (v,t,b') e' + + FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do + e1' <- freshExp1 vs e1 + e2' <- freshExp1 vs e2 + e3' <- freshExp1 vs e3 + return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' + + WithArenaE{} -> error "freshExp1: WithArenaE not handled." + + Ext (L1.BenchE fn tyapps args b) -> do + args' <- mapM (freshExp1 vs) args + pure $ Ext (L1.BenchE (cleanFunName fn) tyapps args' b) + + Ext (L1.StartOfPkdCursor cur) -> do + case M.lookup cur vs of + Nothing -> return $ Ext $ L1.StartOfPkdCursor cur + Just v' -> return $ Ext $ L1.StartOfPkdCursor v' + + Ext (L1.AddFixed v i) -> do + case M.lookup v vs of + Nothing -> return $ Ext $ L1.AddFixed v i + Just v' -> return $ Ext $ L1.AddFixed v' i From 602050893d65371911569eb086188c478049dea5 Mon Sep 17 00:00:00 2001 From: timmy Date: Fri, 27 Oct 2023 10:58:02 -0700 Subject: [PATCH 24/68] repeatable module import collisions --- gibbon-compiler/examples/Addone.hs | 4 ++-- gibbon-compiler/examples/Addtwo.hs | 4 ++-- gibbon-compiler/examples/addimport.hs | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs index d8060f609..4f0a37bec 100644 --- a/gibbon-compiler/examples/Addone.hs +++ b/gibbon-compiler/examples/Addone.hs @@ -1,8 +1,8 @@ module Addone where data Tree = Leaf Int | Node Tree Tree - add1 :: Tree -> Tree - add1 t = case t of + add/1 :: Tree -> Tree + add/1 t = case t of Leaf x -> Leaf (x + 1) Node x1 x2 -> Node (add1 x1) (add1 x2) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs index d8060f609..fe8682516 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/Addtwo.hs @@ -1,7 +1,7 @@ -module Addone where +module Addtwo where data Tree = Leaf Int | Node Tree Tree - add1 :: Tree -> Tree + add/1 :: Tree -> Tree add1 t = case t of Leaf x -> Leaf (x + 1) Node x1 x2 -> Node (add1 x1) (add1 x2) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index 008bce52d..f366dff69 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,7 +1,5 @@ module Addimport where import Addone - import Addtwo - main :: Tree - main = Addtwo.add1 2 (Addtwo.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + main = Addone.add1 2 (Addone.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file From 33f7d48ad0daf4794948a6936702266592fb50b7 Mon Sep 17 00:00:00 2001 From: timmy Date: Mon, 6 Nov 2023 06:38:57 -0800 Subject: [PATCH 25/68] declaration renaming works --- gibbon-compiler/build.log | 8 +++ gibbon-compiler/compile.log | 7 +++ gibbon-compiler/examples/add1.hs | 7 ++- gibbon-compiler/ir.log | 62 +++++++++++++++++++ gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 16 +++-- gibbon-compiler/src/Gibbon/Language/Syntax.hs | 1 + 6 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 gibbon-compiler/build.log create mode 100644 gibbon-compiler/compile.log create mode 100644 gibbon-compiler/ir.log diff --git a/gibbon-compiler/build.log b/gibbon-compiler/build.log new file mode 100644 index 000000000..cb9f8de35 --- /dev/null +++ b/gibbon-compiler/build.log @@ -0,0 +1,8 @@ +Build profile: -w ghc-9.2.8 -O1 +In order, the following will be built (use -v for more details): + - gibbon-0.3 (lib) (file src/Gibbon/Language/Syntax.hs changed) + - gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) + - gibbon-0.3 (exe:gibbon) (dependency rebuilt) +Preprocessing library for gibbon-0.3.. +Building library for gibbon-0.3.. +[16 of 61] Compiling Gibbon.NewL2.Syntax ( src/Gibbon/NewL2/Syntax.hs, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.o, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.dyn_o ) [Gibbon.Language.Syntax changed] diff --git a/gibbon-compiler/compile.log b/gibbon-compiler/compile.log new file mode 100644 index 000000000..7db011525 --- /dev/null +++ b/gibbon-compiler/compile.log @@ -0,0 +1,7 @@ +Build profile: -w ghc-9.2.8 -O1 +In order, the following will be built (use -v for more details): + - gibbon-0.3 (lib) (file src/Gibbon/HaskellFrontend.hs changed) + - gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) + - gibbon-0.3 (exe:gibbon) (dependency rebuilt) +Preprocessing library for gibbon-0.3.. +Building library for gibbon-0.3.. diff --git a/gibbon-compiler/examples/add1.hs b/gibbon-compiler/examples/add1.hs index b31d41695..d7bf4a5b7 100644 --- a/gibbon-compiler/examples/add1.hs +++ b/gibbon-compiler/examples/add1.hs @@ -1,9 +1,10 @@ +module Add where data Tree = Leaf Int | Node Tree Tree add1 :: Tree -> Tree add1 t = case t of Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) + Node x1 x2 -> Node (Add.add1 x1) (Add.add1 x2) -main :: Tree -main = add1 (Node (Leaf 1) (Leaf 2)) +gibbon_main :: Tree +gibbon_main = Add.add1 (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log new file mode 100644 index 000000000..654f12b2f --- /dev/null +++ b/gibbon-compiler/ir.log @@ -0,0 +1,62 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(Tree, + DDef {tyName = "Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], + fundefs = [(add1, + FunDef {funName = "Add.add1", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Add.add1" [] [VarE "x1"], + AppE "Add.add1" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (AppE "Add.add1" + [] + [DataConE (MetaTv $6) + "Node" + [DataConE (MetaTv $7) "Leaf" [LitE 1], + DataConE (MetaTv $8) "Leaf" [LitE 2]]], + MetaTv $9)} + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +Add_add1 t_10 = + case t_10 of + Leaf x_11::$2 -> + (Leaf $1 x_11 + 1) + Node x1_12::$4 x2_13::$5 -> + (Node $3 (Add_add1 [] x1_12) (Add_add1 [] x2_13)) + +gibbon_main :: $9 +gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) + + [compiler] Running pass, typecheck +gibbon: L0.Typecheck: + Unknown function: Add_add1 in Var "Add_add1" +CallStack (from HasCallStack): + error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 88a5730b0..b8bf23e6c 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,7 +200,9 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = + funs' = M.map (\funDef -> funDef {funName = toVar (mod_name ++ "." ++ (fromVar (funName funDef))) }) funs -- can insert function name here + --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here + funs'' = foldr (\v acc -> M.update @@ -208,18 +210,18 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports Just (fn {funMeta = funMeta {funInline = Inline}})) v acc) - funs + funs' inlines - funs'' = + funs''' = foldr (\v acc -> M.update (\fn -> Just (addLayoutMetaData fn optimizeDcons)) v acc) - funs' + funs'' (P.map fst (S.toList optimizeDcons)) - funs''' = + funs'''' = foldr (\k acc -> M.update @@ -234,7 +236,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports })) k acc) - funs'' + funs''' (M.keys userOrderings') imported_progs' <- mapM id imported_progs let (defs0, funs0) = @@ -1575,6 +1577,7 @@ desugarFun :: desugarFun type_syns toplevel env decl = case decl of FunBind _ [Match _ fname pats (UnGuardedRhs _ bod) _where] -> do + -- where it sets the name ^^ could pass in module name here let fname_str = nameToStr fname fname_var = toVar (fname_str) (vars, arg_tys, bindss) <- @@ -1588,6 +1591,7 @@ desugarFun type_syns toplevel env decl = let funty = ArrowTy arg_tys ret_ty pure $ (ForAll [] funty) Just ty -> pure ty + -- where it parses expressions \/\/ could parse module calls here bod' <- desugarExp type_syns toplevel bod pure $ (fname_var, args, unCurryTopTy fun_ty, (mkLets binds bod')) _ -> diff --git a/gibbon-compiler/src/Gibbon/Language/Syntax.hs b/gibbon-compiler/src/Gibbon/Language/Syntax.hs index b0f7bde91..4948c916c 100644 --- a/gibbon-compiler/src/Gibbon/Language/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/Language/Syntax.hs @@ -313,6 +313,7 @@ data FunMeta = FunMeta { funRec :: FunRec , funInline :: FunInline + --, funModule :: String -- Whether the transitive closure of this function can trigger GC. , funCanTriggerGC :: Bool , funOptLayout :: FunOptimizeLayout From 2a2c42ae9a17732ecce4d81d8230712ec98347b5 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 8 Nov 2023 09:08:02 -0800 Subject: [PATCH 26/68] module rename can modify function callsites and function decalrations, next up is actual resolution logic --- gibbon-compiler/gibbon.cabal | 1 + gibbon-compiler/ir.log | 27 +- gibbon-compiler/src/Gibbon/Compiler.hs | 2 + gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 5 +- .../src/Gibbon/Passes/ModuleRename.hs | 419 ++---------------- 5 files changed, 70 insertions(+), 384 deletions(-) diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index 706cb2f0c..0546d88e2 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -59,6 +59,7 @@ library Gibbon.NewL2.FromOldL2 -- compiler passes, roughly in the order they're run + Gibbon.Passes.ModuleRename Gibbon.Passes.Freshen Gibbon.Passes.Flatten Gibbon.Passes.InlineTriv diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index 654f12b2f..e6d9a648d 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -9,7 +9,7 @@ Prog {ddefs = [(Tree, ("Node", [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], fundefs = [(add1, - FunDef {funName = "Add.add1", + FunDef {funName = "*Add*add1", funArgs = [t], funTy = ForAll [] (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), @@ -38,25 +38,42 @@ Prog {ddefs = [(Tree, DataConE (MetaTv $8) "Leaf" [LitE 2]]], MetaTv $9)} + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data Tree = Leaf Int | + Node (Packed Tree []) (Packed Tree []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +*Add*add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +*Add*add1 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 1) + Node x1::$4 x2::$5 -> + (Node $3 (timmy-Add.add1 [] x1) (timmy-Add.add1 [] x2)) + +gibbon_main :: $9 +gibbon_main = (Add.add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) + [compiler] Running pass, freshen Pass output: ================================================================================ data Tree = Leaf Int | Node (Packed Tree []) (Packed Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -Add_add1 t_10 = +_Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) +_Add_add1 t_10 = case t_10 of Leaf x_11::$2 -> (Leaf $1 x_11 + 1) Node x1_12::$4 x2_13::$5 -> - (Node $3 (Add_add1 [] x1_12) (Add_add1 [] x2_13)) + (Node $3 (timmy_Add_add1 [] x1_12) (timmy_Add_add1 [] x2_13)) gibbon_main :: $9 gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, typecheck gibbon: L0.Typecheck: - Unknown function: Add_add1 in Var "Add_add1" + Unknown function: timmy_Add_add1 in Var "_Add_add1" CallStack (from HasCallStack): error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 910754f4e..8b6eeb532 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -59,6 +59,7 @@ import qualified Gibbon.L0.Specialize2 as L0 import qualified Gibbon.L1.Typecheck as L1 import qualified Gibbon.L2.Typecheck as L2 import qualified Gibbon.L3.Typecheck as L3 +import Gibbon.Passes.ModuleRename (moduleRename) import Gibbon.Passes.Freshen (freshNames) import Gibbon.Passes.Flatten (flattenL1, flattenL2, flattenL3) import Gibbon.Passes.InlineTriv (inlineTriv) @@ -651,6 +652,7 @@ passes config@Config{dynflags} l0 = do opt_layout_global = gopt Opt_Layout_Global dynflags use_solver = gopt Opt_Layout_Use_Solver dynflags tcProg3 = L3.tcProg isPacked + l0 <- go "renameModules" moduleRename l0 l0 <- go "freshen" freshNames l0 l0 <- goE0 "typecheck" L0.tcProg l0 l0 <- goE0 "bindLambdas" L0.bindLambdas l0 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index b8bf23e6c..76997367b 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,7 +200,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = M.map (\funDef -> funDef {funName = toVar (mod_name ++ "." ++ (fromVar (funName funDef))) }) funs -- can insert function name here + funs' = M.map (\funDef -> funDef {funName = toVar ("*" ++ mod_name ++ "*" ++ (fromVar (funName funDef))) }) funs -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = foldr @@ -749,8 +749,10 @@ desugarExp type_syns toplevel e = -- | (qnameToStr f) == "error" -> pure $ PrimAppE (ErrorP (litToString lit Paren _ e2 -> desugarExp type_syns toplevel e2 H.Var _ qv -> do + -- where the expression name is parsed (for all expressions) let str = qnameToStr qv v = (toVar str) + -- v = (toVar ("timmy-" ++ str)) if str == "alloc_pdict" then do kty <- newMetaTy @@ -1567,6 +1569,7 @@ desugarExp type_syns toplevel e = pure $ PrimAppE SubP [LitE 0, e1'] _ -> error ("desugarExp: Unsupported expression: " ++ prettyPrint e) +-- parse function declarations desugarFun :: (Show a, Pretty a) => TypeSynEnv diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index d72d735df..8184e1cd6 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -3,7 +3,7 @@ -- | Unique names. -module Gibbon.Passes.ModuleRename (renameNames) where +module Gibbon.Passes.ModuleRename (moduleRename) where import Gibbon.Pretty @@ -22,402 +22,65 @@ import qualified Gibbon.L1.Syntax as L1 type VarEnv = M.Map Var Var type TyVarEnv t = M.Map TyVar t -renameNames :: Prog0 -> PassM Prog0 -renameNames (Prog defs funs main) = +moduleRename :: Prog0 -> PassM Prog0 +moduleRename (Prog defs funs main) = let _ = dbgPrintLn 2 (show defs) in - do main' <- case main of - Nothing -> return Nothing - Just (m,ty) -> do m' <- freshExp M.empty M.empty m - return $ Just (m',ty) - defs' <- traverse freshDDef defs - funs' <- M.mapKeys cleanFunName <$> traverse freshFun funs - return $ Prog defs' funs' main' + do --main' <- case main of + -- Nothing -> return Nothing + -- Just (m,ty) -> do m' <- freshExp M.empty M.empty m + -- return $ Just (m',ty) + --defs' <- traverse freshDDef defs + --funs' <- *traverse map* resolveFunModuleNames funs + funs' <- traverse (\v -> resolveModsInFuns v defs funs) funs + return $ Prog defs funs' main freshDDef :: DDef Ty0 -> PassM (DDef Ty0) -freshDDef DDef{tyName,tyArgs,dataCons} = do - rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tyArgs - let env :: TyVarEnv Ty0 - env = M.fromList $ zip tyArgs (map TyVar rigid_tyvars) - dataCons' <- mapM (\(dcon,vs) -> (dcon,) <$> mapM (go (sdoc (dcon,vs)) rigid_tyvars env) vs) dataCons - pure (DDef tyName rigid_tyvars dataCons') - where - go :: String -> [TyVar] -> TyVarEnv Ty0 -> (t, Ty0) -> PassM (t, Ty0) - go msg bound env (b, ty) = do - (_, ty') <- freshTy env ty - let free_tvs = tyVarsInTy ty' L.\\ bound - if free_tvs == [] - then pure (b, ty') - else error $ "freshDDef: Unbound type variables " ++ sdoc free_tvs - ++ " in the constructor:\n" ++ msg +freshDDef DDef{tyName,tyArgs,dataCons} = + do pure $ DDef tyName tyArgs dataCons -freshFun :: FunDef Exp0 -> PassM (FunDef Exp0) -freshFun (FunDef nam nargs funty bod meta) = - do nargs' <- mapM gensym nargs - let msubst = (M.fromList $ zip nargs nargs') - (tvenv, funty') <- freshTyScheme funty - funty'' <- freshDictTyScheme msubst funty' - bod' <- freshExp msubst tvenv bod - let nam' = cleanFunName nam - pure $ FunDef nam' nargs' funty'' bod' meta +resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> FunDefs Exp0 -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defs funs = + do + bod' <- resolveModInBod funs bod + pure $ FunDef nam nargs funty bod' meta --- -freshTyScheme :: TyScheme -> PassM (TyVarEnv Ty0, TyScheme) -freshTyScheme (ForAll tvs ty) = do - rigid_tyvars <- mapM (\(UserTv v) -> BoundTv <$> gensym v) tvs - let env = M.fromList $ zip tvs (map TyVar rigid_tyvars) - (env', ty') <- freshTy env ty - pure (env', ForAll rigid_tyvars ty') - -freshTy :: TyVarEnv Ty0 -> Ty0 -> PassM (TyVarEnv Ty0, Ty0) -freshTy env ty = - case ty of - IntTy -> pure (env, ty) - CharTy -> pure (env, ty) - FloatTy -> pure (env, ty) - SymTy0 -> pure (env, ty) - BoolTy -> pure (env, ty) - ArenaTy -> pure (env, ty) - SymSetTy -> pure (env, ty) - SymHashTy -> pure (env, ty) - TyVar tv -> case M.lookup tv env of - Nothing -> do tv' <- newTyVar - pure (env, TyVar tv') - Just tv' -> pure (env, tv') - MetaTv{} -> pure (env, ty) - ProdTy tys -> do (env', tys') <- freshTys env tys - pure (env', ProdTy tys') - SymDictTy v t -> do (env', t') <- freshTy env t - pure (env', SymDictTy v t') - PDictTy k v -> do (env', k') <- freshTy env k - (env'', v') <- freshTy env' v - pure (env'', PDictTy k' v') - ArrowTy tys t -> do (env', tys') <- freshTys env tys - (env'', [t']) <- freshTys env' [t] - pure (env'', ArrowTy tys' t') - PackedTy tycon tys -> do (env', tys') <- freshTys env tys - pure (env', PackedTy tycon tys') - VectorTy el_t -> do (env', el_t') <- freshTy env el_t - pure (env', VectorTy el_t') - ListTy el_t -> do (env', el_t') <- freshTy env el_t - pure (env', ListTy el_t') - IntHashTy -> pure (env, ty) - -freshTys :: TyVarEnv (TyOf Exp0) -> [Ty0] -> PassM (TyVarEnv (TyOf Exp0), [Ty0]) -freshTys env tys = - foldrM - (\t (env', acc) -> do - (env'', t') <- freshTy env' t - pure (env' <> env'', t' : acc)) - (env, []) - tys - -freshDictTy :: Monad m => M.Map Var Var -> Ty0 -> m Ty0 -freshDictTy m ty = - case ty of - IntTy -> pure ty - CharTy -> pure ty - FloatTy -> pure ty - SymTy0 -> pure ty - BoolTy -> pure ty - ArenaTy -> pure ty - TyVar _tv -> pure ty - MetaTv{} -> pure ty - ProdTy tys -> - do tys' <- mapM (freshDictTy m) tys - pure (ProdTy tys') - SymDictTy (Just v) t -> - do t' <- freshDictTy m t - case M.lookup v m of - Just v' -> pure $ SymDictTy (Just v') t' - Nothing -> pure ty - SymDictTy Nothing t -> - do t' <- freshDictTy m t - pure $ SymDictTy Nothing t' - PDictTy k v -> - do k' <- freshDictTy m k - v' <- freshDictTy m v - pure $ PDictTy k' v' - ArrowTy tys t -> - do tys' <- mapM (freshDictTy m) tys - t' <- freshDictTy m t - pure $ ArrowTy tys' t' - PackedTy tycon tys -> - do tys' <- mapM (freshDictTy m) tys - pure $ PackedTy tycon tys' - VectorTy el_t -> - do el_t' <- freshDictTy m el_t - pure $ VectorTy el_t' - ListTy el_t -> - do el_t' <- freshDictTy m el_t - pure $ ListTy el_t' - SymSetTy -> pure ty - SymHashTy -> pure ty - IntHashTy -> pure ty - -freshDictTyScheme :: Monad m => - M.Map Var Var -> TyScheme -> m TyScheme -freshDictTyScheme m (ForAll tvs ty) = - do ty' <- freshDictTy m ty - pure $ ForAll tvs ty' - -freshExp :: VarEnv -> TyVarEnv Ty0 -> Exp0 -> PassM Exp0 -freshExp venv tvenv exp = +resolveModInBod :: FunDefs Exp0 -> Exp0 -> PassM Exp0 +resolveModInBod funs exp = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c FloatE i -> return $ FloatE i LitSymE v -> return $ LitSymE v - - VarE v -> - case M.lookup v venv of - Nothing -> return $ VarE (cleanFunName v) - Just v' -> return $ VarE (cleanFunName v') - - AppE v locs ls -> assert ([] == locs) $ do - ls' <- mapM go ls - case M.lookup v venv of - Nothing -> return $ AppE (cleanFunName v) [] ls' - Just v' -> return $ AppE (cleanFunName v') [] ls' - - PrimAppE p es -> do - es' <- mapM go es - return $ PrimAppE p es' + --VarE v -> return $ VarE (varAppend (toVar "seen-") v) + VarE v -> return $ VarE v + AppE v locs ls -> return $ AppE (varAppend (toVar "timmy-") v) locs ls + PrimAppE p es -> return $ PrimAppE p es LetE (v,_locs,ty, e1) e2 -> do - let user_tvs = filter isUserTv $ tyVarsInTy ty - rigid_tyvars <- mapM (\(UserTv w) -> - case M.lookup (UserTv w) tvenv of - Just (TyVar tv) -> pure tv - Just oth -> error $ "freshExp: UserTv bound to: " ++ sdoc oth - Nothing -> BoundTv <$> gensym w) - user_tvs - let env = M.fromList $ zip user_tvs (map TyVar rigid_tyvars) - tvenv' = env <> tvenv - - (_tvenv'', ty') <- freshTy tvenv' ty - e1' <- freshExp venv tvenv' e1 - v' <- gensym (cleanFunName v) - e2' <- freshExp (M.insert v v' venv) tvenv e2 - ty'' <- case ty' of - SymDictTy (Just w) ty2 -> case M.lookup w venv of - Nothing -> return ty' - Just w' -> return $ SymDictTy (Just w') ty2 - _ -> return ty' - return $ LetE (v',[],ty'',e1') e2' - - IfE e1 e2 e3 -> do - e1' <- go e1 - e2' <- go e2 - e3' <- go e3 - return $ IfE e1' e2' e3' + e1' <- resolveModInBod funs e1 + e2' <- resolveModInBod funs e2 + return $ LetE (v, [], ty, e1') e2' - ProjE i e -> do - e' <- go e - return $ ProjE i e' - - MkProdE es -> do - es' <- mapM go es - return $ MkProdE es' + IfE e1 e2 e3 -> return $ IfE e1 e2 e3 + ProjE i e -> return $ ProjE i e + MkProdE es -> return $ MkProdE es CaseE e mp -> do - e' <- go e + e' <- resolveModInBod funs e mp' <- mapM (\(c,prs,ae) -> do - let (args,locs) = unzip prs - args' <- mapM gensym args - let venv' = M.fromList (zip args args') `M.union` venv - ae' <- freshExp venv' tvenv ae - return (c, zip args' locs, ae')) mp + ae' <- resolveModInBod funs ae + return (c, prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- mapM go es + es' <- traverse (\v -> resolveModInBod funs v) es return $ DataConE loc c es' - TimeIt e t b -> do - e' <- go e - return $ TimeIt e' t b - - WithArenaE v e -> do - v' <- gensym v - e' <- freshExp (M.insert v v' venv) tvenv e - return $ WithArenaE v' e' - - SpawnE v locs ls -> assert ([] == locs) $ do - ls' <- mapM go ls - case M.lookup v venv of - Nothing -> return $ SpawnE (cleanFunName v) [] ls' - Just v' -> return $ SpawnE (cleanFunName v') [] ls' - - SyncE -> pure SyncE - - MapE (v,t,b) e -> do - b' <- go b - e' <- go e - return $ MapE (v,t,b') e' - - FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do - e1' <- go e1 - e2' <- go e2 - e3' <- go e3 - return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' - - -- Ext ext -> Ext <$> gFreshenExp venv tvenv ext - - Ext ext -> - case ext of - LambdaE args bod -> do - (venv', vs, ts) <- foldrM - (\(v,t) (acc1, acc2, acc3) -> do - v' <- gensym v - let acc1' = M.insert v v' acc1 - (_tvenv', t') <- freshTy tvenv t - pure (acc1', v':acc2, t': acc3)) - (venv,[],[]) args - Ext <$> (LambdaE (zip vs ts) <$> (freshExp venv' tvenv bod)) - FunRefE tyapps f -> - case M.lookup f venv of - Nothing -> pure $ Ext $ FunRefE tyapps (cleanFunName f) - Just f' -> pure $ Ext $ FunRefE tyapps (cleanFunName f') - PolyAppE{} -> error "freshExp: TODO, PolyAppE." - - BenchE fn tyapps args b -> do - args' <- mapM go args - pure $ Ext (BenchE (cleanFunName fn) tyapps args' b) - - ParE0 ls -> Ext <$> ParE0 <$> mapM go ls - L p e -> Ext <$> (L p) <$> go e - PrintPacked ty arg -> do - (tvenv', ty') <- freshTy tvenv ty - arg' <- freshExp venv tvenv' arg - pure $ Ext $ PrintPacked ty' arg' - CopyPacked ty arg -> do - (tvenv', ty') <- freshTy tvenv ty - arg' <- freshExp venv tvenv' arg - pure $ Ext $ CopyPacked ty' arg' - TravPacked ty arg -> do - (tvenv', ty') <- freshTy tvenv ty - arg' <- freshExp venv tvenv' arg - pure $ Ext $ TravPacked ty' arg' - LinearExt{} -> error $ "freshenExp: a linear types extension wasn't desugared: " ++ sdoc exp - - where go = freshExp venv tvenv - - --- copy-paste. - -freshNames1 :: L1.Prog1 -> PassM L1.Prog1 -freshNames1 (L1.Prog defs funs main) = - do main' <- case main of - Nothing -> return Nothing - Just (m,ty) -> do m' <- freshExp1 M.empty m - return $ Just (m',ty) - funs' <- traverse freshFun1 funs - return $ L1.Prog defs funs' main' - -freshFun1 :: L1.FunDef1 -> PassM L1.FunDef1 -freshFun1 (FunDef nam nargs (targ,ty) bod meta) = do - nargs' <- mapM gensym nargs - let msubst = (M.fromList $ zip nargs nargs') - bod' <- freshExp1 msubst bod - -- let nam' = cleanFunName nam - return $ FunDef nam nargs' (targ,ty) bod' meta - - -freshExp1 :: VarEnv -> L1.Exp1 -> PassM L1.Exp1 -freshExp1 vs exp = - case exp of - LitE i -> return $ LitE i - CharE c -> return $ CharE c - FloatE i -> return $ FloatE i - LitSymE v -> return $ LitSymE v - - VarE v -> - case M.lookup v vs of - Nothing -> return $ VarE v - Just v' -> return $ VarE v' - - AppE v locs ls -> assert ([] == locs) $ do - ls' <- mapM (freshExp1 vs) ls - case M.lookup v vs of - Nothing -> return $ AppE (cleanFunName v) [] ls' - Just v' -> return $ AppE (cleanFunName v') [] ls' - - PrimAppE p es -> do - es' <- mapM (freshExp1 vs) es - return $ PrimAppE p es' - - LetE (v,locs,t, e1) e2 -> assert ([]==locs) $ do - e1' <- freshExp1 vs e1 - v' <- gensym v - e2' <- freshExp1 (M.insert v v' vs) e2 - return $ LetE (v',[],t,e1') e2' - - IfE e1 e2 e3 -> do - e1' <- freshExp1 vs e1 - e2' <- freshExp1 vs e2 - e3' <- freshExp1 vs e3 - return $ IfE e1' e2' e3' - - ProjE i e -> do - e' <- freshExp1 vs e - return $ ProjE i e' - - MkProdE es -> do - es' <- mapM (freshExp1 vs) es - return $ MkProdE es' - - CaseE e mp -> do - e' <- freshExp1 vs e - -- Here we freshen locations: - mp' <- mapM (\(c,prs,ae) -> - let (args,_) = unzip prs in - do - args' <- mapM gensym args - let vs' = (M.fromList $ zip args args') `M.union` vs - ae' <- freshExp1 vs' ae - return (c, map (,()) args', ae')) mp - return $ CaseE e' mp' - - DataConE () c es -> do - es' <- mapM (freshExp1 vs) es - return $ DataConE () c es' - - TimeIt e t b -> do - e' <- freshExp1 vs e - return $ TimeIt e' t b - - SpawnE v locs ls -> assert ([] == locs) $ do - ls' <- mapM (freshExp1 vs) ls - case M.lookup v vs of - Nothing -> return $ SpawnE (cleanFunName v) [] ls' - Just v' -> return $ SpawnE (cleanFunName v') [] ls' - - SyncE -> pure SyncE - - MapE (v,t,b) e -> do - b' <- freshExp1 vs b - e' <- freshExp1 vs e - return $ MapE (v,t,b') e' - - FoldE (v1,t1,e1) (v2,t2,e2) e3 -> do - e1' <- freshExp1 vs e1 - e2' <- freshExp1 vs e2 - e3' <- freshExp1 vs e3 - return $ FoldE (v1,t1,e1') (v2,t2,e2') e3' - - WithArenaE{} -> error "freshExp1: WithArenaE not handled." - - Ext (L1.BenchE fn tyapps args b) -> do - args' <- mapM (freshExp1 vs) args - pure $ Ext (L1.BenchE (cleanFunName fn) tyapps args' b) - - Ext (L1.StartOfPkdCursor cur) -> do - case M.lookup cur vs of - Nothing -> return $ Ext $ L1.StartOfPkdCursor cur - Just v' -> return $ Ext $ L1.StartOfPkdCursor v' - - Ext (L1.AddFixed v i) -> do - case M.lookup v vs of - Nothing -> return $ Ext $ L1.AddFixed v i - Just v' -> return $ Ext $ L1.AddFixed v' i + TimeIt e t b -> return $ TimeIt e t b + WithArenaE v e -> return $ WithArenaE v e + SpawnE v locs ls -> return $ SpawnE v locs ls + SyncE -> return $ SyncE + MapE v e -> return $ MapE v e + FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + Ext ext -> return $ Ext ext From c5f48c6b7499458c73e33f11515cc35f3667cf5c Mon Sep 17 00:00:00 2001 From: timmy Date: Fri, 10 Nov 2023 14:38:06 -0800 Subject: [PATCH 27/68] finished basic module import resolution --- gibbon-compiler/ir.log | 28 +++---- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 2 +- .../src/Gibbon/Passes/ModuleRename.hs | 82 +++++++++++++++---- 3 files changed, 80 insertions(+), 32 deletions(-) diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index e6d9a648d..f2a96e11a 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -8,8 +8,8 @@ Prog {ddefs = [(Tree, dataCons = [("Leaf", [(False, IntTy)]), ("Node", [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], - fundefs = [(add1, - FunDef {funName = "*Add*add1", + fundefs = [(Add.add1, + FunDef {funName = "Add.add1", funArgs = [t], funTy = ForAll [] (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), @@ -44,13 +44,13 @@ Pass output: data Tree = Leaf Int | Node (Packed Tree []) (Packed Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -*Add*add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -*Add*add1 t = +Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) +Add_add1_10 t = case t of Leaf x::$2 -> (Leaf $1 x + 1) Node x1::$4 x2::$5 -> - (Node $3 (timmy-Add.add1 [] x1) (timmy-Add.add1 [] x2)) + (Node $3 (Add_add1_10 [] x1) (Add_add1_10 [] x2)) gibbon_main :: $9 gibbon_main = (Add.add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) @@ -61,19 +61,19 @@ Pass output: data Tree = Leaf Int | Node (Packed Tree []) (Packed Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_Add_add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -_Add_add1 t_10 = - case t_10 of - Leaf x_11::$2 -> - (Leaf $1 x_11 + 1) - Node x1_12::$4 x2_13::$5 -> - (Node $3 (timmy_Add_add1 [] x1_12) (timmy_Add_add1 [] x2_13)) +Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) +Add_add1_10 t_11 = + case t_11 of + Leaf x_12::$2 -> + (Leaf $1 x_12 + 1) + Node x1_13::$4 x2_14::$5 -> + (Node $3 (Add_add1_10 [] x1_13) (Add_add1_10 [] x2_14)) gibbon_main :: $9 gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, typecheck gibbon: L0.Typecheck: - Unknown function: timmy_Add_add1 in Var "_Add_add1" + Unknown function: Add_add1 CallStack (from HasCallStack): - error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck + error, called at src/Gibbon/L0/Typecheck.hs:66:32 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 76997367b..13c891cb5 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,7 +200,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = M.map (\funDef -> funDef {funName = toVar ("*" ++ mod_name ++ "*" ++ (fromVar (funName funDef))) }) funs -- can insert function name here + funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = foldr diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 8184e1cd6..ae6fddaf8 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -19,34 +19,70 @@ import qualified Gibbon.L1.Syntax as L1 -------------------------------------------------------------------------------- -type VarEnv = M.Map Var Var +type VarEnv = M.Map Var (M.Map Var Var) type TyVarEnv t = M.Map TyVar t moduleRename :: Prog0 -> PassM Prog0 moduleRename (Prog defs funs main) = - let _ = dbgPrintLn 2 (show defs) - in do --main' <- case main of -- Nothing -> return Nothing -- Just (m,ty) -> do m' <- freshExp M.empty M.empty m -- return $ Just (m',ty) --defs' <- traverse freshDDef defs --funs' <- *traverse map* resolveFunModuleNames funs - funs' <- traverse (\v -> resolveModsInFuns v defs funs) funs - return $ Prog defs funs' main + renamedFuns <- mapM (\k -> (gensym k)) (M.keys funs) + let nameMap = M.fromList $ zip (M.keys funs) renamedFuns + let init :: VarEnv = M.empty + let (env, _) = M.mapAccumWithKey buildEnv init nameMap + --let funs' = M.mapKeys (\k -> resolveNameInEnv () env) funs + let _ = dbgPrintLn 2 "hello?" + let transformKey :: Var -> Var + transformKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name env + funs' <- traverse (\v -> resolveModsInFuns v defs env) funs + let funs'' = M.mapKeys transformKey funs' + return $ Prog defs funs'' main + +buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv env k v = do + let (mod, name) = parseOutMod k + let mod' = case mod of + Just m -> m + Nothing -> (toVar "") + case (M.lookup name env) of + Just m -> + if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + else ((M.insert name (M.insert mod' v m) env), v) + Nothing -> ((M.insert name (M.singleton mod' v) env), v) + +resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var +resolveNameInEnv mod name e = + do case (M.lookup name e) of + Just modspace -> case mod of + Just m -> case (M.lookup m modspace) of + Just n -> n + Nothing -> error $ "can't find function " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find function " ++ (fromVar name) + Nothing -> error $ "can't find function " ++ (fromVar name) freshDDef :: DDef Ty0 -> PassM (DDef Ty0) freshDDef DDef{tyName,tyArgs,dataCons} = do pure $ DDef tyName tyArgs dataCons -resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> FunDefs Exp0 -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defs funs = +--funRename :: FunDef Exp0 -> FunDef Exp0 +--funRename (FunDef nam nargs funty bod meta) = FunDef (gensym nam) nargs funty bod meta + +resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defs env = do - bod' <- resolveModInBod funs bod - pure $ FunDef nam nargs funty bod' meta + let (mod, name) = parseOutMod nam + bod' <- resolveModInBod bod env + pure $ FunDef (resolveNameInEnv mod name env) nargs funty bod' meta -resolveModInBod :: FunDefs Exp0 -> Exp0 -> PassM Exp0 -resolveModInBod funs exp = +resolveModInBod :: Exp0 -> VarEnv -> PassM Exp0 +resolveModInBod exp env = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c @@ -54,12 +90,17 @@ resolveModInBod funs exp = LitSymE v -> return $ LitSymE v --VarE v -> return $ VarE (varAppend (toVar "seen-") v) VarE v -> return $ VarE v - AppE v locs ls -> return $ AppE (varAppend (toVar "timmy-") v) locs ls + + AppE v locs ls -> do + let (mod, fun) = parseOutMod v + let v' = resolveNameInEnv mod fun env + return $ AppE v' locs ls + PrimAppE p es -> return $ PrimAppE p es LetE (v,_locs,ty, e1) e2 -> do - e1' <- resolveModInBod funs e1 - e2' <- resolveModInBod funs e2 + e1' <- resolveModInBod e1 env + e2' <- resolveModInBod e2 env return $ LetE (v, [], ty, e1') e2' IfE e1 e2 e3 -> return $ IfE e1 e2 e3 @@ -67,14 +108,14 @@ resolveModInBod funs exp = MkProdE es -> return $ MkProdE es CaseE e mp -> do - e' <- resolveModInBod funs e + e' <- resolveModInBod e env mp' <- mapM (\(c,prs,ae) -> do - ae' <- resolveModInBod funs ae + ae' <- resolveModInBod ae env return (c, prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- traverse (\v -> resolveModInBod funs v) es + es' <- traverse (\v -> resolveModInBod v env) es return $ DataConE loc c es' TimeIt e t b -> return $ TimeIt e t b @@ -84,3 +125,10 @@ resolveModInBod funs exp = MapE v e -> return $ MapE v e FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 Ext ext -> return $ Ext ext + +parseOutMod :: Var -> (Maybe Var, Var) +parseOutMod v = do + let str = (fromVar v) + case (L.elemIndices '.' str) of + [] -> (Nothing, v) + x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) \ No newline at end of file From 826eb0cd9607c1e8cfe543b20df2200a759e6c65 Mon Sep 17 00:00:00 2001 From: timmy Date: Fri, 10 Nov 2023 18:56:13 -0800 Subject: [PATCH 28/68] parses modules in defs and main as well --- gibbon-compiler/ir.log | 2757 ++++++++++++++++- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 3 +- .../src/Gibbon/Passes/ModuleRename.hs | 175 +- 3 files changed, 2854 insertions(+), 81 deletions(-) diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index f2a96e11a..e0f9c3ec0 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -2,8 +2,8 @@ ! We set DEBUG based on command-line verbose arg: 4 [compiler] pipeline starting, parsed program: ================================================================================ -Prog {ddefs = [(Tree, - DDef {tyName = "Tree", +Prog {ddefs = [(Add.Tree, + DDef {tyName = "Add.Tree", tyArgs = [], dataCons = [("Leaf", [(False, IntTy)]), ("Node", @@ -41,39 +41,2752 @@ Prog {ddefs = [(Tree, [compiler] Running pass, renameModules Pass output: ================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) -Add_add1_10 t = +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t = case t of Leaf x::$2 -> (Leaf $1 x + 1) Node x1::$4 x2::$5 -> - (Node $3 (Add_add1_10 [] x1) (Add_add1_10 [] x2)) + (Node $3 (Add_add1_11 [] x1) (Add_add1_11 [] x2)) gibbon_main :: $9 -gibbon_main = (Add.add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, freshen Pass output: ================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_10 :: forall. ((Packed Tree []) -> (Packed Tree [])) -Add_add1_10 t_11 = - case t_11 of - Leaf x_12::$2 -> - (Leaf $1 x_12 + 1) - Node x1_13::$4 x2_14::$5 -> - (Node $3 (Add_add1_10 [] x1_13) (Add_add1_10 [] x2_14)) +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::$2 -> + (Leaf $1 x_13 + 1) + Node x1_14::$4 x2_15::$5 -> + (Node $3 (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) gibbon_main :: $9 -gibbon_main = (Add_add1 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) [compiler] Running pass, typecheck -gibbon: L0.Typecheck: - Unknown function: Add_add1 -CallStack (from HasCallStack): - error, called at src/Gibbon/L0/Typecheck.hs:66:32 in gibbon-0.3-inplace:Gibbon.L0.Typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, bindLambdas +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, monomorphize +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, specLambdas +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 1) + Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, desugarL0 +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 1) + Node x1_14::() x2_15::() -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29::() -> + let y_30 :: Int = x_29 in + (Leaf () y_30) + Node x_31::() x_32::() -> + let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in + (Node () y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36::() -> + let y_37 :: Int = x_36 in + (Leaf () y_37) + Node x_38::() x_39::() -> + let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node () y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43::() -> + () + Node x_45::() x_46::() -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50::() -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55::() x_56::() -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, floatOutCase +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 1) + Node x1_14::() x2_15::() -> + (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29::() -> + let y_30 :: Int = x_29 in + (Leaf () y_30) + Node x_31::() x_32::() -> + let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in + (Node () y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36::() -> + let y_37 :: Int = x_36 in + (Leaf () y_37) + Node x_38::() x_39::() -> + let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node () y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43::() -> + () + Node x_45::() x_46::() -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50::() -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55::() x_56::() -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10 []) +gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) + + [compiler] Running pass, toL1 +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, benchMainExp +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 1) + Node x1_14 x2_15 -> + (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28 = + case arg_28 of + Leaf x_29 -> + let y_30 :: Int = x_29 in + (Leaf y_30) + Node x_31 x_32 -> + let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in + let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in + (Node y_33 y_34) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35 = + case arg_35 of + Leaf x_36 -> + let y_37 :: Int = x_36 in + (Leaf y_37) + Node x_38 x_39 -> + let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in + let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in + (Node y_40 y_41) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42 = + case arg_42 of + Leaf x_43 -> + () + Node x_45 x_46 -> + let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in + let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49 = + case arg_49 of + Leaf x_50 -> + let wildcard_52 :: () = printsym("(Leaf") in + let wildcard_54 :: () = printsym(" ") in + let y_51 :: () = printint(x_50) in + let wildcard_53 :: () = printsym(")") in + () + Node x_55 x_56 -> + let wildcard_59 :: () = printsym("(Node") in + let wildcard_62 :: () = printsym(" ") in + let y_57 :: () = (_print_Add_Tree_10 [] x_55) in + let wildcard_61 :: () = printsym(" ") in + let y_58 :: () = (_print_Add_Tree_10 [] x_56) in + let wildcard_60 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63 = + case t_12_63 of + Leaf x_13_64 -> + (Leaf x_13_64 + 1) + Node x1_14_65 x2_15_66 -> + (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67 = + case arg_28_67 of + Leaf x_29_68 -> + let y_30_69 :: Int = x_29_68 in + (Leaf y_30_69) + Node x_31_70 x_32_71 -> + let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in + let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in + (Node y_33_72 y_34_73) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74 = + case arg_35_74 of + Leaf x_36_75 -> + let y_37_76 :: Int = x_36_75 in + (Leaf y_37_76) + Node x_38_77 x_39_78 -> + let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in + let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in + (Node y_40_79 y_41_80) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81 = + case arg_42_81 of + Leaf x_43_82 -> + () + Node x_45_83 x_46_84 -> + let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in + let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87 = + case arg_49_87 of + Leaf x_50_88 -> + let wildcard_52_89 :: () = printsym("(Leaf") in + let wildcard_54_90 :: () = printsym(" ") in + let y_51_91 :: () = printint(x_50_88) in + let wildcard_53_92 :: () = printsym(")") in + () + Node x_55_93 x_56_94 -> + let wildcard_59_95 :: () = printsym("(Node") in + let wildcard_62_96 :: () = printsym(" ") in + let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in + let wildcard_61_98 :: () = printsym(" ") in + let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in + let wildcard_60_100 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63 = + case t_12_63 of + Leaf x_13_64 -> + (Leaf x_13_64 + 1) + Node x1_14_65 x2_15_66 -> + (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67 = + case arg_28_67 of + Leaf x_29_68 -> + let y_30_69 :: Int = x_29_68 in + (Leaf y_30_69) + Node x_31_70 x_32_71 -> + let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in + let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in + (Node y_33_72 y_34_73) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74 = + case arg_35_74 of + Leaf x_36_75 -> + let y_37_76 :: Int = x_36_75 in + (Leaf y_37_76) + Node x_38_77 x_39_78 -> + let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in + let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in + (Node y_40_79 y_41_80) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81 = + case arg_42_81 of + Leaf x_43_82 -> + () + Node x_45_83 x_46_84 -> + let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in + let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87 = + case arg_49_87 of + Leaf x_50_88 -> + let wildcard_52_89 :: () = printsym("(Leaf") in + let wildcard_54_90 :: () = printsym(" ") in + let y_51_91 :: () = printint(x_50_88) in + let wildcard_53_92 :: () = printsym(")") in + () + Node x_55_93 x_56_94 -> + let wildcard_59_95 :: () = printsym("(Node") in + let wildcard_62_96 :: () = printsym(" ") in + let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in + let wildcard_61_98 :: () = printsym(" ") in + let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in + let wildcard_60_100 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) + + [compiler] Running pass, flatten +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63 = + case t_12_63 of + Leaf x_13_64 -> + let fltPkd_104 :: Int = x_13_64 + 1 in + (Leaf fltPkd_104) + Node x1_14_65 x2_15_66 -> + let fltPkd_105 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65) in + let fltPkd_106 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66) in + (Node fltPkd_105 fltPkd_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67 = + case arg_28_67 of + Leaf x_29_68 -> + let y_30_69 :: Int = x_29_68 in + (Leaf y_30_69) + Node x_31_70 x_32_71 -> + let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in + let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in + (Node y_33_72 y_34_73) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74 = + case arg_35_74 of + Leaf x_36_75 -> + let y_37_76 :: Int = x_36_75 in + (Leaf y_37_76) + Node x_38_77 x_39_78 -> + let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in + let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in + (Node y_40_79 y_41_80) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81 = + case arg_42_81 of + Leaf x_43_82 -> + () + Node x_45_83 x_46_84 -> + let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in + let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87 = + case arg_49_87 of + Leaf x_50_88 -> + let wildcard_52_89 :: () = printsym("(Leaf") in + let wildcard_54_90 :: () = printsym(" ") in + let y_51_91 :: () = printint(x_50_88) in + let wildcard_53_92 :: () = printsym(")") in + () + Node x_55_93 x_56_94 -> + let wildcard_59_95 :: () = printsym("(Node") in + let wildcard_62_96 :: () = printsym(" ") in + let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in + let wildcard_61_98 :: () = printsym(" ") in + let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in + let wildcard_60_100 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101 :: (Packed Add_Tree_10) = (Node fltPkd_102 fltPkd_103) in + (Add_add1_11 [] fltAppE_101) + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + let y_30_69_119 :: Int = x_29_68_118 in + (Leaf y_30_69_119) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + let y_37_76_126 :: Int = x_36_75_125 in + (Leaf y_37_76_126) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, inlineTriv +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node (Packed Add_Tree_10) (Packed Add_Tree_10) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in + let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in + let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, directL3 +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + (Add_add1_11 [] fltAppE_101_109) + + [compiler] Running pass, unariser +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, L3.flatten +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data Add_Tree_10 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Add_add1_11 :: Cursor -> Cursor +Add_add1_11 t_12_63_110 = + case t_12_63_110 of + Leaf x_13_64_111 -> + let fltPkd_104_112 :: Int = x_13_64_111 + 1 in + (Leaf fltPkd_104_112) + Node x1_14_65_113 x2_15_66_114 -> + let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in + let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in + (Node fltPkd_105_115 fltPkd_106_116) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_Add_Tree_10 :: Cursor -> Cursor +_copy_Add_Tree_10 arg_28_67_117 = + case arg_28_67_117 of + Leaf x_29_68_118 -> + (Leaf x_29_68_118) + Node x_31_70_120 x_32_71_121 -> + let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in + let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in + (Node y_33_72_122 y_34_73_123) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor +_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = + case arg_35_74_124 of + Leaf x_36_75_125 -> + (Leaf x_36_75_125) + Node x_38_77_127 x_39_78_128 -> + let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in + let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in + (Node y_40_79_129 y_41_80_130) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_Add_Tree_10 :: Cursor -> () +_traverse_Add_Tree_10 arg_42_81_131 = + case arg_42_81_131 of + Leaf x_43_82_132 -> + () + Node x_45_83_133 x_46_84_134 -> + let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in + let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_Add_Tree_10 :: Cursor -> () +_print_Add_Tree_10 arg_49_87_137 = + case arg_49_87_137 of + Leaf x_50_88_138 -> + let wildcard_52_89_139 :: () = printsym("(Leaf") in + let wildcard_54_90_140 :: () = printsym(" ") in + let y_51_91_141 :: () = printint(x_50_88_138) in + let wildcard_53_92_142 :: () = printsym(")") in + () + Node x_55_93_143 x_56_94_144 -> + let wildcard_59_95_145 :: () = printsym("(Node") in + let wildcard_62_96_146 :: () = printsym(" ") in + let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in + let wildcard_61_98_148 :: () = printsym(" ") in + let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in + let wildcard_60_100_150 :: () = printsym(")") in + () + +gibbon_main :: (Packed Add_Tree_10) +gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in + let fltPkd_103_108 :: Cursor = (Leaf 2) in + let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in + let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in + tmp_app_151 + + [compiler] Running pass, lower +Pass output: +================================================================================ +Prog {infoTable = [("Add_Tree_10", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), + (155, " ")], + fundefs = [FunDecl {funName = "Add_add1_11", + funArgs = [(t_12_63_110, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), + (tail_157, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_12_63_110"], + bod = Switch "switch_160" + (VarTriv "tag_156") + (IntAlts [(0, + LetUnpackT {binds = [(x_13_64_111, + IntTy)], + ptr = "tail_157", + bod = LetPrimCallT {binds = [(fltPkd_104_112, + IntTy)], + prim = AddP, + rands = [VarTriv "x_13_64_111", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_158", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_104_112")], + bod = RetValsT [VarTriv "tailift_158"]}}}), + (1, + LetUnpackT {binds = [(x1_14_65_113, + CursorTy), + (x2_15_66_114, + CursorTy)], + ptr = "tail_157", + bod = LetCallT {async = False, + binds = [(fltPkd_105_115, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x1_14_65_113"], + bod = LetCallT {async = False, + binds = [(fltPkd_106_116, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x2_15_66_114"], + bod = LetAllocT {lhs = "tailift_159", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_105_115"), + (CursorTy, + VarTriv "fltPkd_106_116")], + bod = RetValsT [VarTriv "tailift_159"]}}}})]) + (Just ErrT "Unknown tag in: tag_156")}, + isPure = True}, + FunDecl {funName = "_copy_Add_Tree_10", + funArgs = [(arg_28_67_117, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), + (tail_162, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_28_67_117"], + bod = Switch "switch_165" + (VarTriv "tag_161") + (IntAlts [(0, + LetUnpackT {binds = [(x_29_68_118, + IntTy)], + ptr = "tail_162", + bod = LetAllocT {lhs = "tailift_163", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_29_68_118")], + bod = RetValsT [VarTriv "tailift_163"]}}), + (1, + LetUnpackT {binds = [(x_31_70_120, + CursorTy), + (x_32_71_121, + CursorTy)], + ptr = "tail_162", + bod = LetCallT {async = False, + binds = [(y_33_72_122, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_31_70_120"], + bod = LetCallT {async = False, + binds = [(y_34_73_123, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_32_71_121"], + bod = LetAllocT {lhs = "tailift_164", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_33_72_122"), + (CursorTy, + VarTriv "y_34_73_123")], + bod = RetValsT [VarTriv "tailift_164"]}}}})]) + (Just ErrT "Unknown tag in: tag_161")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", + funArgs = [(arg_35_74_124, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), + (tail_167, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_35_74_124"], + bod = Switch "switch_170" + (VarTriv "tag_166") + (IntAlts [(0, + LetUnpackT {binds = [(x_36_75_125, + IntTy)], + ptr = "tail_167", + bod = LetAllocT {lhs = "tailift_168", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_36_75_125")], + bod = RetValsT [VarTriv "tailift_168"]}}), + (1, + LetUnpackT {binds = [(x_38_77_127, + CursorTy), + (x_39_78_128, + CursorTy)], + ptr = "tail_167", + bod = LetCallT {async = False, + binds = [(y_40_79_129, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_38_77_127"], + bod = LetCallT {async = False, + binds = [(y_41_80_130, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_39_78_128"], + bod = LetAllocT {lhs = "tailift_169", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_40_79_129"), + (CursorTy, + VarTriv "y_41_80_130")], + bod = RetValsT [VarTriv "tailift_169"]}}}})]) + (Just ErrT "Unknown tag in: tag_166")}, + isPure = True}, + FunDecl {funName = "_traverse_Add_Tree_10", + funArgs = [(arg_42_81_131, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), + (tail_172, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_42_81_131"], + bod = Switch "switch_173" + (VarTriv "tag_171") + (IntAlts [(0, + LetUnpackT {binds = [(x_43_82_132, + IntTy)], + ptr = "tail_172", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_45_83_133, + CursorTy), + (x_46_84_134, + CursorTy)], + ptr = "tail_172", + bod = LetCallT {async = False, + binds = [(y_47_85_135, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_45_83_133"], + bod = LetCallT {async = False, + binds = [(y_48_86_136, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_46_84_134"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_171")}, + isPure = True}, + FunDecl {funName = "_print_Add_Tree_10", + funArgs = [(arg_49_87_137, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), + (tail_175, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_49_87_137"], + bod = Switch "switch_176" + (VarTriv "tag_174") + (IntAlts [(0, + LetUnpackT {binds = [(x_50_88_138, + IntTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 154], + bod = LetPrimCallT {binds = [(wildcard_54_90_140, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetPrimCallT {binds = [(y_51_91_141, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_50_88_138"], + bod = LetPrimCallT {binds = [(wildcard_53_92_142, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_55_93_143, + CursorTy), + (x_56_94_144, + CursorTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 153], + bod = LetPrimCallT {binds = [(wildcard_62_96_146, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_57_97_147, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_55_93_143"], + bod = LetPrimCallT {binds = [(wildcard_61_98_148, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_58_99_149, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_56_94_144"], + bod = LetPrimCallT {binds = [(wildcard_60_100_150, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_174")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_102_107", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_103_108", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_101_109", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_102_107"), + (CursorTy, + VarTriv "fltPkd_103_108")], + bod = LetCallT {async = False, + binds = [(tmp_app_151, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "fltAppE_101_109"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_Add_Tree_10", + rands = [VarTriv "tmp_app_151"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}})} + + [compiler] Running pass, lateInlineTriv +Pass output: +================================================================================ +Prog {infoTable = [("Add_Tree_10", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), + (155, " ")], + fundefs = [FunDecl {funName = "Add_add1_11", + funArgs = [(t_12_63_110, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), + (tail_157, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_12_63_110"], + bod = Switch "switch_160" + (VarTriv "tag_156") + (IntAlts [(0, + LetUnpackT {binds = [(x_13_64_111, + IntTy)], + ptr = "tail_157", + bod = LetPrimCallT {binds = [(fltPkd_104_112, + IntTy)], + prim = AddP, + rands = [VarTriv "x_13_64_111", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_158", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_104_112")], + bod = RetValsT [VarTriv "tailift_158"]}}}), + (1, + LetUnpackT {binds = [(x1_14_65_113, + CursorTy), + (x2_15_66_114, + CursorTy)], + ptr = "tail_157", + bod = LetCallT {async = False, + binds = [(fltPkd_105_115, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x1_14_65_113"], + bod = LetCallT {async = False, + binds = [(fltPkd_106_116, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x2_15_66_114"], + bod = LetAllocT {lhs = "tailift_159", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_105_115"), + (CursorTy, + VarTriv "fltPkd_106_116")], + bod = RetValsT [VarTriv "tailift_159"]}}}})]) + (Just ErrT "Unknown tag in: tag_156")}, + isPure = True}, + FunDecl {funName = "_copy_Add_Tree_10", + funArgs = [(arg_28_67_117, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), + (tail_162, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_28_67_117"], + bod = Switch "switch_165" + (VarTriv "tag_161") + (IntAlts [(0, + LetUnpackT {binds = [(x_29_68_118, + IntTy)], + ptr = "tail_162", + bod = LetAllocT {lhs = "tailift_163", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_29_68_118")], + bod = RetValsT [VarTriv "tailift_163"]}}), + (1, + LetUnpackT {binds = [(x_31_70_120, + CursorTy), + (x_32_71_121, + CursorTy)], + ptr = "tail_162", + bod = LetCallT {async = False, + binds = [(y_33_72_122, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_31_70_120"], + bod = LetCallT {async = False, + binds = [(y_34_73_123, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_32_71_121"], + bod = LetAllocT {lhs = "tailift_164", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_33_72_122"), + (CursorTy, + VarTriv "y_34_73_123")], + bod = RetValsT [VarTriv "tailift_164"]}}}})]) + (Just ErrT "Unknown tag in: tag_161")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", + funArgs = [(arg_35_74_124, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), + (tail_167, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_35_74_124"], + bod = Switch "switch_170" + (VarTriv "tag_166") + (IntAlts [(0, + LetUnpackT {binds = [(x_36_75_125, + IntTy)], + ptr = "tail_167", + bod = LetAllocT {lhs = "tailift_168", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_36_75_125")], + bod = RetValsT [VarTriv "tailift_168"]}}), + (1, + LetUnpackT {binds = [(x_38_77_127, + CursorTy), + (x_39_78_128, + CursorTy)], + ptr = "tail_167", + bod = LetCallT {async = False, + binds = [(y_40_79_129, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_38_77_127"], + bod = LetCallT {async = False, + binds = [(y_41_80_130, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_39_78_128"], + bod = LetAllocT {lhs = "tailift_169", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_40_79_129"), + (CursorTy, + VarTriv "y_41_80_130")], + bod = RetValsT [VarTriv "tailift_169"]}}}})]) + (Just ErrT "Unknown tag in: tag_166")}, + isPure = True}, + FunDecl {funName = "_traverse_Add_Tree_10", + funArgs = [(arg_42_81_131, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), + (tail_172, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_42_81_131"], + bod = Switch "switch_173" + (VarTriv "tag_171") + (IntAlts [(0, + LetUnpackT {binds = [(x_43_82_132, + IntTy)], + ptr = "tail_172", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_45_83_133, + CursorTy), + (x_46_84_134, + CursorTy)], + ptr = "tail_172", + bod = LetCallT {async = False, + binds = [(y_47_85_135, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_45_83_133"], + bod = LetCallT {async = False, + binds = [(y_48_86_136, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_46_84_134"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_171")}, + isPure = True}, + FunDecl {funName = "_print_Add_Tree_10", + funArgs = [(arg_49_87_137, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), + (tail_175, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_49_87_137"], + bod = Switch "switch_176" + (VarTriv "tag_174") + (IntAlts [(0, + LetUnpackT {binds = [(x_50_88_138, + IntTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 154], + bod = LetPrimCallT {binds = [(wildcard_54_90_140, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetPrimCallT {binds = [(y_51_91_141, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_50_88_138"], + bod = LetPrimCallT {binds = [(wildcard_53_92_142, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_55_93_143, + CursorTy), + (x_56_94_144, + CursorTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 153], + bod = LetPrimCallT {binds = [(wildcard_62_96_146, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_57_97_147, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_55_93_143"], + bod = LetPrimCallT {binds = [(wildcard_61_98_148, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_58_99_149, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_56_94_144"], + bod = LetPrimCallT {binds = [(wildcard_60_100_150, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_174")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_102_107", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_103_108", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_101_109", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_102_107"), + (CursorTy, + VarTriv "fltPkd_103_108")], + bod = LetCallT {async = False, + binds = [(tmp_app_151, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "fltAppE_101_109"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_Add_Tree_10", + rands = [VarTriv "tmp_app_151"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}})} + + [compiler] Running pass, rearrangeFree +Pass output: +================================================================================ +Prog {infoTable = [("Add_Tree_10", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), + (155, " ")], + fundefs = [FunDecl {funName = "Add_add1_11", + funArgs = [(t_12_63_110, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), + (tail_157, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_12_63_110"], + bod = Switch "switch_160" + (VarTriv "tag_156") + (IntAlts [(0, + LetUnpackT {binds = [(x_13_64_111, + IntTy)], + ptr = "tail_157", + bod = LetPrimCallT {binds = [(fltPkd_104_112, + IntTy)], + prim = AddP, + rands = [VarTriv "x_13_64_111", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_158", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_104_112")], + bod = RetValsT [VarTriv "tailift_158"]}}}), + (1, + LetUnpackT {binds = [(x1_14_65_113, + CursorTy), + (x2_15_66_114, + CursorTy)], + ptr = "tail_157", + bod = LetCallT {async = False, + binds = [(fltPkd_105_115, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x1_14_65_113"], + bod = LetCallT {async = False, + binds = [(fltPkd_106_116, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "x2_15_66_114"], + bod = LetAllocT {lhs = "tailift_159", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_105_115"), + (CursorTy, + VarTriv "fltPkd_106_116")], + bod = RetValsT [VarTriv "tailift_159"]}}}})]) + (Just ErrT "Unknown tag in: tag_156")}, + isPure = True}, + FunDecl {funName = "_copy_Add_Tree_10", + funArgs = [(arg_28_67_117, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), + (tail_162, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_28_67_117"], + bod = Switch "switch_165" + (VarTriv "tag_161") + (IntAlts [(0, + LetUnpackT {binds = [(x_29_68_118, + IntTy)], + ptr = "tail_162", + bod = LetAllocT {lhs = "tailift_163", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_29_68_118")], + bod = RetValsT [VarTriv "tailift_163"]}}), + (1, + LetUnpackT {binds = [(x_31_70_120, + CursorTy), + (x_32_71_121, + CursorTy)], + ptr = "tail_162", + bod = LetCallT {async = False, + binds = [(y_33_72_122, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_31_70_120"], + bod = LetCallT {async = False, + binds = [(y_34_73_123, + CursorTy)], + rator = "_copy_Add_Tree_10", + rands = [VarTriv "x_32_71_121"], + bod = LetAllocT {lhs = "tailift_164", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_33_72_122"), + (CursorTy, + VarTriv "y_34_73_123")], + bod = RetValsT [VarTriv "tailift_164"]}}}})]) + (Just ErrT "Unknown tag in: tag_161")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", + funArgs = [(arg_35_74_124, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), + (tail_167, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_35_74_124"], + bod = Switch "switch_170" + (VarTriv "tag_166") + (IntAlts [(0, + LetUnpackT {binds = [(x_36_75_125, + IntTy)], + ptr = "tail_167", + bod = LetAllocT {lhs = "tailift_168", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_36_75_125")], + bod = RetValsT [VarTriv "tailift_168"]}}), + (1, + LetUnpackT {binds = [(x_38_77_127, + CursorTy), + (x_39_78_128, + CursorTy)], + ptr = "tail_167", + bod = LetCallT {async = False, + binds = [(y_40_79_129, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_38_77_127"], + bod = LetCallT {async = False, + binds = [(y_41_80_130, + CursorTy)], + rator = "_copy_without_ptrs_Add_Tree_10", + rands = [VarTriv "x_39_78_128"], + bod = LetAllocT {lhs = "tailift_169", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_40_79_129"), + (CursorTy, + VarTriv "y_41_80_130")], + bod = RetValsT [VarTriv "tailift_169"]}}}})]) + (Just ErrT "Unknown tag in: tag_166")}, + isPure = True}, + FunDecl {funName = "_traverse_Add_Tree_10", + funArgs = [(arg_42_81_131, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), + (tail_172, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_42_81_131"], + bod = Switch "switch_173" + (VarTriv "tag_171") + (IntAlts [(0, + LetUnpackT {binds = [(x_43_82_132, + IntTy)], + ptr = "tail_172", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_45_83_133, + CursorTy), + (x_46_84_134, + CursorTy)], + ptr = "tail_172", + bod = LetCallT {async = False, + binds = [(y_47_85_135, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_45_83_133"], + bod = LetCallT {async = False, + binds = [(y_48_86_136, + ProdTy [])], + rator = "_traverse_Add_Tree_10", + rands = [VarTriv "x_46_84_134"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_171")}, + isPure = True}, + FunDecl {funName = "_print_Add_Tree_10", + funArgs = [(arg_49_87_137, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), + (tail_175, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_49_87_137"], + bod = Switch "switch_176" + (VarTriv "tag_174") + (IntAlts [(0, + LetUnpackT {binds = [(x_50_88_138, + IntTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 154], + bod = LetPrimCallT {binds = [(wildcard_54_90_140, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetPrimCallT {binds = [(y_51_91_141, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_50_88_138"], + bod = LetPrimCallT {binds = [(wildcard_53_92_142, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_55_93_143, + CursorTy), + (x_56_94_144, + CursorTy)], + ptr = "tail_175", + bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 153], + bod = LetPrimCallT {binds = [(wildcard_62_96_146, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_57_97_147, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_55_93_143"], + bod = LetPrimCallT {binds = [(wildcard_61_98_148, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 155], + bod = LetCallT {async = False, + binds = [(y_58_99_149, + ProdTy [])], + rator = "_print_Add_Tree_10", + rands = [VarTriv "x_56_94_144"], + bod = LetPrimCallT {binds = [(wildcard_60_100_150, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 152], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_174")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_102_107", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_103_108", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_101_109", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_102_107"), + (CursorTy, + VarTriv "fltPkd_103_108")], + bod = LetCallT {async = False, + binds = [(tmp_app_151, + CursorTy)], + rator = "Add_add1_11", + rands = [VarTriv "fltAppE_101_109"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_Add_Tree_10", + rands = [VarTriv "tmp_app_151"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}})} + + [compiler] Final C codegen: 11506 characters. +================================================================================ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +typedef struct GibIntGibIntProd_struct { + GibInt field0; + GibInt field1; + } GibIntGibIntProd; +typedef struct GibIntGibCursorGibCursorProd_struct { + GibInt field0; + GibCursor field1; + GibCursor field2; + } GibIntGibCursorGibCursorProd; +typedef struct GibPackedTagGibCursorProd_struct { + GibPackedTag field0; + GibCursor field1; + } GibPackedTagGibCursorProd; +typedef struct GibCursorProd_struct { + GibCursor field0; + } GibCursorProd; +typedef struct GibCursorGibCursorProd_struct { + GibCursor field0; + GibCursor field1; + } GibCursorGibCursorProd; +GibCursor Add_add1_11(GibCursor t_12_63_110); +GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117); +GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124); +unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131); +unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + Add_Tree_10_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(8); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[1]; + + error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 0, 8, 0, 1, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Add_Tree_10_T, 0); + exit(1); + } + error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 1, 0, 2, 0, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, Add_Tree_10_T, 1); + exit(1); + } + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ + gib_add_symbol(152, ")"); + gib_add_symbol(153, "(Node"); + gib_add_symbol(154, "(Leaf"); + gib_add_symbol(155, " "); +} +GibCursor Add_add1_11(GibCursor t_12_63_110) +{ + GibPackedTag tag_156 = *(GibPackedTag *) t_12_63_110; + GibCursor tail_157 = t_12_63_110 + sizeof(GibInt); + + + switch_160: + ; + switch (tag_156) { + + case 0: + { + GibInt x_13_64_111 = ((GibIntProd *) tail_157)->field0; + GibInt fltPkd_104_112 = x_13_64_111 + 1; + GibPtr tailift_158 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_158)->field0 = 0; + ((GibIntGibIntProd *) tailift_158)->field1 = fltPkd_104_112; + return tailift_158; + break; + } + + case 1: + { + GibCursor x1_14_65_113 = + ((GibCursorGibCursorProd *) tail_157)->field0; + GibCursor x2_15_66_114 = + ((GibCursorGibCursorProd *) tail_157)->field1; + GibCursor fltPkd_105_115 = Add_add1_11(x1_14_65_113); + GibCursor fltPkd_106_116 = Add_add1_11(x2_15_66_114); + GibPtr tailift_159 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_159)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_159)->field1 = + fltPkd_105_115; + ((GibIntGibCursorGibCursorProd *) tailift_159)->field2 = + fltPkd_106_116; + return tailift_159; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_156"); + exit(1); + } + } +} +GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117) +{ + GibPackedTag tag_161 = *(GibPackedTag *) arg_28_67_117; + GibCursor tail_162 = arg_28_67_117 + sizeof(GibInt); + + + switch_165: + ; + switch (tag_161) { + + case 0: + { + GibInt x_29_68_118 = ((GibIntProd *) tail_162)->field0; + GibPtr tailift_163 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_163)->field0 = 0; + ((GibIntGibIntProd *) tailift_163)->field1 = x_29_68_118; + return tailift_163; + break; + } + + case 1: + { + GibCursor x_31_70_120 = + ((GibCursorGibCursorProd *) tail_162)->field0; + GibCursor x_32_71_121 = + ((GibCursorGibCursorProd *) tail_162)->field1; + GibCursor y_33_72_122 = _copy_Add_Tree_10(x_31_70_120); + GibCursor y_34_73_123 = _copy_Add_Tree_10(x_32_71_121); + GibPtr tailift_164 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_164)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_164)->field1 = + y_33_72_122; + ((GibIntGibCursorGibCursorProd *) tailift_164)->field2 = + y_34_73_123; + return tailift_164; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_161"); + exit(1); + } + } +} +GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124) +{ + GibPackedTag tag_166 = *(GibPackedTag *) arg_35_74_124; + GibCursor tail_167 = arg_35_74_124 + sizeof(GibInt); + + + switch_170: + ; + switch (tag_166) { + + case 0: + { + GibInt x_36_75_125 = ((GibIntProd *) tail_167)->field0; + GibPtr tailift_168 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_168)->field0 = 0; + ((GibIntGibIntProd *) tailift_168)->field1 = x_36_75_125; + return tailift_168; + break; + } + + case 1: + { + GibCursor x_38_77_127 = + ((GibCursorGibCursorProd *) tail_167)->field0; + GibCursor x_39_78_128 = + ((GibCursorGibCursorProd *) tail_167)->field1; + GibCursor y_40_79_129 = + _copy_without_ptrs_Add_Tree_10(x_38_77_127); + GibCursor y_41_80_130 = + _copy_without_ptrs_Add_Tree_10(x_39_78_128); + GibPtr tailift_169 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_169)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_169)->field1 = + y_40_79_129; + ((GibIntGibCursorGibCursorProd *) tailift_169)->field2 = + y_41_80_130; + return tailift_169; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_166"); + exit(1); + } + } +} +unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) +{ + GibPackedTag tag_171 = *(GibPackedTag *) arg_42_81_131; + GibCursor tail_172 = arg_42_81_131 + sizeof(GibInt); + + + switch_173: + ; + switch (tag_171) { + + case 0: + { + GibInt x_43_82_132 = ((GibIntProd *) tail_172)->field0; + + return 0; + break; + } + + case 1: + { + GibCursor x_45_83_133 = + ((GibCursorGibCursorProd *) tail_172)->field0; + GibCursor x_46_84_134 = + ((GibCursorGibCursorProd *) tail_172)->field1; + unsigned char y_47_85_135 = _traverse_Add_Tree_10(x_45_83_133); + unsigned char y_48_86_136 = _traverse_Add_Tree_10(x_46_84_134); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_171"); + exit(1); + } + } +} +unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) +{ + GibPackedTag tag_174 = *(GibPackedTag *) arg_49_87_137; + GibCursor tail_175 = arg_49_87_137 + sizeof(GibInt); + + + switch_176: + ; + switch (tag_174) { + + case 0: + { + GibInt x_50_88_138 = ((GibIntProd *) tail_175)->field0; + unsigned char wildcard_52_89_139 = gib_print_symbol(154); + unsigned char wildcard_54_90_140 = gib_print_symbol(155); + unsigned char y_51_91_141 = printf("%ld", x_50_88_138); + unsigned char wildcard_53_92_142 = gib_print_symbol(152); + + return 0; + break; + } + + case 1: + { + GibCursor x_55_93_143 = + ((GibCursorGibCursorProd *) tail_175)->field0; + GibCursor x_56_94_144 = + ((GibCursorGibCursorProd *) tail_175)->field1; + unsigned char wildcard_59_95_145 = gib_print_symbol(153); + unsigned char wildcard_62_96_146 = gib_print_symbol(155); + unsigned char y_57_97_147 = _print_Add_Tree_10(x_55_93_143); + unsigned char wildcard_61_98_148 = gib_print_symbol(155); + unsigned char y_58_99_149 = _print_Add_Tree_10(x_56_94_144); + unsigned char wildcard_60_100_150 = gib_print_symbol(152); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_174"); + exit(1); + } + } +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + GibPtr fltPkd_102_107 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_102_107)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_102_107)->field1 = 1; + + GibPtr fltPkd_103_108 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_103_108)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_103_108)->field1 = 2; + + GibPtr fltAppE_101_109 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field1 = fltPkd_102_107; + ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field2 = fltPkd_103_108; + + GibCursor tmp_app_151 = Add_add1_11(fltAppE_101_109); + + _print_Add_Tree_10(tmp_app_151); + printf("\n"); + return 0; + + int exit_1 = gib_exit(); + + return exit_1; +} + +Compiling RTS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +codegen: C RTS could not be compiled: +make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory +make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. + +Code: 2 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 13c891cb5..51e0d13b4 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -200,6 +200,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings + defs' = M.mapWithKey (\k dDef -> dDef {tyName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = @@ -277,7 +278,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports error $ "Conflicting definitions of " ++ show (S.toList em2) ++ " found in " ++ mod_name) - (defs, funs''') + (defs', funs''') imported_progs' pure (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index ae6fddaf8..4c9688ec3 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -24,65 +24,93 @@ type TyVarEnv t = M.Map TyVar t moduleRename :: Prog0 -> PassM Prog0 moduleRename (Prog defs funs main) = - do --main' <- case main of - -- Nothing -> return Nothing - -- Just (m,ty) -> do m' <- freshExp M.empty M.empty m - -- return $ Just (m',ty) - --defs' <- traverse freshDDef defs - --funs' <- *traverse map* resolveFunModuleNames funs + do + -- defs + renamedDefs <- mapM (\k -> (gensym k)) (M.keys defs) + let defNameMap = M.fromList $ zip (M.keys defs) renamedDefs + let initDefEnv :: VarEnv = M.empty + let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap + let transformDefKey :: Var -> Var + transformDefKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name defenv + + -- funs renamedFuns <- mapM (\k -> (gensym k)) (M.keys funs) - let nameMap = M.fromList $ zip (M.keys funs) renamedFuns - let init :: VarEnv = M.empty - let (env, _) = M.mapAccumWithKey buildEnv init nameMap - --let funs' = M.mapKeys (\k -> resolveNameInEnv () env) funs - let _ = dbgPrintLn 2 "hello?" - let transformKey :: Var -> Var - transformKey k = do + let funNameMap = M.fromList $ zip (M.keys funs) renamedFuns + let initFunEnv :: VarEnv = M.empty + let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap + let transformFunKey :: Var -> Var + transformFunKey k = do let (mod, name) = parseOutMod k - resolveNameInEnv mod name env - funs' <- traverse (\v -> resolveModsInFuns v defs env) funs - let funs'' = M.mapKeys transformKey funs' - return $ Prog defs funs'' main + resolveNameInEnv mod name funenv -buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) -buildEnv env k v = do - let (mod, name) = parseOutMod k - let mod' = case mod of - Just m -> m - Nothing -> (toVar "") - case (M.lookup name env) of - Just m -> - if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') - else ((M.insert name (M.insert mod' v m) env), v) - Nothing -> ((M.insert name (M.singleton mod' v) env), v) + -- main + main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- resolveModInExp m defenv funenv + return $ Just (m',ty) + + defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs + funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs -resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var -resolveNameInEnv mod name e = - do case (M.lookup name e) of - Just modspace -> case mod of - Just m -> case (M.lookup m modspace) of - Just n -> n - Nothing -> error $ "can't find function " ++ (fromVar name) ++ " in module " ++ (fromVar m) - Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find function " ++ (fromVar name) - Nothing -> error $ "can't find function " ++ (fromVar name) - -freshDDef :: DDef Ty0 -> PassM (DDef Ty0) -freshDDef DDef{tyName,tyArgs,dataCons} = - do pure $ DDef tyName tyArgs dataCons + let defs'' = M.mapKeys transformDefKey defs' + let funs'' = M.mapKeys transformFunKey funs' ---funRename :: FunDef Exp0 -> FunDef Exp0 ---funRename (FunDef nam nargs funty bod meta) = FunDef (gensym nam) nargs funty bod meta + return $ Prog defs'' funs'' main' -resolveModsInFuns :: FunDef Exp0 -> DDefs Ty0 -> VarEnv -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defs env = +resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) +resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = do - let (mod, name) = parseOutMod nam - bod' <- resolveModInBod bod env - pure $ FunDef (resolveNameInEnv mod name env) nargs funty bod' meta + let (mod, name) = parseOutMod tyName + let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons + pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' -resolveModInBod :: Exp0 -> VarEnv -> PassM Exp0 -resolveModInBod exp env = +resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = + do + let nam' = parseAndResolve nam funenv + let funty' = resolveModsInTyScheme funty defenv + bod' <- resolveModInExp bod defenv funenv + pure $ FunDef nam' nargs funty' bod' meta + +resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme +resolveModsInTyScheme (ForAll tvs ty) defenv = do + let ty' = resolveModInTy ty defenv + ForAll tvs ty' + +resolveModsInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) +resolveModsInDataCons (con, tys) defenv funenv = + do + let tys' = map (\(boxed, ty) -> (boxed, (resolveModInTy ty defenv))) tys + (con, tys') + +resolveModInTy :: Ty0 -> VarEnv -> Ty0 +resolveModInTy ty defenv = + case ty of + IntTy -> ty + CharTy -> ty + FloatTy -> ty + SymTy0 -> ty + BoolTy -> ty + ArenaTy -> ty + SymSetTy -> ty + SymHashTy -> ty + MetaTv{} -> ty + TyVar tv -> ty + ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys + SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv + PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) + ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) $ resolveModInTy t defenv + + PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys + + VectorTy el_t -> VectorTy $ resolveModInTy el_t defenv + ListTy el_t -> ListTy $ resolveModInTy el_t defenv + IntHashTy -> ty + +resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> PassM Exp0 +resolveModInExp exp defenv funenv = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c @@ -93,14 +121,14 @@ resolveModInBod exp env = AppE v locs ls -> do let (mod, fun) = parseOutMod v - let v' = resolveNameInEnv mod fun env + let v' = resolveNameInEnv mod fun funenv return $ AppE v' locs ls PrimAppE p es -> return $ PrimAppE p es LetE (v,_locs,ty, e1) e2 -> do - e1' <- resolveModInBod e1 env - e2' <- resolveModInBod e2 env + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv return $ LetE (v, [], ty, e1') e2' IfE e1 e2 e3 -> return $ IfE e1 e2 e3 @@ -108,14 +136,14 @@ resolveModInBod exp env = MkProdE es -> return $ MkProdE es CaseE e mp -> do - e' <- resolveModInBod e env + e' <- resolveModInExp e defenv funenv mp' <- mapM (\(c,prs,ae) -> do - ae' <- resolveModInBod ae env + ae' <- resolveModInExp ae defenv funenv return (c, prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- traverse (\v -> resolveModInBod v env) es + es' <- traverse (\v -> resolveModInExp v defenv funenv) es return $ DataConE loc c es' TimeIt e t b -> return $ TimeIt e t b @@ -126,9 +154,40 @@ resolveModInBod exp env = FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 Ext ext -> return $ Ext ext + +-- environment interactions + +buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv env k v = do + let (mod, name) = parseOutMod k + let mod' = case mod of + Just m -> m + Nothing -> (toVar "") + case (M.lookup name env) of + Just m -> + if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + else ((M.insert name (M.insert mod' v m) env), v) + Nothing -> ((M.insert name (M.singleton mod' v) env), v) + +parseAndResolve :: Var -> VarEnv -> Var +parseAndResolve v env = do + let (mod, name) = parseOutMod v + resolveNameInEnv mod name env + parseOutMod :: Var -> (Maybe Var, Var) parseOutMod v = do let str = (fromVar v) case (L.elemIndices '.' str) of [] -> (Nothing, v) - x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) \ No newline at end of file + x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) + +resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var +resolveNameInEnv mod name e = + do case (M.lookup name e) of + Just modspace -> case mod of + Just m -> case (M.lookup m modspace) of + Just n -> n + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find " ++ (fromVar name) + Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file From 5acadd154c88545738ab226185ca65a82eaa5f1c Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 21 Nov 2023 15:22:36 -0800 Subject: [PATCH 29/68] added a pass to resolve imports in desugarModule --- gibbon-compiler/examples/AddTree.hs | 2 + gibbon-compiler/examples/Addone.hs | 10 +- gibbon-compiler/examples/Addtwo.hs | 12 +- gibbon-compiler/examples/addimport.hs | 7 +- gibbon-compiler/gibbon.cabal | 1 + gibbon-compiler/ir.log | 4537 +++++++++-------- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 13 +- .../src/Gibbon/Passes/ModuleFillImports.hs | 190 + .../src/Gibbon/Passes/ModuleRename.hs | 5 +- 9 files changed, 2766 insertions(+), 2011 deletions(-) create mode 100644 gibbon-compiler/examples/AddTree.hs create mode 100644 gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs diff --git a/gibbon-compiler/examples/AddTree.hs b/gibbon-compiler/examples/AddTree.hs new file mode 100644 index 000000000..1ac4ba955 --- /dev/null +++ b/gibbon-compiler/examples/AddTree.hs @@ -0,0 +1,2 @@ +module AddTree where + data Tree = Leaf Int | Node Tree Tree \ No newline at end of file diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs index 4f0a37bec..a32a620e5 100644 --- a/gibbon-compiler/examples/Addone.hs +++ b/gibbon-compiler/examples/Addone.hs @@ -1,10 +1,10 @@ module Addone where - data Tree = Leaf Int | Node Tree Tree + import AddTree - add/1 :: Tree -> Tree - add/1 t = case t of + add :: Tree -> Tree + add t = case t of Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) + Node x1 x2 -> Node (add x1) (add x2) main :: Tree - main = add1 (Node (Leaf 1) (Leaf 2)) + main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs index fe8682516..82c6216e3 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/Addtwo.hs @@ -1,10 +1,10 @@ module Addtwo where - data Tree = Leaf Int | Node Tree Tree + import AddTree - add/1 :: Tree -> Tree - add1 t = case t of - Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) + add :: Tree -> Tree + add t = case t of + Leaf x -> Leaf (x + 2) + Node x1 x2 -> Node (add x1) (add x2) main :: Tree - main = add1 (Node (Leaf 1) (Leaf 2)) + main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index f366dff69..baaa8d41a 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,5 +1,6 @@ -module Addimport where +module AddImport where import Addone + import Addtwo + import AddTree - main :: Tree - main = Addone.add1 2 (Addone.add1 (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = Addone.add (Addtwo.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index 0546d88e2..f7ca3373a 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -60,6 +60,7 @@ library -- compiler passes, roughly in the order they're run Gibbon.Passes.ModuleRename + Gibbon.Passes.ModuleFillImports Gibbon.Passes.Freshen Gibbon.Passes.Flatten Gibbon.Passes.InlineTriv diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index e0f9c3ec0..e8c6e79bf 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -1,18 +1,44 @@ ! Responding to env Var: GIBBON_DEBUG=4 ! We set DEBUG based on command-line verbose arg: 4 +================================================================================ + +desugaring module: AddImport + +- imports: ["Addone","Addtwo","AddTree"] + +================================================================================ + +desugaring module: Addone + +- imports: ["AddTree"] + +================================================================================ + +desugaring module: AddTree + +- imports: [] + +================================================================================ + +desugaring module: Addtwo + +- imports: ["AddTree"] + [compiler] pipeline starting, parsed program: ================================================================================ -Prog {ddefs = [(Add.Tree, - DDef {tyName = "Add.Tree", +Prog {ddefs = [(AddTree.Tree, + DDef {tyName = "AddTree.Tree", tyArgs = [], dataCons = [("Leaf", [(False, IntTy)]), ("Node", - [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], - fundefs = [(Add.add1, - FunDef {funName = "Add.add1", + [(False, PackedTy "AddTree.Tree" []), + (False, PackedTy "AddTree.Tree" [])])]})], + fundefs = [(Addone.add, + FunDef {funName = "Addone.add", funArgs = [t], funTy = ForAll [] - (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), funBody = CaseE (VarE "t") [("Leaf", [(x, MetaTv $2)], @@ -23,1530 +49,1824 @@ Prog {ddefs = [(Add.Tree, [(x1, MetaTv $4),(x2, MetaTv $5)], DataConE (MetaTv $3) "Node" - [AppE "Add.add1" [] [VarE "x1"], - AppE "Add.add1" [] [VarE "x2"]])], + [AppE "Addone.add" [] [VarE "x1"], + AppE "Addone.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.add, + FunDef {funName = "Addtwo.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addtwo.add" [] [VarE "x1"], + AppE "Addtwo.add" [] [VarE "x2"]])], funMeta = FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Add.add1" + mainExp = Just (AppE "Addone.add" [] - [DataConE (MetaTv $6) - "Node" - [DataConE (MetaTv $7) "Leaf" [LitE 1], - DataConE (MetaTv $8) "Leaf" [LitE 2]]], - MetaTv $9)} + [AppE "Addtwo.add" + [] + [DataConE (MetaTv $0) + "Node" + [DataConE (MetaTv $1) "Leaf" [LitE 1], + DataConE (MetaTv $2) "Leaf" [LitE 2]]]], + MetaTv $3)} [compiler] Running pass, renameModules Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t = +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t = case t of Leaf x::$2 -> (Leaf $1 x + 1) Node x1::$4 x2::$5 -> - (Node $3 (Add_add1_11 [] x1) (Add_add1_11 [] x2)) + (Node $3 (Addone_add_5 [] x1) (Addone_add_5 [] x2)) -gibbon_main :: $9 -gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 2) + Node x1::$4 x2::$5 -> + (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) + +gibbon_main :: $3 +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, freshen Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::$2 -> + (Leaf $1 x_8 + 1) + Node x1_9::$4 x2_10::$5 -> + (Node $3 (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::$2 -> - (Leaf $1 x_13 + 1) - Node x1_14::$4 x2_15::$5 -> - (Node $3 (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::$2 -> + (Leaf $1 x_12 + 2) + Node x1_13::$4 x2_14::$5 -> + (Node $3 (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: $9 -gibbon_main = (Add_add1_11 [] (Node $6 (Leaf $7 1) (Leaf $8 2))) +gibbon_main :: $3 +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, bindLambdas Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, monomorphize Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, specLambdas Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 1) - Node x1_14::(Packed Add_Tree_10 []) x2_15::(Packed Add_Tree_10 []) -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::Int -> + (Leaf () x_8 + 1) + Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::Int -> + (Leaf () x_12 + 2) + Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, desugarL0 Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 1) - Node x1_14::() x2_15::() -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29::() -> - let y_30 :: Int = x_29 in - (Leaf () y_30) - Node x_31::() x_32::() -> - let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in - (Node () y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36::() -> - let y_37 :: Int = x_36 in - (Leaf () y_37) - Node x_38::() x_39::() -> - let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node () y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43::() -> - () - Node x_45::() x_46::() -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50::() -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55::() x_56::() -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::() -> + (Leaf () x_8 + 1) + Node x1_9::() x2_10::() -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::() -> + (Leaf () x_12 + 2) + Node x1_13::() x2_14::() -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40::() -> + let y_41 :: Int = x_40 in + (Leaf () y_41) + Node x_42::() x_43::() -> + let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in + (Node () y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47::() -> + let y_48 :: Int = x_47 in + (Leaf () y_48) + Node x_49::() x_50::() -> + let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node () y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54::() -> + () + Node x_56::() x_57::() -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61::() -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66::() x_67::() -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, floatOutCase Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10 []) (Packed Add_Tree_10 []) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8::() -> + (Leaf () x_8 + 1) + Node x1_9::() x2_10::() -> + (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 1) - Node x1_14::() x2_15::() -> - (Node () (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29::() -> - let y_30 :: Int = x_29 in - (Leaf () y_30) - Node x_31::() x_32::() -> - let y_33 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10 []) = (_copy_Add_Tree_10 [] x_32) in - (Node () y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> (Packed Add_Tree_10 [])) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36::() -> - let y_37 :: Int = x_36 in - (Leaf () y_37) - Node x_38::() x_39::() -> - let y_40 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10 []) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node () y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43::() -> - () - Node x_45::() x_46::() -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: forall. ((Packed Add_Tree_10 []) -> ()) -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50::() -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55::() x_56::() -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10 []) -gibbon_main = (Add_add1_11 [] (Node () (Leaf () 1) (Leaf () 2))) +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12::() -> + (Leaf () x_12 + 2) + Node x1_13::() x2_14::() -> + (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40::() -> + let y_41 :: Int = x_40 in + (Leaf () y_41) + Node x_42::() x_43::() -> + let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in + (Node () y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47::() -> + let y_48 :: Int = x_47 in + (Leaf () y_48) + Node x_49::() x_50::() -> + let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node () y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54::() -> + () + Node x_56::() x_57::() -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61::() -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66::() x_67::() -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, toL1 Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, benchMainExp Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 1) - Node x1_14 x2_15 -> - (Node (Add_add1_11 [] x1_14) (Add_add1_11 [] x2_15)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28 = - case arg_28 of - Leaf x_29 -> - let y_30 :: Int = x_29 in - (Leaf y_30) - Node x_31 x_32 -> - let y_33 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31) in - let y_34 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32) in - (Node y_33 y_34) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35 = - case arg_35 of - Leaf x_36 -> - let y_37 :: Int = x_36 in - (Leaf y_37) - Node x_38 x_39 -> - let y_40 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38) in - let y_41 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39) in - (Node y_40 y_41) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42 = - case arg_42 of - Leaf x_43 -> - () - Node x_45 x_46 -> - let y_47 :: () = (_traverse_Add_Tree_10 [] x_45) in - let y_48 :: () = (_traverse_Add_Tree_10 [] x_46) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49 = - case arg_49 of - Leaf x_50 -> - let wildcard_52 :: () = printsym("(Leaf") in - let wildcard_54 :: () = printsym(" ") in - let y_51 :: () = printint(x_50) in - let wildcard_53 :: () = printsym(")") in - () - Node x_55 x_56 -> - let wildcard_59 :: () = printsym("(Node") in - let wildcard_62 :: () = printsym(" ") in - let y_57 :: () = (_print_Add_Tree_10 [] x_55) in - let wildcard_61 :: () = printsym(" ") in - let y_58 :: () = (_print_Add_Tree_10 [] x_56) in - let wildcard_60 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7 = + case t_7 of + Leaf x_8 -> + (Leaf x_8 + 1) + Node x1_9 x2_10 -> + (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11 = + case t_11 of + Leaf x_12 -> + (Leaf x_12 + 2) + Node x1_13 x2_14 -> + (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39 = + case arg_39 of + Leaf x_40 -> + let y_41 :: Int = x_40 in + (Leaf y_41) + Node x_42 x_43 -> + let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in + let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in + (Node y_44 y_45) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46 = + case arg_46 of + Leaf x_47 -> + let y_48 :: Int = x_47 in + (Leaf y_48) + Node x_49 x_50 -> + let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in + let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in + (Node y_51 y_52) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53 = + case arg_53 of + Leaf x_54 -> + () + Node x_56 x_57 -> + let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in + let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60 = + case arg_60 of + Leaf x_61 -> + let wildcard_63 :: () = printsym("(Leaf") in + let wildcard_65 :: () = printsym(" ") in + let y_62 :: () = printint(x_61) in + let wildcard_64 :: () = printsym(")") in + () + Node x_66 x_67 -> + let wildcard_70 :: () = printsym("(Node") in + let wildcard_73 :: () = printsym(" ") in + let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in + let wildcard_72 :: () = printsym(" ") in + let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in + let wildcard_71 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, simplify Removed unused functions: [] Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63 = - case t_12_63 of - Leaf x_13_64 -> - (Leaf x_13_64 + 1) - Node x1_14_65 x2_15_66 -> - (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67 = - case arg_28_67 of - Leaf x_29_68 -> - let y_30_69 :: Int = x_29_68 in - (Leaf y_30_69) - Node x_31_70 x_32_71 -> - let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in - let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in - (Node y_33_72 y_34_73) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74 = - case arg_35_74 of - Leaf x_36_75 -> - let y_37_76 :: Int = x_36_75 in - (Leaf y_37_76) - Node x_38_77 x_39_78 -> - let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in - let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in - (Node y_40_79 y_41_80) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81 = - case arg_42_81 of - Leaf x_43_82 -> - () - Node x_45_83 x_46_84 -> - let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in - let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87 = - case arg_49_87 of - Leaf x_50_88 -> - let wildcard_52_89 :: () = printsym("(Leaf") in - let wildcard_54_90 :: () = printsym(" ") in - let y_51_91 :: () = printint(x_50_88) in - let wildcard_53_92 :: () = printsym(")") in - () - Node x_55_93 x_56_94 -> - let wildcard_59_95 :: () = printsym("(Node") in - let wildcard_62_96 :: () = printsym(" ") in - let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in - let wildcard_61_98 :: () = printsym(" ") in - let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in - let wildcard_60_100 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74 = + case t_7_74 of + Leaf x_8_75 -> + (Leaf x_8_75 + 1) + Node x1_9_76 x2_10_77 -> + (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78 = + case t_11_78 of + Leaf x_12_79 -> + (Leaf x_12_79 + 2) + Node x1_13_80 x2_14_81 -> + (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82 = + case arg_39_82 of + Leaf x_40_83 -> + let y_41_84 :: Int = x_40_83 in + (Leaf y_41_84) + Node x_42_85 x_43_86 -> + let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in + let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in + (Node y_44_87 y_45_88) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = + case arg_46_89 of + Leaf x_47_90 -> + let y_48_91 :: Int = x_47_90 in + (Leaf y_48_91) + Node x_49_92 x_50_93 -> + let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in + let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in + (Node y_51_94 y_52_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96 = + case arg_53_96 of + Leaf x_54_97 -> + () + Node x_56_98 x_57_99 -> + let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in + let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102 = + case arg_60_102 of + Leaf x_61_103 -> + let wildcard_63_104 :: () = printsym("(Leaf") in + let wildcard_65_105 :: () = printsym(" ") in + let y_62_106 :: () = printint(x_61_103) in + let wildcard_64_107 :: () = printsym(")") in + () + Node x_66_108 x_67_109 -> + let wildcard_70_110 :: () = printsym("(Node") in + let wildcard_73_111 :: () = printsym(" ") in + let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in + let wildcard_72_113 :: () = printsym(" ") in + let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in + let wildcard_71_115 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63 = - case t_12_63 of - Leaf x_13_64 -> - (Leaf x_13_64 + 1) - Node x1_14_65 x2_15_66 -> - (Node (Add_add1_11 [] x1_14_65) (Add_add1_11 [] x2_15_66)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67 = - case arg_28_67 of - Leaf x_29_68 -> - let y_30_69 :: Int = x_29_68 in - (Leaf y_30_69) - Node x_31_70 x_32_71 -> - let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in - let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in - (Node y_33_72 y_34_73) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74 = - case arg_35_74 of - Leaf x_36_75 -> - let y_37_76 :: Int = x_36_75 in - (Leaf y_37_76) - Node x_38_77 x_39_78 -> - let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in - let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in - (Node y_40_79 y_41_80) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81 = - case arg_42_81 of - Leaf x_43_82 -> - () - Node x_45_83 x_46_84 -> - let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in - let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87 = - case arg_49_87 of - Leaf x_50_88 -> - let wildcard_52_89 :: () = printsym("(Leaf") in - let wildcard_54_90 :: () = printsym(" ") in - let y_51_91 :: () = printint(x_50_88) in - let wildcard_53_92 :: () = printsym(")") in - () - Node x_55_93 x_56_94 -> - let wildcard_59_95 :: () = printsym("(Node") in - let wildcard_62_96 :: () = printsym(" ") in - let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in - let wildcard_61_98 :: () = printsym(" ") in - let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in - let wildcard_60_100 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = (Add_add1_11 [] (Node (Leaf 1) (Leaf 2))) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74 = + case t_7_74 of + Leaf x_8_75 -> + (Leaf x_8_75 + 1) + Node x1_9_76 x2_10_77 -> + (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78 = + case t_11_78 of + Leaf x_12_79 -> + (Leaf x_12_79 + 2) + Node x1_13_80 x2_14_81 -> + (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82 = + case arg_39_82 of + Leaf x_40_83 -> + let y_41_84 :: Int = x_40_83 in + (Leaf y_41_84) + Node x_42_85 x_43_86 -> + let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in + let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in + (Node y_44_87 y_45_88) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = + case arg_46_89 of + Leaf x_47_90 -> + let y_48_91 :: Int = x_47_90 in + (Leaf y_48_91) + Node x_49_92 x_50_93 -> + let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in + let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in + (Node y_51_94 y_52_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96 = + case arg_53_96 of + Leaf x_54_97 -> + () + Node x_56_98 x_57_99 -> + let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in + let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102 = + case arg_60_102 of + Leaf x_61_103 -> + let wildcard_63_104 :: () = printsym("(Leaf") in + let wildcard_65_105 :: () = printsym(" ") in + let y_62_106 :: () = printint(x_61_103) in + let wildcard_64_107 :: () = printsym(")") in + () + Node x_66_108 x_67_109 -> + let wildcard_70_110 :: () = printsym("(Node") in + let wildcard_73_111 :: () = printsym(" ") in + let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in + let wildcard_72_113 :: () = printsym(" ") in + let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in + let wildcard_71_115 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, flatten Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63 = - case t_12_63 of - Leaf x_13_64 -> - let fltPkd_104 :: Int = x_13_64 + 1 in - (Leaf fltPkd_104) - Node x1_14_65 x2_15_66 -> - let fltPkd_105 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65) in - let fltPkd_106 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66) in - (Node fltPkd_105 fltPkd_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67 = - case arg_28_67 of - Leaf x_29_68 -> - let y_30_69 :: Int = x_29_68 in - (Leaf y_30_69) - Node x_31_70 x_32_71 -> - let y_33_72 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70) in - let y_34_73 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71) in - (Node y_33_72 y_34_73) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74 = - case arg_35_74 of - Leaf x_36_75 -> - let y_37_76 :: Int = x_36_75 in - (Leaf y_37_76) - Node x_38_77 x_39_78 -> - let y_40_79 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77) in - let y_41_80 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78) in - (Node y_40_79 y_41_80) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81 = - case arg_42_81 of - Leaf x_43_82 -> - () - Node x_45_83 x_46_84 -> - let y_47_85 :: () = (_traverse_Add_Tree_10 [] x_45_83) in - let y_48_86 :: () = (_traverse_Add_Tree_10 [] x_46_84) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87 = - case arg_49_87 of - Leaf x_50_88 -> - let wildcard_52_89 :: () = printsym("(Leaf") in - let wildcard_54_90 :: () = printsym(" ") in - let y_51_91 :: () = printint(x_50_88) in - let wildcard_53_92 :: () = printsym(")") in - () - Node x_55_93 x_56_94 -> - let wildcard_59_95 :: () = printsym("(Node") in - let wildcard_62_96 :: () = printsym(" ") in - let y_57_97 :: () = (_print_Add_Tree_10 [] x_55_93) in - let wildcard_61_98 :: () = printsym(" ") in - let y_58_99 :: () = (_print_Add_Tree_10 [] x_56_94) in - let wildcard_60_100 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101 :: (Packed Add_Tree_10) = (Node fltPkd_102 fltPkd_103) in - (Add_add1_11 [] fltAppE_101) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74 = + case t_7_74 of + Leaf x_8_75 -> + let fltPkd_120 :: Int = x_8_75 + 1 in + (Leaf fltPkd_120) + Node x1_9_76 x2_10_77 -> + let fltPkd_121 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76) in + let fltPkd_122 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77) in + (Node fltPkd_121 fltPkd_122) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78 = + case t_11_78 of + Leaf x_12_79 -> + let fltPkd_123 :: Int = x_12_79 + 2 in + (Leaf fltPkd_123) + Node x1_13_80 x2_14_81 -> + let fltPkd_124 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80) in + let fltPkd_125 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81) in + (Node fltPkd_124 fltPkd_125) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82 = + case arg_39_82 of + Leaf x_40_83 -> + let y_41_84 :: Int = x_40_83 in + (Leaf y_41_84) + Node x_42_85 x_43_86 -> + let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in + let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in + (Node y_44_87 y_45_88) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = + case arg_46_89 of + Leaf x_47_90 -> + let y_48_91 :: Int = x_47_90 in + (Leaf y_48_91) + Node x_49_92 x_50_93 -> + let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in + let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in + (Node y_51_94 y_52_95) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96 = + case arg_53_96 of + Leaf x_54_97 -> + () + Node x_56_98 x_57_99 -> + let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in + let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102 = + case arg_60_102 of + Leaf x_61_103 -> + let wildcard_63_104 :: () = printsym("(Leaf") in + let wildcard_65_105 :: () = printsym(" ") in + let y_62_106 :: () = printint(x_61_103) in + let wildcard_64_107 :: () = printsym(")") in + () + Node x_66_108 x_67_109 -> + let wildcard_70_110 :: () = printsym("(Node") in + let wildcard_73_111 :: () = printsym(" ") in + let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in + let wildcard_72_113 :: () = printsym(" ") in + let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in + let wildcard_71_115 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117 :: (Packed AddTree_Tree_4) = (Node fltPkd_118 fltPkd_119) in + let fltAppE_116 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117) in + (Addone_add_5 [] fltAppE_116) [compiler] Running pass, simplify Removed unused functions: [] Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - let y_30_69_119 :: Int = x_29_68_118 in - (Leaf y_30_69_119) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - let y_37_76_126 :: Int = x_36_75_125 in - (Leaf y_37_76_126) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + let y_41_84_146 :: Int = x_40_83_145 in + (Leaf y_41_84_146) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + let y_48_91_153 :: Int = x_47_90_152 in + (Leaf y_48_91_153) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, inlineTriv Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node (Packed Add_Tree_10) (Packed Add_Tree_10) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: (Packed Add_Tree_10) = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: (Packed Add_Tree_10) = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: (Packed Add_Tree_10) = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: (Packed Add_Tree_10) -> (Packed Add_Tree_10) -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: (Packed Add_Tree_10) = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: (Packed Add_Tree_10) -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: (Packed Add_Tree_10) = (Leaf 1) in - let fltPkd_103_108 :: (Packed Add_Tree_10) = (Leaf 2) in - let fltAppE_101_109 :: (Packed Add_Tree_10) = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, directL3 Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - (Add_add1_11 [] fltAppE_101_109) +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + (Addone_add_5 [] fltAppE_116_129) [compiler] Running pass, unariser Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, L3.flatten Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data Add_Tree_10 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Add_add1_11 :: Cursor -> Cursor -Add_add1_11 t_12_63_110 = - case t_12_63_110 of - Leaf x_13_64_111 -> - let fltPkd_104_112 :: Int = x_13_64_111 + 1 in - (Leaf fltPkd_104_112) - Node x1_14_65_113 x2_15_66_114 -> - let fltPkd_105_115 :: Cursor = (Add_add1_11 [] x1_14_65_113) in - let fltPkd_106_116 :: Cursor = (Add_add1_11 [] x2_15_66_114) in - (Node fltPkd_105_115 fltPkd_106_116) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Add_Tree_10 :: Cursor -> Cursor -_copy_Add_Tree_10 arg_28_67_117 = - case arg_28_67_117 of - Leaf x_29_68_118 -> - (Leaf x_29_68_118) - Node x_31_70_120 x_32_71_121 -> - let y_33_72_122 :: Cursor = (_copy_Add_Tree_10 [] x_31_70_120) in - let y_34_73_123 :: Cursor = (_copy_Add_Tree_10 [] x_32_71_121) in - (Node y_33_72_122 y_34_73_123) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Add_Tree_10 :: Cursor -> Cursor -_copy_without_ptrs_Add_Tree_10 arg_35_74_124 = - case arg_35_74_124 of - Leaf x_36_75_125 -> - (Leaf x_36_75_125) - Node x_38_77_127 x_39_78_128 -> - let y_40_79_129 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_38_77_127) in - let y_41_80_130 :: Cursor = (_copy_without_ptrs_Add_Tree_10 [] x_39_78_128) in - (Node y_40_79_129 y_41_80_130) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Add_Tree_10 :: Cursor -> () -_traverse_Add_Tree_10 arg_42_81_131 = - case arg_42_81_131 of - Leaf x_43_82_132 -> - () - Node x_45_83_133 x_46_84_134 -> - let y_47_85_135 :: () = (_traverse_Add_Tree_10 [] x_45_83_133) in - let y_48_86_136 :: () = (_traverse_Add_Tree_10 [] x_46_84_134) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Add_Tree_10 :: Cursor -> () -_print_Add_Tree_10 arg_49_87_137 = - case arg_49_87_137 of - Leaf x_50_88_138 -> - let wildcard_52_89_139 :: () = printsym("(Leaf") in - let wildcard_54_90_140 :: () = printsym(" ") in - let y_51_91_141 :: () = printint(x_50_88_138) in - let wildcard_53_92_142 :: () = printsym(")") in - () - Node x_55_93_143 x_56_94_144 -> - let wildcard_59_95_145 :: () = printsym("(Node") in - let wildcard_62_96_146 :: () = printsym(" ") in - let y_57_97_147 :: () = (_print_Add_Tree_10 [] x_55_93_143) in - let wildcard_61_98_148 :: () = printsym(" ") in - let y_58_99_149 :: () = (_print_Add_Tree_10 [] x_56_94_144) in - let wildcard_60_100_150 :: () = printsym(")") in - () - -gibbon_main :: (Packed Add_Tree_10) -gibbon_main = let fltPkd_102_107 :: Cursor = (Leaf 1) in - let fltPkd_103_108 :: Cursor = (Leaf 2) in - let fltAppE_101_109 :: Cursor = (Node fltPkd_102_107 fltPkd_103_108) in - let tmp_app_151 :: Cursor = (Add_add1_11 [] fltAppE_101_109) in - tmp_app_151 +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_5 :: Cursor -> Cursor +Addone_add_5 t_7_74_130 = + case t_7_74_130 of + Leaf x_8_75_131 -> + let fltPkd_120_132 :: Int = x_8_75_131 + 1 in + (Leaf fltPkd_120_132) + Node x1_9_76_133 x2_10_77_134 -> + let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in + let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in + (Node fltPkd_121_135 fltPkd_122_136) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: Cursor -> Cursor +Addtwo_add_6 t_11_78_137 = + case t_11_78_137 of + Leaf x_12_79_138 -> + let fltPkd_123_139 :: Int = x_12_79_138 + 2 in + (Leaf fltPkd_123_139) + Node x1_13_80_140 x2_14_81_141 -> + let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in + let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in + (Node fltPkd_124_142 fltPkd_125_143) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_39_82_144 = + case arg_39_82_144 of + Leaf x_40_83_145 -> + (Leaf x_40_83_145) + Node x_42_85_147 x_43_86_148 -> + let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in + let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in + (Node y_44_87_149 y_45_88_150) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = + case arg_46_89_151 of + Leaf x_47_90_152 -> + (Leaf x_47_90_152) + Node x_49_92_154 x_50_93_155 -> + let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in + let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in + (Node y_51_94_156 y_52_95_157) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_53_96_158 = + case arg_53_96_158 of + Leaf x_54_97_159 -> + () + Node x_56_98_160 x_57_99_161 -> + let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in + let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_60_102_164 = + case arg_60_102_164 of + Leaf x_61_103_165 -> + let wildcard_63_104_166 :: () = printsym("(Leaf") in + let wildcard_65_105_167 :: () = printsym(" ") in + let y_62_106_168 :: () = printint(x_61_103_165) in + let wildcard_64_107_169 :: () = printsym(")") in + () + Node x_66_108_170 x_67_109_171 -> + let wildcard_70_110_172 :: () = printsym("(Node") in + let wildcard_73_111_173 :: () = printsym(" ") in + let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in + let wildcard_72_113_175 :: () = printsym(" ") in + let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in + let wildcard_71_115_177 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in + let fltPkd_119_127 :: Cursor = (Leaf 2) in + let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in + let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in + let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in + tmp_app_178 [compiler] Running pass, lower Pass output: ================================================================================ -Prog {infoTable = [("Add_Tree_10", +Prog {infoTable = [("AddTree_Tree_4", [("Leaf", DataConInfo {dcon_tag = 0, scalar_bytes = 8, @@ -1561,277 +1881,332 @@ Prog {infoTable = [("Add_Tree_10", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), - (155, " ")], - fundefs = [FunDecl {funName = "Add_add1_11", - funArgs = [(t_12_63_110, CursorTy)], + symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), + (182, " ")], + fundefs = [FunDecl {funName = "Addone_add_5", + funArgs = [(t_7_74_130, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), - (tail_157, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), + (tail_184, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_12_63_110"], - bod = Switch "switch_160" - (VarTriv "tag_156") + rands = [VarTriv "t_7_74_130"], + bod = Switch "switch_187" + (VarTriv "tag_183") (IntAlts [(0, - LetUnpackT {binds = [(x_13_64_111, + LetUnpackT {binds = [(x_8_75_131, IntTy)], - ptr = "tail_157", - bod = LetPrimCallT {binds = [(fltPkd_104_112, + ptr = "tail_184", + bod = LetPrimCallT {binds = [(fltPkd_120_132, IntTy)], prim = AddP, - rands = [VarTriv "x_13_64_111", + rands = [VarTriv "x_8_75_131", IntTriv 1], - bod = LetAllocT {lhs = "tailift_158", + bod = LetAllocT {lhs = "tailift_185", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_104_112")], - bod = RetValsT [VarTriv "tailift_158"]}}}), + VarTriv "fltPkd_120_132")], + bod = RetValsT [VarTriv "tailift_185"]}}}), (1, - LetUnpackT {binds = [(x1_14_65_113, + LetUnpackT {binds = [(x1_9_76_133, CursorTy), - (x2_15_66_114, + (x2_10_77_134, CursorTy)], - ptr = "tail_157", + ptr = "tail_184", bod = LetCallT {async = False, - binds = [(fltPkd_105_115, + binds = [(fltPkd_121_135, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x1_14_65_113"], + rator = "Addone_add_5", + rands = [VarTriv "x1_9_76_133"], bod = LetCallT {async = False, - binds = [(fltPkd_106_116, + binds = [(fltPkd_122_136, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x2_15_66_114"], - bod = LetAllocT {lhs = "tailift_159", + rator = "Addone_add_5", + rands = [VarTriv "x2_10_77_134"], + bod = LetAllocT {lhs = "tailift_186", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_105_115"), + VarTriv "fltPkd_121_135"), (CursorTy, - VarTriv "fltPkd_106_116")], - bod = RetValsT [VarTriv "tailift_159"]}}}})]) - (Just ErrT "Unknown tag in: tag_156")}, + VarTriv "fltPkd_122_136")], + bod = RetValsT [VarTriv "tailift_186"]}}}})]) + (Just ErrT "Unknown tag in: tag_183")}, isPure = True}, - FunDecl {funName = "_copy_Add_Tree_10", - funArgs = [(arg_28_67_117, CursorTy)], + FunDecl {funName = "Addtwo_add_6", + funArgs = [(t_11_78_137, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), - (tail_162, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), + (tail_189, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_28_67_117"], - bod = Switch "switch_165" - (VarTriv "tag_161") + rands = [VarTriv "t_11_78_137"], + bod = Switch "switch_192" + (VarTriv "tag_188") (IntAlts [(0, - LetUnpackT {binds = [(x_29_68_118, + LetUnpackT {binds = [(x_12_79_138, IntTy)], - ptr = "tail_162", - bod = LetAllocT {lhs = "tailift_163", + ptr = "tail_189", + bod = LetPrimCallT {binds = [(fltPkd_123_139, + IntTy)], + prim = AddP, + rands = [VarTriv "x_12_79_138", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_190", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_123_139")], + bod = RetValsT [VarTriv "tailift_190"]}}}), + (1, + LetUnpackT {binds = [(x1_13_80_140, + CursorTy), + (x2_14_81_141, + CursorTy)], + ptr = "tail_189", + bod = LetCallT {async = False, + binds = [(fltPkd_124_142, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x1_13_80_140"], + bod = LetCallT {async = False, + binds = [(fltPkd_125_143, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x2_14_81_141"], + bod = LetAllocT {lhs = "tailift_191", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_124_142"), + (CursorTy, + VarTriv "fltPkd_125_143")], + bod = RetValsT [VarTriv "tailift_191"]}}}})]) + (Just ErrT "Unknown tag in: tag_188")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_39_82_144, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), + (tail_194, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_39_82_144"], + bod = Switch "switch_197" + (VarTriv "tag_193") + (IntAlts [(0, + LetUnpackT {binds = [(x_40_83_145, + IntTy)], + ptr = "tail_194", + bod = LetAllocT {lhs = "tailift_195", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_29_68_118")], - bod = RetValsT [VarTriv "tailift_163"]}}), + VarTriv "x_40_83_145")], + bod = RetValsT [VarTriv "tailift_195"]}}), (1, - LetUnpackT {binds = [(x_31_70_120, + LetUnpackT {binds = [(x_42_85_147, CursorTy), - (x_32_71_121, + (x_43_86_148, CursorTy)], - ptr = "tail_162", + ptr = "tail_194", bod = LetCallT {async = False, - binds = [(y_33_72_122, + binds = [(y_44_87_149, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_31_70_120"], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_42_85_147"], bod = LetCallT {async = False, - binds = [(y_34_73_123, + binds = [(y_45_88_150, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_32_71_121"], - bod = LetAllocT {lhs = "tailift_164", + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_43_86_148"], + bod = LetAllocT {lhs = "tailift_196", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_33_72_122"), + VarTriv "y_44_87_149"), (CursorTy, - VarTriv "y_34_73_123")], - bod = RetValsT [VarTriv "tailift_164"]}}}})]) - (Just ErrT "Unknown tag in: tag_161")}, + VarTriv "y_45_88_150")], + bod = RetValsT [VarTriv "tailift_196"]}}}})]) + (Just ErrT "Unknown tag in: tag_193")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", - funArgs = [(arg_35_74_124, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_46_89_151, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), - (tail_167, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), + (tail_199, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_35_74_124"], - bod = Switch "switch_170" - (VarTriv "tag_166") + rands = [VarTriv "arg_46_89_151"], + bod = Switch "switch_202" + (VarTriv "tag_198") (IntAlts [(0, - LetUnpackT {binds = [(x_36_75_125, + LetUnpackT {binds = [(x_47_90_152, IntTy)], - ptr = "tail_167", - bod = LetAllocT {lhs = "tailift_168", + ptr = "tail_199", + bod = LetAllocT {lhs = "tailift_200", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_36_75_125")], - bod = RetValsT [VarTriv "tailift_168"]}}), + VarTriv "x_47_90_152")], + bod = RetValsT [VarTriv "tailift_200"]}}), (1, - LetUnpackT {binds = [(x_38_77_127, + LetUnpackT {binds = [(x_49_92_154, CursorTy), - (x_39_78_128, + (x_50_93_155, CursorTy)], - ptr = "tail_167", + ptr = "tail_199", bod = LetCallT {async = False, - binds = [(y_40_79_129, + binds = [(y_51_94_156, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_38_77_127"], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_49_92_154"], bod = LetCallT {async = False, - binds = [(y_41_80_130, + binds = [(y_52_95_157, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_39_78_128"], - bod = LetAllocT {lhs = "tailift_169", + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_50_93_155"], + bod = LetAllocT {lhs = "tailift_201", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_40_79_129"), + VarTriv "y_51_94_156"), (CursorTy, - VarTriv "y_41_80_130")], - bod = RetValsT [VarTriv "tailift_169"]}}}})]) - (Just ErrT "Unknown tag in: tag_166")}, + VarTriv "y_52_95_157")], + bod = RetValsT [VarTriv "tailift_201"]}}}})]) + (Just ErrT "Unknown tag in: tag_198")}, isPure = True}, - FunDecl {funName = "_traverse_Add_Tree_10", - funArgs = [(arg_42_81_131, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_53_96_158, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), - (tail_172, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), + (tail_204, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_42_81_131"], - bod = Switch "switch_173" - (VarTriv "tag_171") + rands = [VarTriv "arg_53_96_158"], + bod = Switch "switch_205" + (VarTriv "tag_203") (IntAlts [(0, - LetUnpackT {binds = [(x_43_82_132, + LetUnpackT {binds = [(x_54_97_159, IntTy)], - ptr = "tail_172", + ptr = "tail_204", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_45_83_133, + LetUnpackT {binds = [(x_56_98_160, CursorTy), - (x_46_84_134, + (x_57_99_161, CursorTy)], - ptr = "tail_172", + ptr = "tail_204", bod = LetCallT {async = False, - binds = [(y_47_85_135, + binds = [(y_58_100_162, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_45_83_133"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_56_98_160"], bod = LetCallT {async = False, - binds = [(y_48_86_136, + binds = [(y_59_101_163, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_46_84_134"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_57_99_161"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_171")}, + (Just ErrT "Unknown tag in: tag_203")}, isPure = True}, - FunDecl {funName = "_print_Add_Tree_10", - funArgs = [(arg_49_87_137, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_60_102_164, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), - (tail_175, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), + (tail_207, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_49_87_137"], - bod = Switch "switch_176" - (VarTriv "tag_174") + rands = [VarTriv "arg_60_102_164"], + bod = Switch "switch_208" + (VarTriv "tag_206") (IntAlts [(0, - LetUnpackT {binds = [(x_50_88_138, + LetUnpackT {binds = [(x_61_103_165, IntTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_63_104_166, ProdTy [])], prim = PrintSym, - rands = [SymTriv 154], - bod = LetPrimCallT {binds = [(wildcard_54_90_140, + rands = [SymTriv 181], + bod = LetPrimCallT {binds = [(wildcard_65_105_167, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], - bod = LetPrimCallT {binds = [(y_51_91_141, + rands = [SymTriv 182], + bod = LetPrimCallT {binds = [(y_62_106_168, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_50_88_138"], - bod = LetPrimCallT {binds = [(wildcard_53_92_142, + rands = [VarTriv "x_61_103_165"], + bod = LetPrimCallT {binds = [(wildcard_64_107_169, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_55_93_143, + LetUnpackT {binds = [(x_66_108_170, CursorTy), - (x_56_94_144, + (x_67_109_171, CursorTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_70_110_172, ProdTy [])], prim = PrintSym, - rands = [SymTriv 153], - bod = LetPrimCallT {binds = [(wildcard_62_96_146, + rands = [SymTriv 180], + bod = LetPrimCallT {binds = [(wildcard_73_111_173, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_57_97_147, + binds = [(y_68_112_174, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_55_93_143"], - bod = LetPrimCallT {binds = [(wildcard_61_98_148, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_66_108_170"], + bod = LetPrimCallT {binds = [(wildcard_72_113_175, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_58_99_149, + binds = [(y_69_114_176, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_56_94_144"], - bod = LetPrimCallT {binds = [(wildcard_60_100_150, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_67_109_171"], + bod = LetPrimCallT {binds = [(wildcard_71_115_177, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_174")}, + (Just ErrT "Unknown tag in: tag_206")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_102_107", + {lhs = "fltPkd_118_126", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_103_108", + bod = LetAllocT {lhs = "fltPkd_119_127", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_101_109", + bod = LetAllocT {lhs = "fltAppE_117_128", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_102_107"), + VarTriv "fltPkd_118_126"), (CursorTy, - VarTriv "fltPkd_103_108")], + VarTriv "fltPkd_119_127")], bod = LetCallT {async = False, - binds = [(tmp_app_151, + binds = [(fltAppE_116_129, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "fltAppE_101_109"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_117_128"], bod = LetCallT {async = False, - binds = [], - rator = "_print_Add_Tree_10", - rands = [VarTriv "tmp_app_151"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}})} + binds = [(tmp_app_178, + CursorTy)], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_116_129"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_178"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} [compiler] Running pass, lateInlineTriv Pass output: ================================================================================ -Prog {infoTable = [("Add_Tree_10", +Prog {infoTable = [("AddTree_Tree_4", [("Leaf", DataConInfo {dcon_tag = 0, scalar_bytes = 8, @@ -1846,277 +2221,332 @@ Prog {infoTable = [("Add_Tree_10", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), - (155, " ")], - fundefs = [FunDecl {funName = "Add_add1_11", - funArgs = [(t_12_63_110, CursorTy)], + symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), + (182, " ")], + fundefs = [FunDecl {funName = "Addone_add_5", + funArgs = [(t_7_74_130, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), - (tail_157, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), + (tail_184, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_12_63_110"], - bod = Switch "switch_160" - (VarTriv "tag_156") + rands = [VarTriv "t_7_74_130"], + bod = Switch "switch_187" + (VarTriv "tag_183") (IntAlts [(0, - LetUnpackT {binds = [(x_13_64_111, + LetUnpackT {binds = [(x_8_75_131, IntTy)], - ptr = "tail_157", - bod = LetPrimCallT {binds = [(fltPkd_104_112, + ptr = "tail_184", + bod = LetPrimCallT {binds = [(fltPkd_120_132, IntTy)], prim = AddP, - rands = [VarTriv "x_13_64_111", + rands = [VarTriv "x_8_75_131", IntTriv 1], - bod = LetAllocT {lhs = "tailift_158", + bod = LetAllocT {lhs = "tailift_185", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_104_112")], - bod = RetValsT [VarTriv "tailift_158"]}}}), + VarTriv "fltPkd_120_132")], + bod = RetValsT [VarTriv "tailift_185"]}}}), (1, - LetUnpackT {binds = [(x1_14_65_113, + LetUnpackT {binds = [(x1_9_76_133, CursorTy), - (x2_15_66_114, + (x2_10_77_134, CursorTy)], - ptr = "tail_157", + ptr = "tail_184", bod = LetCallT {async = False, - binds = [(fltPkd_105_115, + binds = [(fltPkd_121_135, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x1_14_65_113"], + rator = "Addone_add_5", + rands = [VarTriv "x1_9_76_133"], bod = LetCallT {async = False, - binds = [(fltPkd_106_116, + binds = [(fltPkd_122_136, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x2_15_66_114"], - bod = LetAllocT {lhs = "tailift_159", + rator = "Addone_add_5", + rands = [VarTriv "x2_10_77_134"], + bod = LetAllocT {lhs = "tailift_186", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_105_115"), + VarTriv "fltPkd_121_135"), (CursorTy, - VarTriv "fltPkd_106_116")], - bod = RetValsT [VarTriv "tailift_159"]}}}})]) - (Just ErrT "Unknown tag in: tag_156")}, + VarTriv "fltPkd_122_136")], + bod = RetValsT [VarTriv "tailift_186"]}}}})]) + (Just ErrT "Unknown tag in: tag_183")}, isPure = True}, - FunDecl {funName = "_copy_Add_Tree_10", - funArgs = [(arg_28_67_117, CursorTy)], + FunDecl {funName = "Addtwo_add_6", + funArgs = [(t_11_78_137, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), - (tail_162, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), + (tail_189, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_28_67_117"], - bod = Switch "switch_165" - (VarTriv "tag_161") + rands = [VarTriv "t_11_78_137"], + bod = Switch "switch_192" + (VarTriv "tag_188") (IntAlts [(0, - LetUnpackT {binds = [(x_29_68_118, + LetUnpackT {binds = [(x_12_79_138, IntTy)], - ptr = "tail_162", - bod = LetAllocT {lhs = "tailift_163", + ptr = "tail_189", + bod = LetPrimCallT {binds = [(fltPkd_123_139, + IntTy)], + prim = AddP, + rands = [VarTriv "x_12_79_138", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_190", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_123_139")], + bod = RetValsT [VarTriv "tailift_190"]}}}), + (1, + LetUnpackT {binds = [(x1_13_80_140, + CursorTy), + (x2_14_81_141, + CursorTy)], + ptr = "tail_189", + bod = LetCallT {async = False, + binds = [(fltPkd_124_142, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x1_13_80_140"], + bod = LetCallT {async = False, + binds = [(fltPkd_125_143, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x2_14_81_141"], + bod = LetAllocT {lhs = "tailift_191", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_124_142"), + (CursorTy, + VarTriv "fltPkd_125_143")], + bod = RetValsT [VarTriv "tailift_191"]}}}})]) + (Just ErrT "Unknown tag in: tag_188")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_39_82_144, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), + (tail_194, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_39_82_144"], + bod = Switch "switch_197" + (VarTriv "tag_193") + (IntAlts [(0, + LetUnpackT {binds = [(x_40_83_145, + IntTy)], + ptr = "tail_194", + bod = LetAllocT {lhs = "tailift_195", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_29_68_118")], - bod = RetValsT [VarTriv "tailift_163"]}}), + VarTriv "x_40_83_145")], + bod = RetValsT [VarTriv "tailift_195"]}}), (1, - LetUnpackT {binds = [(x_31_70_120, + LetUnpackT {binds = [(x_42_85_147, CursorTy), - (x_32_71_121, + (x_43_86_148, CursorTy)], - ptr = "tail_162", + ptr = "tail_194", bod = LetCallT {async = False, - binds = [(y_33_72_122, + binds = [(y_44_87_149, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_31_70_120"], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_42_85_147"], bod = LetCallT {async = False, - binds = [(y_34_73_123, + binds = [(y_45_88_150, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_32_71_121"], - bod = LetAllocT {lhs = "tailift_164", + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_43_86_148"], + bod = LetAllocT {lhs = "tailift_196", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_33_72_122"), + VarTriv "y_44_87_149"), (CursorTy, - VarTriv "y_34_73_123")], - bod = RetValsT [VarTriv "tailift_164"]}}}})]) - (Just ErrT "Unknown tag in: tag_161")}, + VarTriv "y_45_88_150")], + bod = RetValsT [VarTriv "tailift_196"]}}}})]) + (Just ErrT "Unknown tag in: tag_193")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", - funArgs = [(arg_35_74_124, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_46_89_151, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), - (tail_167, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), + (tail_199, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_35_74_124"], - bod = Switch "switch_170" - (VarTriv "tag_166") + rands = [VarTriv "arg_46_89_151"], + bod = Switch "switch_202" + (VarTriv "tag_198") (IntAlts [(0, - LetUnpackT {binds = [(x_36_75_125, + LetUnpackT {binds = [(x_47_90_152, IntTy)], - ptr = "tail_167", - bod = LetAllocT {lhs = "tailift_168", + ptr = "tail_199", + bod = LetAllocT {lhs = "tailift_200", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_36_75_125")], - bod = RetValsT [VarTriv "tailift_168"]}}), + VarTriv "x_47_90_152")], + bod = RetValsT [VarTriv "tailift_200"]}}), (1, - LetUnpackT {binds = [(x_38_77_127, + LetUnpackT {binds = [(x_49_92_154, CursorTy), - (x_39_78_128, + (x_50_93_155, CursorTy)], - ptr = "tail_167", + ptr = "tail_199", bod = LetCallT {async = False, - binds = [(y_40_79_129, + binds = [(y_51_94_156, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_38_77_127"], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_49_92_154"], bod = LetCallT {async = False, - binds = [(y_41_80_130, + binds = [(y_52_95_157, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_39_78_128"], - bod = LetAllocT {lhs = "tailift_169", + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_50_93_155"], + bod = LetAllocT {lhs = "tailift_201", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_40_79_129"), + VarTriv "y_51_94_156"), (CursorTy, - VarTriv "y_41_80_130")], - bod = RetValsT [VarTriv "tailift_169"]}}}})]) - (Just ErrT "Unknown tag in: tag_166")}, + VarTriv "y_52_95_157")], + bod = RetValsT [VarTriv "tailift_201"]}}}})]) + (Just ErrT "Unknown tag in: tag_198")}, isPure = True}, - FunDecl {funName = "_traverse_Add_Tree_10", - funArgs = [(arg_42_81_131, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_53_96_158, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), - (tail_172, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), + (tail_204, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_42_81_131"], - bod = Switch "switch_173" - (VarTriv "tag_171") + rands = [VarTriv "arg_53_96_158"], + bod = Switch "switch_205" + (VarTriv "tag_203") (IntAlts [(0, - LetUnpackT {binds = [(x_43_82_132, + LetUnpackT {binds = [(x_54_97_159, IntTy)], - ptr = "tail_172", + ptr = "tail_204", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_45_83_133, + LetUnpackT {binds = [(x_56_98_160, CursorTy), - (x_46_84_134, + (x_57_99_161, CursorTy)], - ptr = "tail_172", + ptr = "tail_204", bod = LetCallT {async = False, - binds = [(y_47_85_135, + binds = [(y_58_100_162, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_45_83_133"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_56_98_160"], bod = LetCallT {async = False, - binds = [(y_48_86_136, + binds = [(y_59_101_163, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_46_84_134"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_57_99_161"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_171")}, + (Just ErrT "Unknown tag in: tag_203")}, isPure = True}, - FunDecl {funName = "_print_Add_Tree_10", - funArgs = [(arg_49_87_137, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_60_102_164, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), - (tail_175, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), + (tail_207, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_49_87_137"], - bod = Switch "switch_176" - (VarTriv "tag_174") + rands = [VarTriv "arg_60_102_164"], + bod = Switch "switch_208" + (VarTriv "tag_206") (IntAlts [(0, - LetUnpackT {binds = [(x_50_88_138, + LetUnpackT {binds = [(x_61_103_165, IntTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_63_104_166, ProdTy [])], prim = PrintSym, - rands = [SymTriv 154], - bod = LetPrimCallT {binds = [(wildcard_54_90_140, + rands = [SymTriv 181], + bod = LetPrimCallT {binds = [(wildcard_65_105_167, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], - bod = LetPrimCallT {binds = [(y_51_91_141, + rands = [SymTriv 182], + bod = LetPrimCallT {binds = [(y_62_106_168, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_50_88_138"], - bod = LetPrimCallT {binds = [(wildcard_53_92_142, + rands = [VarTriv "x_61_103_165"], + bod = LetPrimCallT {binds = [(wildcard_64_107_169, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_55_93_143, + LetUnpackT {binds = [(x_66_108_170, CursorTy), - (x_56_94_144, + (x_67_109_171, CursorTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_70_110_172, ProdTy [])], prim = PrintSym, - rands = [SymTriv 153], - bod = LetPrimCallT {binds = [(wildcard_62_96_146, + rands = [SymTriv 180], + bod = LetPrimCallT {binds = [(wildcard_73_111_173, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_57_97_147, + binds = [(y_68_112_174, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_55_93_143"], - bod = LetPrimCallT {binds = [(wildcard_61_98_148, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_66_108_170"], + bod = LetPrimCallT {binds = [(wildcard_72_113_175, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_58_99_149, + binds = [(y_69_114_176, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_56_94_144"], - bod = LetPrimCallT {binds = [(wildcard_60_100_150, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_67_109_171"], + bod = LetPrimCallT {binds = [(wildcard_71_115_177, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_174")}, + (Just ErrT "Unknown tag in: tag_206")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_102_107", + {lhs = "fltPkd_118_126", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_103_108", + bod = LetAllocT {lhs = "fltPkd_119_127", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_101_109", + bod = LetAllocT {lhs = "fltAppE_117_128", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_102_107"), + VarTriv "fltPkd_118_126"), (CursorTy, - VarTriv "fltPkd_103_108")], + VarTriv "fltPkd_119_127")], bod = LetCallT {async = False, - binds = [(tmp_app_151, + binds = [(fltAppE_116_129, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "fltAppE_101_109"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_117_128"], bod = LetCallT {async = False, - binds = [], - rator = "_print_Add_Tree_10", - rands = [VarTriv "tmp_app_151"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}})} + binds = [(tmp_app_178, + CursorTy)], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_116_129"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_178"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} [compiler] Running pass, rearrangeFree Pass output: ================================================================================ -Prog {infoTable = [("Add_Tree_10", +Prog {infoTable = [("AddTree_Tree_4", [("Leaf", DataConInfo {dcon_tag = 0, scalar_bytes = 8, @@ -2131,274 +2561,329 @@ Prog {infoTable = [("Add_Tree_10", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(152, ")"),(153, "(Node"),(154, "(Leaf"), - (155, " ")], - fundefs = [FunDecl {funName = "Add_add1_11", - funArgs = [(t_12_63_110, CursorTy)], + symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), + (182, " ")], + fundefs = [FunDecl {funName = "Addone_add_5", + funArgs = [(t_7_74_130, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_156, TagTyPacked), - (tail_157, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), + (tail_184, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_12_63_110"], - bod = Switch "switch_160" - (VarTriv "tag_156") + rands = [VarTriv "t_7_74_130"], + bod = Switch "switch_187" + (VarTriv "tag_183") (IntAlts [(0, - LetUnpackT {binds = [(x_13_64_111, + LetUnpackT {binds = [(x_8_75_131, IntTy)], - ptr = "tail_157", - bod = LetPrimCallT {binds = [(fltPkd_104_112, + ptr = "tail_184", + bod = LetPrimCallT {binds = [(fltPkd_120_132, IntTy)], prim = AddP, - rands = [VarTriv "x_13_64_111", + rands = [VarTriv "x_8_75_131", IntTriv 1], - bod = LetAllocT {lhs = "tailift_158", + bod = LetAllocT {lhs = "tailift_185", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_104_112")], - bod = RetValsT [VarTriv "tailift_158"]}}}), + VarTriv "fltPkd_120_132")], + bod = RetValsT [VarTriv "tailift_185"]}}}), (1, - LetUnpackT {binds = [(x1_14_65_113, + LetUnpackT {binds = [(x1_9_76_133, CursorTy), - (x2_15_66_114, + (x2_10_77_134, CursorTy)], - ptr = "tail_157", + ptr = "tail_184", bod = LetCallT {async = False, - binds = [(fltPkd_105_115, + binds = [(fltPkd_121_135, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x1_14_65_113"], + rator = "Addone_add_5", + rands = [VarTriv "x1_9_76_133"], bod = LetCallT {async = False, - binds = [(fltPkd_106_116, + binds = [(fltPkd_122_136, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "x2_15_66_114"], - bod = LetAllocT {lhs = "tailift_159", + rator = "Addone_add_5", + rands = [VarTriv "x2_10_77_134"], + bod = LetAllocT {lhs = "tailift_186", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_105_115"), + VarTriv "fltPkd_121_135"), (CursorTy, - VarTriv "fltPkd_106_116")], - bod = RetValsT [VarTriv "tailift_159"]}}}})]) - (Just ErrT "Unknown tag in: tag_156")}, + VarTriv "fltPkd_122_136")], + bod = RetValsT [VarTriv "tailift_186"]}}}})]) + (Just ErrT "Unknown tag in: tag_183")}, isPure = True}, - FunDecl {funName = "_copy_Add_Tree_10", - funArgs = [(arg_28_67_117, CursorTy)], + FunDecl {funName = "Addtwo_add_6", + funArgs = [(t_11_78_137, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_161, TagTyPacked), - (tail_162, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), + (tail_189, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_28_67_117"], - bod = Switch "switch_165" - (VarTriv "tag_161") + rands = [VarTriv "t_11_78_137"], + bod = Switch "switch_192" + (VarTriv "tag_188") (IntAlts [(0, - LetUnpackT {binds = [(x_29_68_118, + LetUnpackT {binds = [(x_12_79_138, IntTy)], - ptr = "tail_162", - bod = LetAllocT {lhs = "tailift_163", + ptr = "tail_189", + bod = LetPrimCallT {binds = [(fltPkd_123_139, + IntTy)], + prim = AddP, + rands = [VarTriv "x_12_79_138", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_190", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_123_139")], + bod = RetValsT [VarTriv "tailift_190"]}}}), + (1, + LetUnpackT {binds = [(x1_13_80_140, + CursorTy), + (x2_14_81_141, + CursorTy)], + ptr = "tail_189", + bod = LetCallT {async = False, + binds = [(fltPkd_124_142, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x1_13_80_140"], + bod = LetCallT {async = False, + binds = [(fltPkd_125_143, + CursorTy)], + rator = "Addtwo_add_6", + rands = [VarTriv "x2_14_81_141"], + bod = LetAllocT {lhs = "tailift_191", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_124_142"), + (CursorTy, + VarTriv "fltPkd_125_143")], + bod = RetValsT [VarTriv "tailift_191"]}}}})]) + (Just ErrT "Unknown tag in: tag_188")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_39_82_144, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), + (tail_194, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_39_82_144"], + bod = Switch "switch_197" + (VarTriv "tag_193") + (IntAlts [(0, + LetUnpackT {binds = [(x_40_83_145, + IntTy)], + ptr = "tail_194", + bod = LetAllocT {lhs = "tailift_195", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_29_68_118")], - bod = RetValsT [VarTriv "tailift_163"]}}), + VarTriv "x_40_83_145")], + bod = RetValsT [VarTriv "tailift_195"]}}), (1, - LetUnpackT {binds = [(x_31_70_120, + LetUnpackT {binds = [(x_42_85_147, CursorTy), - (x_32_71_121, + (x_43_86_148, CursorTy)], - ptr = "tail_162", + ptr = "tail_194", bod = LetCallT {async = False, - binds = [(y_33_72_122, + binds = [(y_44_87_149, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_31_70_120"], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_42_85_147"], bod = LetCallT {async = False, - binds = [(y_34_73_123, + binds = [(y_45_88_150, CursorTy)], - rator = "_copy_Add_Tree_10", - rands = [VarTriv "x_32_71_121"], - bod = LetAllocT {lhs = "tailift_164", + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_43_86_148"], + bod = LetAllocT {lhs = "tailift_196", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_33_72_122"), + VarTriv "y_44_87_149"), (CursorTy, - VarTriv "y_34_73_123")], - bod = RetValsT [VarTriv "tailift_164"]}}}})]) - (Just ErrT "Unknown tag in: tag_161")}, + VarTriv "y_45_88_150")], + bod = RetValsT [VarTriv "tailift_196"]}}}})]) + (Just ErrT "Unknown tag in: tag_193")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Add_Tree_10", - funArgs = [(arg_35_74_124, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_46_89_151, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_166, TagTyPacked), - (tail_167, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), + (tail_199, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_35_74_124"], - bod = Switch "switch_170" - (VarTriv "tag_166") + rands = [VarTriv "arg_46_89_151"], + bod = Switch "switch_202" + (VarTriv "tag_198") (IntAlts [(0, - LetUnpackT {binds = [(x_36_75_125, + LetUnpackT {binds = [(x_47_90_152, IntTy)], - ptr = "tail_167", - bod = LetAllocT {lhs = "tailift_168", + ptr = "tail_199", + bod = LetAllocT {lhs = "tailift_200", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_36_75_125")], - bod = RetValsT [VarTriv "tailift_168"]}}), + VarTriv "x_47_90_152")], + bod = RetValsT [VarTriv "tailift_200"]}}), (1, - LetUnpackT {binds = [(x_38_77_127, + LetUnpackT {binds = [(x_49_92_154, CursorTy), - (x_39_78_128, + (x_50_93_155, CursorTy)], - ptr = "tail_167", + ptr = "tail_199", bod = LetCallT {async = False, - binds = [(y_40_79_129, + binds = [(y_51_94_156, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_38_77_127"], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_49_92_154"], bod = LetCallT {async = False, - binds = [(y_41_80_130, + binds = [(y_52_95_157, CursorTy)], - rator = "_copy_without_ptrs_Add_Tree_10", - rands = [VarTriv "x_39_78_128"], - bod = LetAllocT {lhs = "tailift_169", + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_50_93_155"], + bod = LetAllocT {lhs = "tailift_201", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_40_79_129"), + VarTriv "y_51_94_156"), (CursorTy, - VarTriv "y_41_80_130")], - bod = RetValsT [VarTriv "tailift_169"]}}}})]) - (Just ErrT "Unknown tag in: tag_166")}, + VarTriv "y_52_95_157")], + bod = RetValsT [VarTriv "tailift_201"]}}}})]) + (Just ErrT "Unknown tag in: tag_198")}, isPure = True}, - FunDecl {funName = "_traverse_Add_Tree_10", - funArgs = [(arg_42_81_131, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_53_96_158, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_171, TagTyPacked), - (tail_172, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), + (tail_204, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_42_81_131"], - bod = Switch "switch_173" - (VarTriv "tag_171") + rands = [VarTriv "arg_53_96_158"], + bod = Switch "switch_205" + (VarTriv "tag_203") (IntAlts [(0, - LetUnpackT {binds = [(x_43_82_132, + LetUnpackT {binds = [(x_54_97_159, IntTy)], - ptr = "tail_172", + ptr = "tail_204", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_45_83_133, + LetUnpackT {binds = [(x_56_98_160, CursorTy), - (x_46_84_134, + (x_57_99_161, CursorTy)], - ptr = "tail_172", + ptr = "tail_204", bod = LetCallT {async = False, - binds = [(y_47_85_135, + binds = [(y_58_100_162, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_45_83_133"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_56_98_160"], bod = LetCallT {async = False, - binds = [(y_48_86_136, + binds = [(y_59_101_163, ProdTy [])], - rator = "_traverse_Add_Tree_10", - rands = [VarTriv "x_46_84_134"], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_57_99_161"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_171")}, + (Just ErrT "Unknown tag in: tag_203")}, isPure = True}, - FunDecl {funName = "_print_Add_Tree_10", - funArgs = [(arg_49_87_137, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_60_102_164, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_174, TagTyPacked), - (tail_175, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), + (tail_207, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_49_87_137"], - bod = Switch "switch_176" - (VarTriv "tag_174") + rands = [VarTriv "arg_60_102_164"], + bod = Switch "switch_208" + (VarTriv "tag_206") (IntAlts [(0, - LetUnpackT {binds = [(x_50_88_138, + LetUnpackT {binds = [(x_61_103_165, IntTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_52_89_139, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_63_104_166, ProdTy [])], prim = PrintSym, - rands = [SymTriv 154], - bod = LetPrimCallT {binds = [(wildcard_54_90_140, + rands = [SymTriv 181], + bod = LetPrimCallT {binds = [(wildcard_65_105_167, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], - bod = LetPrimCallT {binds = [(y_51_91_141, + rands = [SymTriv 182], + bod = LetPrimCallT {binds = [(y_62_106_168, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_50_88_138"], - bod = LetPrimCallT {binds = [(wildcard_53_92_142, + rands = [VarTriv "x_61_103_165"], + bod = LetPrimCallT {binds = [(wildcard_64_107_169, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_55_93_143, + LetUnpackT {binds = [(x_66_108_170, CursorTy), - (x_56_94_144, + (x_67_109_171, CursorTy)], - ptr = "tail_175", - bod = LetPrimCallT {binds = [(wildcard_59_95_145, + ptr = "tail_207", + bod = LetPrimCallT {binds = [(wildcard_70_110_172, ProdTy [])], prim = PrintSym, - rands = [SymTriv 153], - bod = LetPrimCallT {binds = [(wildcard_62_96_146, + rands = [SymTriv 180], + bod = LetPrimCallT {binds = [(wildcard_73_111_173, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_57_97_147, + binds = [(y_68_112_174, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_55_93_143"], - bod = LetPrimCallT {binds = [(wildcard_61_98_148, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_66_108_170"], + bod = LetPrimCallT {binds = [(wildcard_72_113_175, ProdTy [])], prim = PrintSym, - rands = [SymTriv 155], + rands = [SymTriv 182], bod = LetCallT {async = False, - binds = [(y_58_99_149, + binds = [(y_69_114_176, ProdTy [])], - rator = "_print_Add_Tree_10", - rands = [VarTriv "x_56_94_144"], - bod = LetPrimCallT {binds = [(wildcard_60_100_150, + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_67_109_171"], + bod = LetPrimCallT {binds = [(wildcard_71_115_177, ProdTy [])], prim = PrintSym, - rands = [SymTriv 152], + rands = [SymTriv 179], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_174")}, + (Just ErrT "Unknown tag in: tag_206")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_102_107", + {lhs = "fltPkd_118_126", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_103_108", + bod = LetAllocT {lhs = "fltPkd_119_127", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_101_109", + bod = LetAllocT {lhs = "fltAppE_117_128", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_102_107"), + VarTriv "fltPkd_118_126"), (CursorTy, - VarTriv "fltPkd_103_108")], + VarTriv "fltPkd_119_127")], bod = LetCallT {async = False, - binds = [(tmp_app_151, + binds = [(fltAppE_116_129, CursorTy)], - rator = "Add_add1_11", - rands = [VarTriv "fltAppE_101_109"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_117_128"], bod = LetCallT {async = False, - binds = [], - rator = "_print_Add_Tree_10", - rands = [VarTriv "tmp_app_151"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}})} - - [compiler] Final C codegen: 11506 characters. + binds = [(tmp_app_178, + CursorTy)], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_116_129"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_178"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Final C codegen: 13304 characters. ================================================================================ /* Gibbon program. */ @@ -2464,11 +2949,12 @@ typedef struct GibCursorGibCursorProd_struct { GibCursor field0; GibCursor field1; } GibCursorGibCursorProd; -GibCursor Add_add1_11(GibCursor t_12_63_110); -GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117); -GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124); -unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131); -unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137); +GibCursor Addone_add_5(GibCursor t_7_74_130); +GibCursor Addtwo_add_6(GibCursor t_11_78_137); +GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144); +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151); +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158); +unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164); typedef enum { GibInt_T, GibFloat_T, @@ -2477,7 +2963,7 @@ typedef enum { GibVector_T, GibList_T, GibCursor_T, - Add_Tree_10_T, + AddTree_Tree_4_T, } GibDatatype; void info_table_initialize(void) { @@ -2490,191 +2976,240 @@ void info_table_initialize(void) GibDatatype field_tys[1]; - error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 0, 8, 0, 1, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, Add_Tree_10_T, 0); + error, AddTree_Tree_4_T, 0); exit(1); } - error = gib_info_table_insert_packed_dcon(Add_Tree_10_T, 1, 0, 2, 0, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, Add_Tree_10_T, 1); + error, AddTree_Tree_4_T, 1); exit(1); } gib_info_table_finalize(); } void symbol_table_initialize(void) { - gib_add_symbol(152, ")"); - gib_add_symbol(153, "(Node"); - gib_add_symbol(154, "(Leaf"); - gib_add_symbol(155, " "); + gib_add_symbol(179, ")"); + gib_add_symbol(180, "(Node"); + gib_add_symbol(181, "(Leaf"); + gib_add_symbol(182, " "); +} +GibCursor Addone_add_5(GibCursor t_7_74_130) +{ + GibPackedTag tag_183 = *(GibPackedTag *) t_7_74_130; + GibCursor tail_184 = t_7_74_130 + sizeof(GibInt); + + + switch_187: + ; + switch (tag_183) { + + case 0: + { + GibInt x_8_75_131 = ((GibIntProd *) tail_184)->field0; + GibInt fltPkd_120_132 = x_8_75_131 + 1; + GibPtr tailift_185 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_185)->field0 = 0; + ((GibIntGibIntProd *) tailift_185)->field1 = fltPkd_120_132; + return tailift_185; + break; + } + + case 1: + { + GibCursor x1_9_76_133 = + ((GibCursorGibCursorProd *) tail_184)->field0; + GibCursor x2_10_77_134 = + ((GibCursorGibCursorProd *) tail_184)->field1; + GibCursor fltPkd_121_135 = Addone_add_5(x1_9_76_133); + GibCursor fltPkd_122_136 = Addone_add_5(x2_10_77_134); + GibPtr tailift_186 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_186)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_186)->field1 = + fltPkd_121_135; + ((GibIntGibCursorGibCursorProd *) tailift_186)->field2 = + fltPkd_122_136; + return tailift_186; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_183"); + exit(1); + } + } } -GibCursor Add_add1_11(GibCursor t_12_63_110) +GibCursor Addtwo_add_6(GibCursor t_11_78_137) { - GibPackedTag tag_156 = *(GibPackedTag *) t_12_63_110; - GibCursor tail_157 = t_12_63_110 + sizeof(GibInt); + GibPackedTag tag_188 = *(GibPackedTag *) t_11_78_137; + GibCursor tail_189 = t_11_78_137 + sizeof(GibInt); - switch_160: + switch_192: ; - switch (tag_156) { + switch (tag_188) { case 0: { - GibInt x_13_64_111 = ((GibIntProd *) tail_157)->field0; - GibInt fltPkd_104_112 = x_13_64_111 + 1; - GibPtr tailift_158 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_12_79_138 = ((GibIntProd *) tail_189)->field0; + GibInt fltPkd_123_139 = x_12_79_138 + 2; + GibPtr tailift_190 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_158)->field0 = 0; - ((GibIntGibIntProd *) tailift_158)->field1 = fltPkd_104_112; - return tailift_158; + ((GibIntGibIntProd *) tailift_190)->field0 = 0; + ((GibIntGibIntProd *) tailift_190)->field1 = fltPkd_123_139; + return tailift_190; break; } case 1: { - GibCursor x1_14_65_113 = - ((GibCursorGibCursorProd *) tail_157)->field0; - GibCursor x2_15_66_114 = - ((GibCursorGibCursorProd *) tail_157)->field1; - GibCursor fltPkd_105_115 = Add_add1_11(x1_14_65_113); - GibCursor fltPkd_106_116 = Add_add1_11(x2_15_66_114); - GibPtr tailift_159 = + GibCursor x1_13_80_140 = + ((GibCursorGibCursorProd *) tail_189)->field0; + GibCursor x2_14_81_141 = + ((GibCursorGibCursorProd *) tail_189)->field1; + GibCursor fltPkd_124_142 = Addtwo_add_6(x1_13_80_140); + GibCursor fltPkd_125_143 = Addtwo_add_6(x2_14_81_141); + GibPtr tailift_191 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_159)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_159)->field1 = - fltPkd_105_115; - ((GibIntGibCursorGibCursorProd *) tailift_159)->field2 = - fltPkd_106_116; - return tailift_159; + ((GibIntGibCursorGibCursorProd *) tailift_191)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_191)->field1 = + fltPkd_124_142; + ((GibIntGibCursorGibCursorProd *) tailift_191)->field2 = + fltPkd_125_143; + return tailift_191; break; } default: { - printf("%s\n", "Unknown tag in: tag_156"); + printf("%s\n", "Unknown tag in: tag_188"); exit(1); } } } -GibCursor _copy_Add_Tree_10(GibCursor arg_28_67_117) +GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144) { - GibPackedTag tag_161 = *(GibPackedTag *) arg_28_67_117; - GibCursor tail_162 = arg_28_67_117 + sizeof(GibInt); + GibPackedTag tag_193 = *(GibPackedTag *) arg_39_82_144; + GibCursor tail_194 = arg_39_82_144 + sizeof(GibInt); - switch_165: + switch_197: ; - switch (tag_161) { + switch (tag_193) { case 0: { - GibInt x_29_68_118 = ((GibIntProd *) tail_162)->field0; - GibPtr tailift_163 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_40_83_145 = ((GibIntProd *) tail_194)->field0; + GibPtr tailift_195 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_163)->field0 = 0; - ((GibIntGibIntProd *) tailift_163)->field1 = x_29_68_118; - return tailift_163; + ((GibIntGibIntProd *) tailift_195)->field0 = 0; + ((GibIntGibIntProd *) tailift_195)->field1 = x_40_83_145; + return tailift_195; break; } case 1: { - GibCursor x_31_70_120 = - ((GibCursorGibCursorProd *) tail_162)->field0; - GibCursor x_32_71_121 = - ((GibCursorGibCursorProd *) tail_162)->field1; - GibCursor y_33_72_122 = _copy_Add_Tree_10(x_31_70_120); - GibCursor y_34_73_123 = _copy_Add_Tree_10(x_32_71_121); - GibPtr tailift_164 = + GibCursor x_42_85_147 = + ((GibCursorGibCursorProd *) tail_194)->field0; + GibCursor x_43_86_148 = + ((GibCursorGibCursorProd *) tail_194)->field1; + GibCursor y_44_87_149 = _copy_AddTree_Tree_4(x_42_85_147); + GibCursor y_45_88_150 = _copy_AddTree_Tree_4(x_43_86_148); + GibPtr tailift_196 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_164)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_164)->field1 = - y_33_72_122; - ((GibIntGibCursorGibCursorProd *) tailift_164)->field2 = - y_34_73_123; - return tailift_164; + ((GibIntGibCursorGibCursorProd *) tailift_196)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_196)->field1 = + y_44_87_149; + ((GibIntGibCursorGibCursorProd *) tailift_196)->field2 = + y_45_88_150; + return tailift_196; break; } default: { - printf("%s\n", "Unknown tag in: tag_161"); + printf("%s\n", "Unknown tag in: tag_193"); exit(1); } } } -GibCursor _copy_without_ptrs_Add_Tree_10(GibCursor arg_35_74_124) +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151) { - GibPackedTag tag_166 = *(GibPackedTag *) arg_35_74_124; - GibCursor tail_167 = arg_35_74_124 + sizeof(GibInt); + GibPackedTag tag_198 = *(GibPackedTag *) arg_46_89_151; + GibCursor tail_199 = arg_46_89_151 + sizeof(GibInt); - switch_170: + switch_202: ; - switch (tag_166) { + switch (tag_198) { case 0: { - GibInt x_36_75_125 = ((GibIntProd *) tail_167)->field0; - GibPtr tailift_168 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_47_90_152 = ((GibIntProd *) tail_199)->field0; + GibPtr tailift_200 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_168)->field0 = 0; - ((GibIntGibIntProd *) tailift_168)->field1 = x_36_75_125; - return tailift_168; + ((GibIntGibIntProd *) tailift_200)->field0 = 0; + ((GibIntGibIntProd *) tailift_200)->field1 = x_47_90_152; + return tailift_200; break; } case 1: { - GibCursor x_38_77_127 = - ((GibCursorGibCursorProd *) tail_167)->field0; - GibCursor x_39_78_128 = - ((GibCursorGibCursorProd *) tail_167)->field1; - GibCursor y_40_79_129 = - _copy_without_ptrs_Add_Tree_10(x_38_77_127); - GibCursor y_41_80_130 = - _copy_without_ptrs_Add_Tree_10(x_39_78_128); - GibPtr tailift_169 = + GibCursor x_49_92_154 = + ((GibCursorGibCursorProd *) tail_199)->field0; + GibCursor x_50_93_155 = + ((GibCursorGibCursorProd *) tail_199)->field1; + GibCursor y_51_94_156 = + _copy_without_ptrs_AddTree_Tree_4(x_49_92_154); + GibCursor y_52_95_157 = + _copy_without_ptrs_AddTree_Tree_4(x_50_93_155); + GibPtr tailift_201 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_169)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_169)->field1 = - y_40_79_129; - ((GibIntGibCursorGibCursorProd *) tailift_169)->field2 = - y_41_80_130; - return tailift_169; + ((GibIntGibCursorGibCursorProd *) tailift_201)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_201)->field1 = + y_51_94_156; + ((GibIntGibCursorGibCursorProd *) tailift_201)->field2 = + y_52_95_157; + return tailift_201; break; } default: { - printf("%s\n", "Unknown tag in: tag_166"); + printf("%s\n", "Unknown tag in: tag_198"); exit(1); } } } -unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) { - GibPackedTag tag_171 = *(GibPackedTag *) arg_42_81_131; - GibCursor tail_172 = arg_42_81_131 + sizeof(GibInt); + GibPackedTag tag_203 = *(GibPackedTag *) arg_53_96_158; + GibCursor tail_204 = arg_53_96_158 + sizeof(GibInt); - switch_173: + switch_205: ; - switch (tag_171) { + switch (tag_203) { case 0: { - GibInt x_43_82_132 = ((GibIntProd *) tail_172)->field0; + GibInt x_54_97_159 = ((GibIntProd *) tail_204)->field0; return 0; break; @@ -2682,12 +3217,12 @@ unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) case 1: { - GibCursor x_45_83_133 = - ((GibCursorGibCursorProd *) tail_172)->field0; - GibCursor x_46_84_134 = - ((GibCursorGibCursorProd *) tail_172)->field1; - unsigned char y_47_85_135 = _traverse_Add_Tree_10(x_45_83_133); - unsigned char y_48_86_136 = _traverse_Add_Tree_10(x_46_84_134); + GibCursor x_56_98_160 = + ((GibCursorGibCursorProd *) tail_204)->field0; + GibCursor x_57_99_161 = + ((GibCursorGibCursorProd *) tail_204)->field1; + unsigned char y_58_100_162 = _traverse_AddTree_Tree_4(x_56_98_160); + unsigned char y_59_101_163 = _traverse_AddTree_Tree_4(x_57_99_161); return 0; break; @@ -2695,28 +3230,28 @@ unsigned char _traverse_Add_Tree_10(GibCursor arg_42_81_131) default: { - printf("%s\n", "Unknown tag in: tag_171"); + printf("%s\n", "Unknown tag in: tag_203"); exit(1); } } } -unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) +unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) { - GibPackedTag tag_174 = *(GibPackedTag *) arg_49_87_137; - GibCursor tail_175 = arg_49_87_137 + sizeof(GibInt); + GibPackedTag tag_206 = *(GibPackedTag *) arg_60_102_164; + GibCursor tail_207 = arg_60_102_164 + sizeof(GibInt); - switch_176: + switch_208: ; - switch (tag_174) { + switch (tag_206) { case 0: { - GibInt x_50_88_138 = ((GibIntProd *) tail_175)->field0; - unsigned char wildcard_52_89_139 = gib_print_symbol(154); - unsigned char wildcard_54_90_140 = gib_print_symbol(155); - unsigned char y_51_91_141 = printf("%ld", x_50_88_138); - unsigned char wildcard_53_92_142 = gib_print_symbol(152); + GibInt x_61_103_165 = ((GibIntProd *) tail_207)->field0; + unsigned char wildcard_63_104_166 = gib_print_symbol(181); + unsigned char wildcard_65_105_167 = gib_print_symbol(182); + unsigned char y_62_106_168 = printf("%ld", x_61_103_165); + unsigned char wildcard_64_107_169 = gib_print_symbol(179); return 0; break; @@ -2724,16 +3259,16 @@ unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) case 1: { - GibCursor x_55_93_143 = - ((GibCursorGibCursorProd *) tail_175)->field0; - GibCursor x_56_94_144 = - ((GibCursorGibCursorProd *) tail_175)->field1; - unsigned char wildcard_59_95_145 = gib_print_symbol(153); - unsigned char wildcard_62_96_146 = gib_print_symbol(155); - unsigned char y_57_97_147 = _print_Add_Tree_10(x_55_93_143); - unsigned char wildcard_61_98_148 = gib_print_symbol(155); - unsigned char y_58_99_149 = _print_Add_Tree_10(x_56_94_144); - unsigned char wildcard_60_100_150 = gib_print_symbol(152); + GibCursor x_66_108_170 = + ((GibCursorGibCursorProd *) tail_207)->field0; + GibCursor x_67_109_171 = + ((GibCursorGibCursorProd *) tail_207)->field1; + unsigned char wildcard_70_110_172 = gib_print_symbol(180); + unsigned char wildcard_73_111_173 = gib_print_symbol(182); + unsigned char y_68_112_174 = _print_AddTree_Tree_4(x_66_108_170); + unsigned char wildcard_72_113_175 = gib_print_symbol(182); + unsigned char y_69_114_176 = _print_AddTree_Tree_4(x_67_109_171); + unsigned char wildcard_71_115_177 = gib_print_symbol(179); return 0; break; @@ -2741,7 +3276,7 @@ unsigned char _print_Add_Tree_10(GibCursor arg_49_87_137) default: { - printf("%s\n", "Unknown tag in: tag_174"); + printf("%s\n", "Unknown tag in: tag_206"); exit(1); } } @@ -2753,25 +3288,26 @@ int main(int argc, char **argv) info_table_initialize(); symbol_table_initialize(); - GibPtr fltPkd_102_107 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_118_126 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_102_107)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_102_107)->field1 = 1; + ((GibIntGibIntProd *) fltPkd_118_126)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_118_126)->field1 = 1; - GibPtr fltPkd_103_108 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_119_127 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_103_108)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_103_108)->field1 = 2; + ((GibIntGibIntProd *) fltPkd_119_127)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_119_127)->field1 = 2; - GibPtr fltAppE_101_109 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + GibPtr fltAppE_117_128 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field1 = fltPkd_102_107; - ((GibIntGibCursorGibCursorProd *) fltAppE_101_109)->field2 = fltPkd_103_108; + ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field1 = fltPkd_118_126; + ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field2 = fltPkd_119_127; - GibCursor tmp_app_151 = Add_add1_11(fltAppE_101_109); + GibCursor fltAppE_116_129 = Addtwo_add_6(fltAppE_117_128); + GibCursor tmp_app_178 = Addone_add_5(fltAppE_116_129); - _print_Add_Tree_10(tmp_app_151); + _print_AddTree_Tree_4(tmp_app_178); printf("\n"); return 0; @@ -2783,10 +3319,25 @@ int main(int argc, char **argv) Compiling RTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 +make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +make: Nothing to be done for 'all'. + + + + +Compiling the program +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng + + + +In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] + #warning "Simple write barrier is disabled." + ^~~~~~~ -codegen: C RTS could not be compiled: -make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory -make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. -Code: 2 +(Node (Leaf 4) (Leaf 5)) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 51e0d13b4..e79c4d853 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -35,6 +35,8 @@ import Gibbon.L0.Syntax as L0 import Data.List as L import Prelude as P +import Gibbon.Passes.ModuleFillImports (fillImports) + -------------------------------------------------------------------------------- {- @@ -179,6 +181,11 @@ type TopTyEnv = TyEnv TyScheme type TypeSynEnv = M.Map TyCon Ty0 +-- ======================================================== + + +-- ======================================================== + desugarModule :: (Show a, Pretty a) => Config @@ -193,6 +200,9 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports -- single top-level declaration we first collect types and then collect -- definitions. funtys = foldr (collectTopTy type_syns) M.empty decls + dbgPrintLn 2 "================================================================================" + dbgPrintLn 2 $ "desugaring module: " ++ mod_name + dbgPrintLn 2 $ "- imports: " ++ (show import_names) imported_progs :: [PassM Prog0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports let prog = do @@ -280,11 +290,12 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports show (S.toList em2) ++ " found in " ++ mod_name) (defs', funs''') imported_progs' - pure (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + fillImports (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) mod_name = moduleName head_mb + import_names = (map (\(ImportDecl _ (ModuleName _ imp_name) _ _ _ _ _ _) -> imp_name) imports) coalese_constraints :: [(Var, M.Map DataCon [UserOrdering])] -> [(Var, M.Map DataCon [UserOrdering])] diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs new file mode 100644 index 000000000..ea60831ef --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -0,0 +1,190 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} + +-- | Unique names. + +module Gibbon.Passes.ModuleFillImports (fillImports) where + +import Control.Exception +import Data.Foldable ( foldrM ) +import Prelude hiding (exp) +import qualified Data.List as L +import qualified Data.Map as M + +import Gibbon.Common +import Gibbon.L0.Syntax +import qualified Gibbon.L1.Syntax as L1 + +-------------------------------------------------------------------------------- + +type VarEnv = M.Map Var (M.Map Var Var) +type TyVarEnv t = M.Map TyVar t + +fillImports :: Prog0 -> PassM Prog0 +fillImports (Prog defs funs main) = + do + -- defs + let defNameMap = M.fromList $ zip (M.keys defs) (M.keys defs) + let initDefEnv :: VarEnv = M.empty + let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap + let transformDefKey :: Var -> Var + transformDefKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name defenv + + -- funs + let funNameMap = M.fromList $ zip (M.keys funs) (M.keys funs) + let initFunEnv :: VarEnv = M.empty + let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap + let transformFunKey :: Var -> Var + transformFunKey k = do + let (mod, name) = parseOutMod k + resolveNameInEnv mod name funenv + + -- main + main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- resolveModInExp m defenv funenv + return $ Just (m',ty) + + defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs + funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs + + let defs'' = M.mapKeys transformDefKey defs' + let funs'' = M.mapKeys transformFunKey funs' + + return $ Prog defs'' funs'' main' + +resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) +resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = + do + let (mod, name) = parseOutMod tyName + let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons + pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' + +resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = + do + let nam' = parseAndResolve nam funenv + let funty' = resolveModsInTyScheme funty defenv + bod' <- resolveModInExp bod defenv funenv + pure $ FunDef nam' nargs funty' bod' meta + +resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme +resolveModsInTyScheme (ForAll tvs ty) defenv = do + let ty' = resolveModInTy ty defenv + ForAll tvs ty' + +resolveModsInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) +resolveModsInDataCons (con, tys) defenv funenv = + do + let tys' = map (\(boxed, ty) -> (boxed, (resolveModInTy ty defenv))) tys + (con, tys') + +resolveModInTy :: Ty0 -> VarEnv -> Ty0 +resolveModInTy ty defenv = + case ty of + IntTy -> ty + CharTy -> ty + FloatTy -> ty + SymTy0 -> ty + BoolTy -> ty + ArenaTy -> ty + SymSetTy -> ty + SymHashTy -> ty + MetaTv{} -> ty + TyVar tv -> ty + ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys + SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv + PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) + ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) $ resolveModInTy t defenv + + PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys + + VectorTy el_t -> VectorTy $ resolveModInTy el_t defenv + ListTy el_t -> ListTy $ resolveModInTy el_t defenv + IntHashTy -> ty + +resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> PassM Exp0 +resolveModInExp exp defenv funenv = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + --VarE v -> return $ VarE (varAppend (toVar "seen-") v) + VarE v -> return $ VarE v + + AppE v locs ls -> do + let (mod, fun) = parseOutMod v + let v' = resolveNameInEnv mod fun funenv + ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + return $ AppE v' locs ls + + PrimAppE p es -> return $ PrimAppE p es + + LetE (v,_locs,ty, e1) e2 -> do + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv + return $ LetE (v, [], ty, e1') e2' + + IfE e1 e2 e3 -> return $ IfE e1 e2 e3 + ProjE i e -> return $ ProjE i e + MkProdE es -> return $ MkProdE es + + CaseE e mp -> do + e' <- resolveModInExp e defenv funenv + mp' <- mapM (\(c,prs,ae) -> do + ae' <- resolveModInExp ae defenv funenv + return (c, prs, ae')) mp + return $ CaseE e' mp' + + DataConE loc c es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv) es + return $ DataConE loc c es' + + TimeIt e t b -> return $ TimeIt e t b + WithArenaE v e -> return $ WithArenaE v e + SpawnE v locs ls -> return $ SpawnE v locs ls + SyncE -> return $ SyncE + MapE v e -> return $ MapE v e + FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + Ext ext -> return $ Ext ext + + +-- environment interactions + +buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv env k v = do + let (mod, name) = parseOutMod k + let mod' = case mod of + Just m -> m + Nothing -> (toVar "") + case (M.lookup name env) of + Just m -> + if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + else ((M.insert name (M.insert mod' v m) env), v) + Nothing -> ((M.insert name (M.singleton mod' v) env), v) + +parseAndResolve :: Var -> VarEnv -> Var +parseAndResolve v env = do + let (mod, name) = parseOutMod v + resolveNameInEnv mod name env + +parseOutMod :: Var -> (Maybe Var, Var) +parseOutMod v = do + let str = (fromVar v) + case (L.elemIndices '.' str) of + [] -> (Nothing, v) + x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) + +resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var +resolveNameInEnv mod name e = + do case (M.lookup name e) of + Just modspace -> case mod of + Just m -> case (M.lookup m modspace) of + Just n -> n + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find " ++ (fromVar name) + Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 4c9688ec3..88abe2f2b 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -5,8 +5,6 @@ module Gibbon.Passes.ModuleRename (moduleRename) where -import Gibbon.Pretty - import Control.Exception import Data.Foldable ( foldrM ) import Prelude hiding (exp) @@ -122,7 +120,8 @@ resolveModInExp exp defenv funenv = AppE v locs ls -> do let (mod, fun) = parseOutMod v let v' = resolveNameInEnv mod fun funenv - return $ AppE v' locs ls + ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + return $ AppE v' locs ls' PrimAppE p es -> return $ PrimAppE p es From 27269e6b762c8122f64ee56340baacf21b37d6c1 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 22 Nov 2023 12:15:07 -0800 Subject: [PATCH 30/68] aliases work --- gibbon-compiler/examples/Addtwo.hs | 5 + gibbon-compiler/examples/addimport.hs | 6 +- gibbon-compiler/ir.log | 3711 +++++++++-------- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 21 +- .../src/Gibbon/Passes/ModuleFillImports.hs | 63 +- 5 files changed, 2001 insertions(+), 1805 deletions(-) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/Addtwo.hs index 82c6216e3..9056b48e1 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/Addtwo.hs @@ -6,5 +6,10 @@ module Addtwo where Leaf x -> Leaf (x + 2) Node x1 x2 -> Node (add x1) (add x2) + sub :: Tree -> Tree + sub t = case t of + Leaf x -> Leaf (x - 2) + Node x1 x2 -> Node (sub x1) (sub x2) + main :: Tree main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index baaa8d41a..6b0f947d0 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,6 +1,6 @@ module AddImport where - import Addone - import Addtwo + import Addone as On + import Addtwo as Tw import AddTree - gibbon_main = Addone.add (Addtwo.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = Tw.add (On.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index e8c6e79bf..156118cf7 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -6,24 +6,32 @@ desugaring module: AddImport - imports: ["Addone","Addtwo","AddTree"] +- aliases: fromList [(Var "Addone",Var "On"),(Var "Addtwo",Var "Tw"),(Var "AddTree",Var "AddTree")] + ================================================================================ desugaring module: Addone - imports: ["AddTree"] +- aliases: fromList [(Var "AddTree",Var "AddTree")] + ================================================================================ desugaring module: AddTree - imports: [] +- aliases: fromList [] + ================================================================================ desugaring module: Addtwo - imports: ["AddTree"] +- aliases: fromList [(Var "AddTree",Var "AddTree")] + [compiler] pipeline starting, parsed program: ================================================================================ Prog {ddefs = [(AddTree.Tree, @@ -74,14 +82,37 @@ Prog {ddefs = [(AddTree.Tree, "Node" [AppE "Addtwo.add" [] [VarE "x1"], AppE "Addtwo.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.sub, + FunDef {funName = "Addtwo.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addtwo.sub" [] [VarE "x1"], + AppE "Addtwo.sub" [] [VarE "x2"]])], funMeta = FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Addone.add" + mainExp = Just (AppE "Addtwo.add" [] - [AppE "Addtwo.add" + [AppE "Addone.add" [] [DataConE (MetaTv $0) "Node" @@ -112,8 +143,17 @@ Addtwo_add_6 t = Node x1::$4 x2::$5 -> (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 2) + Node x1::$10 x2::$11 -> + (Node $9 (Addtwo_sub_7 [] x1) (Addtwo_sub_7 [] x2)) + gibbon_main :: $3 -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, freshen Pass output: @@ -122,24 +162,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::$2 -> - (Leaf $1 x_8 + 1) - Node x1_9::$4 x2_10::$5 -> - (Node $3 (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::$2 -> + (Leaf $1 x_9 + 1) + Node x1_10::$4 x2_11::$5 -> + (Node $3 (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::$2 -> - (Leaf $1 x_12 + 2) - Node x1_13::$4 x2_14::$5 -> - (Node $3 (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::$2 -> + (Leaf $1 x_13 + 2) + Node x1_14::$4 x2_15::$5 -> + (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::$8 -> + (Leaf $7 x_17 - 2) + Node x1_18::$10 x2_19::$11 -> + (Node $9 (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: $3 -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, typecheck Pass output: @@ -148,24 +197,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, bindLambdas Pass output: @@ -174,24 +232,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, monomorphize Pass output: @@ -200,24 +267,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, specLambdas Pass output: @@ -226,24 +302,33 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::Int -> - (Leaf () x_8 + 1) - Node x1_9::(Packed AddTree_Tree_4 []) x2_10::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 + 1) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::Int -> - (Leaf () x_12 + 2) - Node x1_13::(Packed AddTree_Tree_4 []) x2_14::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 - 2) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, desugarL0 Pass output: @@ -252,78 +337,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::() -> - (Leaf () x_8 + 1) - Node x1_9::() x2_10::() -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 + 1) + Node x1_10::() x2_11::() -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::() -> - (Leaf () x_12 + 2) - Node x1_13::() x2_14::() -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 - 2) + Node x1_18::() x2_19::() -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40::() -> - let y_41 :: Int = x_40 in - (Leaf () y_41) - Node x_42::() x_43::() -> - let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in - (Node () y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47::() -> - let y_48 :: Int = x_47 in - (Leaf () y_48) - Node x_49::() x_50::() -> - let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node () y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54::() -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> () - Node x_56::() x_57::() -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61::() -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66::() x_67::() -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, floatOutCase Pass output: @@ -332,78 +426,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8::() -> - (Leaf () x_8 + 1) - Node x1_9::() x2_10::() -> - (Node () (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 + 1) + Node x1_10::() x2_11::() -> + (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12::() -> - (Leaf () x_12 + 2) - Node x1_13::() x2_14::() -> - (Node () (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 - 2) + Node x1_18::() x2_19::() -> + (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40::() -> - let y_41 :: Int = x_40 in - (Leaf () y_41) - Node x_42::() x_43::() -> - let y_44 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_43) in - (Node () y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47::() -> - let y_48 :: Int = x_47 in - (Leaf () y_48) - Node x_49::() x_50::() -> - let y_51 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node () y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54::() -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> () - Node x_56::() x_57::() -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61::() -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66::() x_67::() -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node () (Leaf () 1) (Leaf () 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, toL1 Pass output: @@ -412,78 +515,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: @@ -492,78 +604,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, benchMainExp Pass output: @@ -572,78 +693,87 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: @@ -652,159 +782,168 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7 = - case t_7 of - Leaf x_8 -> - (Leaf x_8 + 1) - Node x1_9 x2_10 -> - (Node (Addone_add_5 [] x1_9) (Addone_add_5 [] x2_10)) +Addone_add_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 + 1) + Node x1_10 x2_11 -> + (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11 = - case t_11 of - Leaf x_12 -> - (Leaf x_12 + 2) - Node x1_13 x2_14 -> - (Node (Addtwo_add_6 [] x1_13) (Addtwo_add_6 [] x2_14)) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 - 2) + Node x1_18 x2_19 -> + (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39 = - case arg_39 of - Leaf x_40 -> - let y_41 :: Int = x_40 in - (Leaf y_41) - Node x_42 x_43 -> - let y_44 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42) in - let y_45 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43) in - (Node y_44 y_45) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46 = - case arg_46 of - Leaf x_47 -> - let y_48 :: Int = x_47 in - (Leaf y_48) - Node x_49 x_50 -> - let y_51 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49) in - let y_52 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50) in - (Node y_51 y_52) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53 = - case arg_53 of - Leaf x_54 -> +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> () - Node x_56 x_57 -> - let y_58 :: () = (_traverse_AddTree_Tree_4 [] x_56) in - let y_59 :: () = (_traverse_AddTree_Tree_4 [] x_57) in + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60 = - case arg_60 of - Leaf x_61 -> - let wildcard_63 :: () = printsym("(Leaf") in - let wildcard_65 :: () = printsym(" ") in - let y_62 :: () = printint(x_61) in - let wildcard_64 :: () = printsym(")") in - () - Node x_66 x_67 -> - let wildcard_70 :: () = printsym("(Node") in - let wildcard_73 :: () = printsym(" ") in - let y_68 :: () = (_print_AddTree_Tree_4 [] x_66) in - let wildcard_72 :: () = printsym(" ") in - let y_69 :: () = (_print_AddTree_Tree_4 [] x_67) in - let wildcard_71 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, simplify -Removed unused functions: [] +Removed unused functions: [Var "Addtwo_sub_7"] Pass output: ================================================================================ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74 = - case t_7_74 of - Leaf x_8_75 -> - (Leaf x_8_75 + 1) - Node x1_9_76 x2_10_77 -> - (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) +Addone_add_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 + 1) + Node x1_10_89 x2_11_90 -> + (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78 = - case t_11_78 of - Leaf x_12_79 -> - (Leaf x_12_79 + 2) - Node x1_13_80 x2_14_81 -> - (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) +Addtwo_add_6 t_12_91 = + case t_12_91 of + Leaf x_13_92 -> + (Leaf x_13_92 + 2) + Node x1_14_93 x2_15_94 -> + (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82 = - case arg_39_82 of - Leaf x_40_83 -> - let y_41_84 :: Int = x_40_83 in - (Leaf y_41_84) - Node x_42_85 x_43_86 -> - let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in - let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in - (Node y_44_87 y_45_88) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = - case arg_46_89 of - Leaf x_47_90 -> - let y_48_91 :: Int = x_47_90 in - (Leaf y_48_91) - Node x_49_92 x_50_93 -> - let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in - let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in - (Node y_51_94 y_52_95) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96 = - case arg_53_96 of - Leaf x_54_97 -> +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> () - Node x_56_98 x_57_99 -> - let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in - let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102 = - case arg_60_102 of - Leaf x_61_103 -> - let wildcard_63_104 :: () = printsym("(Leaf") in - let wildcard_65_105 :: () = printsym(" ") in - let y_62_106 :: () = printint(x_61_103) in - let wildcard_64_107 :: () = printsym(")") in - () - Node x_66_108 x_67_109 -> - let wildcard_70_110 :: () = printsym("(Node") in - let wildcard_73_111 :: () = printsym(" ") in - let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in - let wildcard_72_113 :: () = printsym(" ") in - let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in - let wildcard_71_115 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: @@ -813,78 +952,78 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74 = - case t_7_74 of - Leaf x_8_75 -> - (Leaf x_8_75 + 1) - Node x1_9_76 x2_10_77 -> - (Node (Addone_add_5 [] x1_9_76) (Addone_add_5 [] x2_10_77)) +Addone_add_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 + 1) + Node x1_10_89 x2_11_90 -> + (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78 = - case t_11_78 of - Leaf x_12_79 -> - (Leaf x_12_79 + 2) - Node x1_13_80 x2_14_81 -> - (Node (Addtwo_add_6 [] x1_13_80) (Addtwo_add_6 [] x2_14_81)) +Addtwo_add_6 t_12_91 = + case t_12_91 of + Leaf x_13_92 -> + (Leaf x_13_92 + 2) + Node x1_14_93 x2_15_94 -> + (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82 = - case arg_39_82 of - Leaf x_40_83 -> - let y_41_84 :: Int = x_40_83 in - (Leaf y_41_84) - Node x_42_85 x_43_86 -> - let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in - let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in - (Node y_44_87 y_45_88) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = - case arg_46_89 of - Leaf x_47_90 -> - let y_48_91 :: Int = x_47_90 in - (Leaf y_48_91) - Node x_49_92 x_50_93 -> - let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in - let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in - (Node y_51_94 y_52_95) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96 = - case arg_53_96 of - Leaf x_54_97 -> +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> () - Node x_56_98 x_57_99 -> - let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in - let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102 = - case arg_60_102 of - Leaf x_61_103 -> - let wildcard_63_104 :: () = printsym("(Leaf") in - let wildcard_65_105 :: () = printsym(" ") in - let y_62_106 :: () = printint(x_61_103) in - let wildcard_64_107 :: () = printsym(")") in - () - Node x_66_108 x_67_109 -> - let wildcard_70_110 :: () = printsym("(Node") in - let wildcard_73_111 :: () = printsym(" ") in - let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in - let wildcard_72_113 :: () = printsym(" ") in - let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in - let wildcard_71_115 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_5 [] (Addtwo_add_6 [] (Node (Leaf 1) (Leaf 2)))) +gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, flatten Pass output: @@ -893,88 +1032,88 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74 = - case t_7_74 of - Leaf x_8_75 -> - let fltPkd_120 :: Int = x_8_75 + 1 in - (Leaf fltPkd_120) - Node x1_9_76 x2_10_77 -> - let fltPkd_121 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76) in - let fltPkd_122 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77) in - (Node fltPkd_121 fltPkd_122) +Addone_add_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + let fltPkd_137 :: Int = x_9_88 + 1 in + (Leaf fltPkd_137) + Node x1_10_89 x2_11_90 -> + let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89) in + let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90) in + (Node fltPkd_138 fltPkd_139) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78 = - case t_11_78 of - Leaf x_12_79 -> - let fltPkd_123 :: Int = x_12_79 + 2 in - (Leaf fltPkd_123) - Node x1_13_80 x2_14_81 -> - let fltPkd_124 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80) in - let fltPkd_125 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81) in - (Node fltPkd_124 fltPkd_125) +Addtwo_add_6 t_12_91 = + case t_12_91 of + Leaf x_13_92 -> + let fltPkd_140 :: Int = x_13_92 + 2 in + (Leaf fltPkd_140) + Node x1_14_93 x2_15_94 -> + let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93) in + let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94) in + (Node fltPkd_141 fltPkd_142) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82 = - case arg_39_82 of - Leaf x_40_83 -> - let y_41_84 :: Int = x_40_83 in - (Leaf y_41_84) - Node x_42_85 x_43_86 -> - let y_44_87 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85) in - let y_45_88 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86) in - (Node y_44_87 y_45_88) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89 = - case arg_46_89 of - Leaf x_47_90 -> - let y_48_91 :: Int = x_47_90 in - (Leaf y_48_91) - Node x_49_92 x_50_93 -> - let y_51_94 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92) in - let y_52_95 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93) in - (Node y_51_94 y_52_95) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96 = - case arg_53_96 of - Leaf x_54_97 -> +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> () - Node x_56_98 x_57_99 -> - let y_58_100 :: () = (_traverse_AddTree_Tree_4 [] x_56_98) in - let y_59_101 :: () = (_traverse_AddTree_Tree_4 [] x_57_99) in + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102 = - case arg_60_102 of - Leaf x_61_103 -> - let wildcard_63_104 :: () = printsym("(Leaf") in - let wildcard_65_105 :: () = printsym(" ") in - let y_62_106 :: () = printint(x_61_103) in - let wildcard_64_107 :: () = printsym(")") in - () - Node x_66_108 x_67_109 -> - let wildcard_70_110 :: () = printsym("(Node") in - let wildcard_73_111 :: () = printsym(" ") in - let y_68_112 :: () = (_print_AddTree_Tree_4 [] x_66_108) in - let wildcard_72_113 :: () = printsym(" ") in - let y_69_114 :: () = (_print_AddTree_Tree_4 [] x_67_109) in - let wildcard_71_115 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117 :: (Packed AddTree_Tree_4) = (Node fltPkd_118 fltPkd_119) in - let fltAppE_116 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117) in - (Addone_add_5 [] fltAppE_116) +gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in + let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134) in + (Addtwo_add_6 [] fltAppE_133) [compiler] Running pass, simplify Removed unused functions: [] @@ -984,88 +1123,88 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - let y_41_84_146 :: Int = x_40_83_145 in - (Leaf y_41_84_146) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + let y_54_101_163 :: Int = x_53_100_162 in + (Leaf y_54_101_163) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - let y_48_91_153 :: Int = x_47_90_152 in - (Leaf y_48_91_153) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + let y_61_108_170 :: Int = x_60_107_169 in + (Leaf y_61_108_170) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, inlineTriv Pass output: @@ -1074,86 +1213,86 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, typecheck Pass output: @@ -1162,86 +1301,86 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, typecheck Pass output: @@ -1250,86 +1389,86 @@ data AddTree_Tree_4 = Leaf Int | Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_119_127 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_117_128 :: (Packed AddTree_Tree_4) = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, directL3 Pass output: @@ -1338,86 +1477,86 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, L3.typecheck Pass output: @@ -1426,86 +1565,86 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - (Addone_add_5 [] fltAppE_116_129) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + (Addtwo_add_6 [] fltAppE_133_146) [compiler] Running pass, unariser Pass output: @@ -1514,87 +1653,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, L3.typecheck Pass output: @@ -1603,87 +1742,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, L3.flatten Pass output: @@ -1692,87 +1831,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, L3.typecheck Pass output: @@ -1781,87 +1920,87 @@ data AddTree_Tree_4 = Leaf Int | Node Cursor Cursor {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_7_74_130 = - case t_7_74_130 of - Leaf x_8_75_131 -> - let fltPkd_120_132 :: Int = x_8_75_131 + 1 in - (Leaf fltPkd_120_132) - Node x1_9_76_133 x2_10_77_134 -> - let fltPkd_121_135 :: Cursor = (Addone_add_5 [] x1_9_76_133) in - let fltPkd_122_136 :: Cursor = (Addone_add_5 [] x2_10_77_134) in - (Node fltPkd_121_135 fltPkd_122_136) +Addone_add_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 + 1 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_11_78_137 = - case t_11_78_137 of - Leaf x_12_79_138 -> - let fltPkd_123_139 :: Int = x_12_79_138 + 2 in - (Leaf fltPkd_123_139) - Node x1_13_80_140 x2_14_81_141 -> - let fltPkd_124_142 :: Cursor = (Addtwo_add_6 [] x1_13_80_140) in - let fltPkd_125_143 :: Cursor = (Addtwo_add_6 [] x2_14_81_141) in - (Node fltPkd_124_142 fltPkd_125_143) +Addtwo_add_6 t_12_91_154 = + case t_12_91_154 of + Leaf x_13_92_155 -> + let fltPkd_140_156 :: Int = x_13_92_155 + 2 in + (Leaf fltPkd_140_156) + Node x1_14_93_157 x2_15_94_158 -> + let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in + let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in + (Node fltPkd_141_159 fltPkd_142_160) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_39_82_144 = - case arg_39_82_144 of - Leaf x_40_83_145 -> - (Leaf x_40_83_145) - Node x_42_85_147 x_43_86_148 -> - let y_44_87_149 :: Cursor = (_copy_AddTree_Tree_4 [] x_42_85_147) in - let y_45_88_150 :: Cursor = (_copy_AddTree_Tree_4 [] x_43_86_148) in - (Node y_44_87_149 y_45_88_150) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_46_89_151 = - case arg_46_89_151 of - Leaf x_47_90_152 -> - (Leaf x_47_90_152) - Node x_49_92_154 x_50_93_155 -> - let y_51_94_156 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_49_92_154) in - let y_52_95_157 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_50_93_155) in - (Node y_51_94_156 y_52_95_157) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_53_96_158 = - case arg_53_96_158 of - Leaf x_54_97_159 -> +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> () - Node x_56_98_160 x_57_99_161 -> - let y_58_100_162 :: () = (_traverse_AddTree_Tree_4 [] x_56_98_160) in - let y_59_101_163 :: () = (_traverse_AddTree_Tree_4 [] x_57_99_161) in + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in () {meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} _print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_60_102_164 = - case arg_60_102_164 of - Leaf x_61_103_165 -> - let wildcard_63_104_166 :: () = printsym("(Leaf") in - let wildcard_65_105_167 :: () = printsym(" ") in - let y_62_106_168 :: () = printint(x_61_103_165) in - let wildcard_64_107_169 :: () = printsym(")") in - () - Node x_66_108_170 x_67_109_171 -> - let wildcard_70_110_172 :: () = printsym("(Node") in - let wildcard_73_111_173 :: () = printsym(" ") in - let y_68_112_174 :: () = (_print_AddTree_Tree_4 [] x_66_108_170) in - let wildcard_72_113_175 :: () = printsym(" ") in - let y_69_114_176 :: () = (_print_AddTree_Tree_4 [] x_67_109_171) in - let wildcard_71_115_177 :: () = printsym(")") in +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in () gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_118_126 :: Cursor = (Leaf 1) in - let fltPkd_119_127 :: Cursor = (Leaf 2) in - let fltAppE_117_128 :: Cursor = (Node fltPkd_118_126 fltPkd_119_127) in - let fltAppE_116_129 :: Cursor = (Addtwo_add_6 [] fltAppE_117_128) in - let tmp_app_178 :: Cursor = (Addone_add_5 [] fltAppE_116_129) in - tmp_app_178 +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in + tmp_app_195 [compiler] Running pass, lower Pass output: @@ -1881,323 +2020,323 @@ Prog {infoTable = [("AddTree_Tree_4", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), - (182, " ")], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_7_74_130, CursorTy)], + funArgs = [(t_8_87_147, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), - (tail_184, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_7_74_130"], - bod = Switch "switch_187" - (VarTriv "tag_183") + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") (IntAlts [(0, - LetUnpackT {binds = [(x_8_75_131, + LetUnpackT {binds = [(x_9_88_148, IntTy)], - ptr = "tail_184", - bod = LetPrimCallT {binds = [(fltPkd_120_132, + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, IntTy)], prim = AddP, - rands = [VarTriv "x_8_75_131", + rands = [VarTriv "x_9_88_148", IntTriv 1], - bod = LetAllocT {lhs = "tailift_185", + bod = LetAllocT {lhs = "tailift_202", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_120_132")], - bod = RetValsT [VarTriv "tailift_185"]}}}), + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), (1, - LetUnpackT {binds = [(x1_9_76_133, + LetUnpackT {binds = [(x1_10_89_150, CursorTy), - (x2_10_77_134, + (x2_11_90_151, CursorTy)], - ptr = "tail_184", + ptr = "tail_201", bod = LetCallT {async = False, - binds = [(fltPkd_121_135, + binds = [(fltPkd_138_152, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x1_9_76_133"], + rands = [VarTriv "x1_10_89_150"], bod = LetCallT {async = False, - binds = [(fltPkd_122_136, + binds = [(fltPkd_139_153, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x2_10_77_134"], - bod = LetAllocT {lhs = "tailift_186", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_121_135"), + VarTriv "fltPkd_138_152"), (CursorTy, - VarTriv "fltPkd_122_136")], - bod = RetValsT [VarTriv "tailift_186"]}}}})]) - (Just ErrT "Unknown tag in: tag_183")}, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, isPure = True}, FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_11_78_137, CursorTy)], + funArgs = [(t_12_91_154, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), - (tail_189, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_11_78_137"], - bod = Switch "switch_192" - (VarTriv "tag_188") + rands = [VarTriv "t_12_91_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") (IntAlts [(0, - LetUnpackT {binds = [(x_12_79_138, + LetUnpackT {binds = [(x_13_92_155, IntTy)], - ptr = "tail_189", - bod = LetPrimCallT {binds = [(fltPkd_123_139, + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, IntTy)], prim = AddP, - rands = [VarTriv "x_12_79_138", + rands = [VarTriv "x_13_92_155", IntTriv 2], - bod = LetAllocT {lhs = "tailift_190", + bod = LetAllocT {lhs = "tailift_207", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_123_139")], - bod = RetValsT [VarTriv "tailift_190"]}}}), + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), (1, - LetUnpackT {binds = [(x1_13_80_140, + LetUnpackT {binds = [(x1_14_93_157, CursorTy), - (x2_14_81_141, + (x2_15_94_158, CursorTy)], - ptr = "tail_189", + ptr = "tail_206", bod = LetCallT {async = False, - binds = [(fltPkd_124_142, + binds = [(fltPkd_141_159, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x1_13_80_140"], + rands = [VarTriv "x1_14_93_157"], bod = LetCallT {async = False, - binds = [(fltPkd_125_143, + binds = [(fltPkd_142_160, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x2_14_81_141"], - bod = LetAllocT {lhs = "tailift_191", + rands = [VarTriv "x2_15_94_158"], + bod = LetAllocT {lhs = "tailift_208", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_124_142"), + VarTriv "fltPkd_141_159"), (CursorTy, - VarTriv "fltPkd_125_143")], - bod = RetValsT [VarTriv "tailift_191"]}}}})]) - (Just ErrT "Unknown tag in: tag_188")}, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, isPure = True}, FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_39_82_144, CursorTy)], + funArgs = [(arg_52_99_161, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), - (tail_194, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_39_82_144"], - bod = Switch "switch_197" - (VarTriv "tag_193") + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") (IntAlts [(0, - LetUnpackT {binds = [(x_40_83_145, + LetUnpackT {binds = [(x_53_100_162, IntTy)], - ptr = "tail_194", - bod = LetAllocT {lhs = "tailift_195", + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_40_83_145")], - bod = RetValsT [VarTriv "tailift_195"]}}), + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), (1, - LetUnpackT {binds = [(x_42_85_147, + LetUnpackT {binds = [(x_55_102_164, CursorTy), - (x_43_86_148, + (x_56_103_165, CursorTy)], - ptr = "tail_194", + ptr = "tail_211", bod = LetCallT {async = False, - binds = [(y_44_87_149, + binds = [(y_57_104_166, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_42_85_147"], + rands = [VarTriv "x_55_102_164"], bod = LetCallT {async = False, - binds = [(y_45_88_150, + binds = [(y_58_105_167, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_43_86_148"], - bod = LetAllocT {lhs = "tailift_196", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_44_87_149"), + VarTriv "y_57_104_166"), (CursorTy, - VarTriv "y_45_88_150")], - bod = RetValsT [VarTriv "tailift_196"]}}}})]) - (Just ErrT "Unknown tag in: tag_193")}, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, isPure = True}, FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_46_89_151, CursorTy)], + funArgs = [(arg_59_106_168, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), - (tail_199, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_46_89_151"], - bod = Switch "switch_202" - (VarTriv "tag_198") + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") (IntAlts [(0, - LetUnpackT {binds = [(x_47_90_152, + LetUnpackT {binds = [(x_60_107_169, IntTy)], - ptr = "tail_199", - bod = LetAllocT {lhs = "tailift_200", + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_47_90_152")], - bod = RetValsT [VarTriv "tailift_200"]}}), + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), (1, - LetUnpackT {binds = [(x_49_92_154, + LetUnpackT {binds = [(x_62_109_171, CursorTy), - (x_50_93_155, + (x_63_110_172, CursorTy)], - ptr = "tail_199", + ptr = "tail_216", bod = LetCallT {async = False, - binds = [(y_51_94_156, + binds = [(y_64_111_173, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_49_92_154"], + rands = [VarTriv "x_62_109_171"], bod = LetCallT {async = False, - binds = [(y_52_95_157, + binds = [(y_65_112_174, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_50_93_155"], - bod = LetAllocT {lhs = "tailift_201", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_51_94_156"), + VarTriv "y_64_111_173"), (CursorTy, - VarTriv "y_52_95_157")], - bod = RetValsT [VarTriv "tailift_201"]}}}})]) - (Just ErrT "Unknown tag in: tag_198")}, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, isPure = True}, FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_53_96_158, CursorTy)], + funArgs = [(arg_66_113_175, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), - (tail_204, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_53_96_158"], - bod = Switch "switch_205" - (VarTriv "tag_203") + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") (IntAlts [(0, - LetUnpackT {binds = [(x_54_97_159, + LetUnpackT {binds = [(x_67_114_176, IntTy)], - ptr = "tail_204", + ptr = "tail_221", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_56_98_160, + LetUnpackT {binds = [(x_69_115_177, CursorTy), - (x_57_99_161, + (x_70_116_178, CursorTy)], - ptr = "tail_204", + ptr = "tail_221", bod = LetCallT {async = False, - binds = [(y_58_100_162, + binds = [(y_71_117_179, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_56_98_160"], + rands = [VarTriv "x_69_115_177"], bod = LetCallT {async = False, - binds = [(y_59_101_163, + binds = [(y_72_118_180, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_57_99_161"], + rands = [VarTriv "x_70_116_178"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_203")}, + (Just ErrT "Unknown tag in: tag_220")}, isPure = True}, FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_60_102_164, CursorTy)], + funArgs = [(arg_73_119_181, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), - (tail_207, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_60_102_164"], - bod = Switch "switch_208" - (VarTriv "tag_206") + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") (IntAlts [(0, - LetUnpackT {binds = [(x_61_103_165, + LetUnpackT {binds = [(x_74_120_182, IntTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_63_104_166, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, ProdTy [])], prim = PrintSym, - rands = [SymTriv 181], - bod = LetPrimCallT {binds = [(wildcard_65_105_167, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], - bod = LetPrimCallT {binds = [(y_62_106_168, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_61_103_165"], - bod = LetPrimCallT {binds = [(wildcard_64_107_169, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_66_108_170, + LetUnpackT {binds = [(x_79_125_187, CursorTy), - (x_67_109_171, + (x_80_126_188, CursorTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_70_110_172, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, ProdTy [])], prim = PrintSym, - rands = [SymTriv 180], - bod = LetPrimCallT {binds = [(wildcard_73_111_173, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_68_112_174, + binds = [(y_81_129_191, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_66_108_170"], - bod = LetPrimCallT {binds = [(wildcard_72_113_175, + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_69_114_176, + binds = [(y_82_131_193, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_67_109_171"], - bod = LetPrimCallT {binds = [(wildcard_71_115_177, + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_206")}, + (Just ErrT "Unknown tag in: tag_223")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_118_126", + {lhs = "fltPkd_135_143", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_119_127", + bod = LetAllocT {lhs = "fltPkd_136_144", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_117_128", + bod = LetAllocT {lhs = "fltAppE_134_145", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_118_126"), + VarTriv "fltPkd_135_143"), (CursorTy, - VarTriv "fltPkd_119_127")], + VarTriv "fltPkd_136_144")], bod = LetCallT {async = False, - binds = [(fltAppE_116_129, + binds = [(fltAppE_133_146, CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_117_128"], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_134_145"], bod = LetCallT {async = False, - binds = [(tmp_app_178, + binds = [(tmp_app_195, CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_116_129"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_133_146"], bod = LetCallT {async = False, binds = [], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_178"], + rands = [VarTriv "tmp_app_195"], bod = LetPrimCallT {binds = [], prim = PrintString "\n", rands = [], @@ -2221,323 +2360,323 @@ Prog {infoTable = [("AddTree_Tree_4", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), - (182, " ")], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_7_74_130, CursorTy)], + funArgs = [(t_8_87_147, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), - (tail_184, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_7_74_130"], - bod = Switch "switch_187" - (VarTriv "tag_183") + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") (IntAlts [(0, - LetUnpackT {binds = [(x_8_75_131, + LetUnpackT {binds = [(x_9_88_148, IntTy)], - ptr = "tail_184", - bod = LetPrimCallT {binds = [(fltPkd_120_132, + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, IntTy)], prim = AddP, - rands = [VarTriv "x_8_75_131", + rands = [VarTriv "x_9_88_148", IntTriv 1], - bod = LetAllocT {lhs = "tailift_185", + bod = LetAllocT {lhs = "tailift_202", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_120_132")], - bod = RetValsT [VarTriv "tailift_185"]}}}), + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), (1, - LetUnpackT {binds = [(x1_9_76_133, + LetUnpackT {binds = [(x1_10_89_150, CursorTy), - (x2_10_77_134, + (x2_11_90_151, CursorTy)], - ptr = "tail_184", + ptr = "tail_201", bod = LetCallT {async = False, - binds = [(fltPkd_121_135, + binds = [(fltPkd_138_152, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x1_9_76_133"], + rands = [VarTriv "x1_10_89_150"], bod = LetCallT {async = False, - binds = [(fltPkd_122_136, + binds = [(fltPkd_139_153, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x2_10_77_134"], - bod = LetAllocT {lhs = "tailift_186", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_121_135"), + VarTriv "fltPkd_138_152"), (CursorTy, - VarTriv "fltPkd_122_136")], - bod = RetValsT [VarTriv "tailift_186"]}}}})]) - (Just ErrT "Unknown tag in: tag_183")}, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, isPure = True}, FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_11_78_137, CursorTy)], + funArgs = [(t_12_91_154, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), - (tail_189, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_11_78_137"], - bod = Switch "switch_192" - (VarTriv "tag_188") + rands = [VarTriv "t_12_91_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") (IntAlts [(0, - LetUnpackT {binds = [(x_12_79_138, + LetUnpackT {binds = [(x_13_92_155, IntTy)], - ptr = "tail_189", - bod = LetPrimCallT {binds = [(fltPkd_123_139, + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, IntTy)], prim = AddP, - rands = [VarTriv "x_12_79_138", + rands = [VarTriv "x_13_92_155", IntTriv 2], - bod = LetAllocT {lhs = "tailift_190", + bod = LetAllocT {lhs = "tailift_207", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_123_139")], - bod = RetValsT [VarTriv "tailift_190"]}}}), + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), (1, - LetUnpackT {binds = [(x1_13_80_140, + LetUnpackT {binds = [(x1_14_93_157, CursorTy), - (x2_14_81_141, + (x2_15_94_158, CursorTy)], - ptr = "tail_189", + ptr = "tail_206", bod = LetCallT {async = False, - binds = [(fltPkd_124_142, + binds = [(fltPkd_141_159, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x1_13_80_140"], + rands = [VarTriv "x1_14_93_157"], bod = LetCallT {async = False, - binds = [(fltPkd_125_143, + binds = [(fltPkd_142_160, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x2_14_81_141"], - bod = LetAllocT {lhs = "tailift_191", + rands = [VarTriv "x2_15_94_158"], + bod = LetAllocT {lhs = "tailift_208", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_124_142"), + VarTriv "fltPkd_141_159"), (CursorTy, - VarTriv "fltPkd_125_143")], - bod = RetValsT [VarTriv "tailift_191"]}}}})]) - (Just ErrT "Unknown tag in: tag_188")}, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, isPure = True}, FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_39_82_144, CursorTy)], + funArgs = [(arg_52_99_161, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), - (tail_194, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_39_82_144"], - bod = Switch "switch_197" - (VarTriv "tag_193") + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") (IntAlts [(0, - LetUnpackT {binds = [(x_40_83_145, + LetUnpackT {binds = [(x_53_100_162, IntTy)], - ptr = "tail_194", - bod = LetAllocT {lhs = "tailift_195", + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_40_83_145")], - bod = RetValsT [VarTriv "tailift_195"]}}), + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), (1, - LetUnpackT {binds = [(x_42_85_147, + LetUnpackT {binds = [(x_55_102_164, CursorTy), - (x_43_86_148, + (x_56_103_165, CursorTy)], - ptr = "tail_194", + ptr = "tail_211", bod = LetCallT {async = False, - binds = [(y_44_87_149, + binds = [(y_57_104_166, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_42_85_147"], + rands = [VarTriv "x_55_102_164"], bod = LetCallT {async = False, - binds = [(y_45_88_150, + binds = [(y_58_105_167, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_43_86_148"], - bod = LetAllocT {lhs = "tailift_196", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_44_87_149"), + VarTriv "y_57_104_166"), (CursorTy, - VarTriv "y_45_88_150")], - bod = RetValsT [VarTriv "tailift_196"]}}}})]) - (Just ErrT "Unknown tag in: tag_193")}, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, isPure = True}, FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_46_89_151, CursorTy)], + funArgs = [(arg_59_106_168, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), - (tail_199, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_46_89_151"], - bod = Switch "switch_202" - (VarTriv "tag_198") + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") (IntAlts [(0, - LetUnpackT {binds = [(x_47_90_152, + LetUnpackT {binds = [(x_60_107_169, IntTy)], - ptr = "tail_199", - bod = LetAllocT {lhs = "tailift_200", + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_47_90_152")], - bod = RetValsT [VarTriv "tailift_200"]}}), + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), (1, - LetUnpackT {binds = [(x_49_92_154, + LetUnpackT {binds = [(x_62_109_171, CursorTy), - (x_50_93_155, + (x_63_110_172, CursorTy)], - ptr = "tail_199", + ptr = "tail_216", bod = LetCallT {async = False, - binds = [(y_51_94_156, + binds = [(y_64_111_173, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_49_92_154"], + rands = [VarTriv "x_62_109_171"], bod = LetCallT {async = False, - binds = [(y_52_95_157, + binds = [(y_65_112_174, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_50_93_155"], - bod = LetAllocT {lhs = "tailift_201", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_51_94_156"), + VarTriv "y_64_111_173"), (CursorTy, - VarTriv "y_52_95_157")], - bod = RetValsT [VarTriv "tailift_201"]}}}})]) - (Just ErrT "Unknown tag in: tag_198")}, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, isPure = True}, FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_53_96_158, CursorTy)], + funArgs = [(arg_66_113_175, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), - (tail_204, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_53_96_158"], - bod = Switch "switch_205" - (VarTriv "tag_203") + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") (IntAlts [(0, - LetUnpackT {binds = [(x_54_97_159, + LetUnpackT {binds = [(x_67_114_176, IntTy)], - ptr = "tail_204", + ptr = "tail_221", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_56_98_160, + LetUnpackT {binds = [(x_69_115_177, CursorTy), - (x_57_99_161, + (x_70_116_178, CursorTy)], - ptr = "tail_204", + ptr = "tail_221", bod = LetCallT {async = False, - binds = [(y_58_100_162, + binds = [(y_71_117_179, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_56_98_160"], + rands = [VarTriv "x_69_115_177"], bod = LetCallT {async = False, - binds = [(y_59_101_163, + binds = [(y_72_118_180, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_57_99_161"], + rands = [VarTriv "x_70_116_178"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_203")}, + (Just ErrT "Unknown tag in: tag_220")}, isPure = True}, FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_60_102_164, CursorTy)], + funArgs = [(arg_73_119_181, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), - (tail_207, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_60_102_164"], - bod = Switch "switch_208" - (VarTriv "tag_206") + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") (IntAlts [(0, - LetUnpackT {binds = [(x_61_103_165, + LetUnpackT {binds = [(x_74_120_182, IntTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_63_104_166, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, ProdTy [])], prim = PrintSym, - rands = [SymTriv 181], - bod = LetPrimCallT {binds = [(wildcard_65_105_167, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], - bod = LetPrimCallT {binds = [(y_62_106_168, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_61_103_165"], - bod = LetPrimCallT {binds = [(wildcard_64_107_169, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_66_108_170, + LetUnpackT {binds = [(x_79_125_187, CursorTy), - (x_67_109_171, + (x_80_126_188, CursorTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_70_110_172, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, ProdTy [])], prim = PrintSym, - rands = [SymTriv 180], - bod = LetPrimCallT {binds = [(wildcard_73_111_173, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_68_112_174, + binds = [(y_81_129_191, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_66_108_170"], - bod = LetPrimCallT {binds = [(wildcard_72_113_175, + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_69_114_176, + binds = [(y_82_131_193, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_67_109_171"], - bod = LetPrimCallT {binds = [(wildcard_71_115_177, + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_206")}, + (Just ErrT "Unknown tag in: tag_223")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_118_126", + {lhs = "fltPkd_135_143", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_119_127", + bod = LetAllocT {lhs = "fltPkd_136_144", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_117_128", + bod = LetAllocT {lhs = "fltAppE_134_145", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_118_126"), + VarTriv "fltPkd_135_143"), (CursorTy, - VarTriv "fltPkd_119_127")], + VarTriv "fltPkd_136_144")], bod = LetCallT {async = False, - binds = [(fltAppE_116_129, + binds = [(fltAppE_133_146, CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_117_128"], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_134_145"], bod = LetCallT {async = False, - binds = [(tmp_app_178, + binds = [(tmp_app_195, CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_116_129"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_133_146"], bod = LetCallT {async = False, binds = [], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_178"], + rands = [VarTriv "tmp_app_195"], bod = LetPrimCallT {binds = [], prim = PrintString "\n", rands = [], @@ -2561,329 +2700,329 @@ Prog {infoTable = [("AddTree_Tree_4", num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(179, ")"),(180, "(Node"),(181, "(Leaf"), - (182, " ")], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_7_74_130, CursorTy)], + funArgs = [(t_8_87_147, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_183, TagTyPacked), - (tail_184, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_7_74_130"], - bod = Switch "switch_187" - (VarTriv "tag_183") + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") (IntAlts [(0, - LetUnpackT {binds = [(x_8_75_131, + LetUnpackT {binds = [(x_9_88_148, IntTy)], - ptr = "tail_184", - bod = LetPrimCallT {binds = [(fltPkd_120_132, + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, IntTy)], prim = AddP, - rands = [VarTriv "x_8_75_131", + rands = [VarTriv "x_9_88_148", IntTriv 1], - bod = LetAllocT {lhs = "tailift_185", + bod = LetAllocT {lhs = "tailift_202", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_120_132")], - bod = RetValsT [VarTriv "tailift_185"]}}}), + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), (1, - LetUnpackT {binds = [(x1_9_76_133, + LetUnpackT {binds = [(x1_10_89_150, CursorTy), - (x2_10_77_134, + (x2_11_90_151, CursorTy)], - ptr = "tail_184", + ptr = "tail_201", bod = LetCallT {async = False, - binds = [(fltPkd_121_135, + binds = [(fltPkd_138_152, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x1_9_76_133"], + rands = [VarTriv "x1_10_89_150"], bod = LetCallT {async = False, - binds = [(fltPkd_122_136, + binds = [(fltPkd_139_153, CursorTy)], rator = "Addone_add_5", - rands = [VarTriv "x2_10_77_134"], - bod = LetAllocT {lhs = "tailift_186", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_121_135"), + VarTriv "fltPkd_138_152"), (CursorTy, - VarTriv "fltPkd_122_136")], - bod = RetValsT [VarTriv "tailift_186"]}}}})]) - (Just ErrT "Unknown tag in: tag_183")}, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, isPure = True}, FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_11_78_137, CursorTy)], + funArgs = [(t_12_91_154, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_188, TagTyPacked), - (tail_189, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_11_78_137"], - bod = Switch "switch_192" - (VarTriv "tag_188") + rands = [VarTriv "t_12_91_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") (IntAlts [(0, - LetUnpackT {binds = [(x_12_79_138, + LetUnpackT {binds = [(x_13_92_155, IntTy)], - ptr = "tail_189", - bod = LetPrimCallT {binds = [(fltPkd_123_139, + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, IntTy)], prim = AddP, - rands = [VarTriv "x_12_79_138", + rands = [VarTriv "x_13_92_155", IntTriv 2], - bod = LetAllocT {lhs = "tailift_190", + bod = LetAllocT {lhs = "tailift_207", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "fltPkd_123_139")], - bod = RetValsT [VarTriv "tailift_190"]}}}), + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), (1, - LetUnpackT {binds = [(x1_13_80_140, + LetUnpackT {binds = [(x1_14_93_157, CursorTy), - (x2_14_81_141, + (x2_15_94_158, CursorTy)], - ptr = "tail_189", + ptr = "tail_206", bod = LetCallT {async = False, - binds = [(fltPkd_124_142, + binds = [(fltPkd_141_159, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x1_13_80_140"], + rands = [VarTriv "x1_14_93_157"], bod = LetCallT {async = False, - binds = [(fltPkd_125_143, + binds = [(fltPkd_142_160, CursorTy)], rator = "Addtwo_add_6", - rands = [VarTriv "x2_14_81_141"], - bod = LetAllocT {lhs = "tailift_191", + rands = [VarTriv "x2_15_94_158"], + bod = LetAllocT {lhs = "tailift_208", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_124_142"), + VarTriv "fltPkd_141_159"), (CursorTy, - VarTriv "fltPkd_125_143")], - bod = RetValsT [VarTriv "tailift_191"]}}}})]) - (Just ErrT "Unknown tag in: tag_188")}, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, isPure = True}, FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_39_82_144, CursorTy)], + funArgs = [(arg_52_99_161, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_193, TagTyPacked), - (tail_194, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_39_82_144"], - bod = Switch "switch_197" - (VarTriv "tag_193") + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") (IntAlts [(0, - LetUnpackT {binds = [(x_40_83_145, + LetUnpackT {binds = [(x_53_100_162, IntTy)], - ptr = "tail_194", - bod = LetAllocT {lhs = "tailift_195", + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_40_83_145")], - bod = RetValsT [VarTriv "tailift_195"]}}), + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), (1, - LetUnpackT {binds = [(x_42_85_147, + LetUnpackT {binds = [(x_55_102_164, CursorTy), - (x_43_86_148, + (x_56_103_165, CursorTy)], - ptr = "tail_194", + ptr = "tail_211", bod = LetCallT {async = False, - binds = [(y_44_87_149, + binds = [(y_57_104_166, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_42_85_147"], + rands = [VarTriv "x_55_102_164"], bod = LetCallT {async = False, - binds = [(y_45_88_150, + binds = [(y_58_105_167, CursorTy)], rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_43_86_148"], - bod = LetAllocT {lhs = "tailift_196", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_44_87_149"), + VarTriv "y_57_104_166"), (CursorTy, - VarTriv "y_45_88_150")], - bod = RetValsT [VarTriv "tailift_196"]}}}})]) - (Just ErrT "Unknown tag in: tag_193")}, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, isPure = True}, FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_46_89_151, CursorTy)], + funArgs = [(arg_59_106_168, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_198, TagTyPacked), - (tail_199, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_46_89_151"], - bod = Switch "switch_202" - (VarTriv "tag_198") + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") (IntAlts [(0, - LetUnpackT {binds = [(x_47_90_152, + LetUnpackT {binds = [(x_60_107_169, IntTy)], - ptr = "tail_199", - bod = LetAllocT {lhs = "tailift_200", + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_47_90_152")], - bod = RetValsT [VarTriv "tailift_200"]}}), + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), (1, - LetUnpackT {binds = [(x_49_92_154, + LetUnpackT {binds = [(x_62_109_171, CursorTy), - (x_50_93_155, + (x_63_110_172, CursorTy)], - ptr = "tail_199", + ptr = "tail_216", bod = LetCallT {async = False, - binds = [(y_51_94_156, + binds = [(y_64_111_173, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_49_92_154"], + rands = [VarTriv "x_62_109_171"], bod = LetCallT {async = False, - binds = [(y_52_95_157, + binds = [(y_65_112_174, CursorTy)], rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_50_93_155"], - bod = LetAllocT {lhs = "tailift_201", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_51_94_156"), + VarTriv "y_64_111_173"), (CursorTy, - VarTriv "y_52_95_157")], - bod = RetValsT [VarTriv "tailift_201"]}}}})]) - (Just ErrT "Unknown tag in: tag_198")}, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, isPure = True}, FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_53_96_158, CursorTy)], + funArgs = [(arg_66_113_175, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_203, TagTyPacked), - (tail_204, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_53_96_158"], - bod = Switch "switch_205" - (VarTriv "tag_203") + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") (IntAlts [(0, - LetUnpackT {binds = [(x_54_97_159, + LetUnpackT {binds = [(x_67_114_176, IntTy)], - ptr = "tail_204", + ptr = "tail_221", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_56_98_160, + LetUnpackT {binds = [(x_69_115_177, CursorTy), - (x_57_99_161, + (x_70_116_178, CursorTy)], - ptr = "tail_204", + ptr = "tail_221", bod = LetCallT {async = False, - binds = [(y_58_100_162, + binds = [(y_71_117_179, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_56_98_160"], + rands = [VarTriv "x_69_115_177"], bod = LetCallT {async = False, - binds = [(y_59_101_163, + binds = [(y_72_118_180, ProdTy [])], rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_57_99_161"], + rands = [VarTriv "x_70_116_178"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_203")}, + (Just ErrT "Unknown tag in: tag_220")}, isPure = True}, FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_60_102_164, CursorTy)], + funArgs = [(arg_73_119_181, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_206, TagTyPacked), - (tail_207, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_60_102_164"], - bod = Switch "switch_208" - (VarTriv "tag_206") + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") (IntAlts [(0, - LetUnpackT {binds = [(x_61_103_165, + LetUnpackT {binds = [(x_74_120_182, IntTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_63_104_166, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, ProdTy [])], prim = PrintSym, - rands = [SymTriv 181], - bod = LetPrimCallT {binds = [(wildcard_65_105_167, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], - bod = LetPrimCallT {binds = [(y_62_106_168, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_61_103_165"], - bod = LetPrimCallT {binds = [(wildcard_64_107_169, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_66_108_170, + LetUnpackT {binds = [(x_79_125_187, CursorTy), - (x_67_109_171, + (x_80_126_188, CursorTy)], - ptr = "tail_207", - bod = LetPrimCallT {binds = [(wildcard_70_110_172, + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, ProdTy [])], prim = PrintSym, - rands = [SymTriv 180], - bod = LetPrimCallT {binds = [(wildcard_73_111_173, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_68_112_174, + binds = [(y_81_129_191, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_66_108_170"], - bod = LetPrimCallT {binds = [(wildcard_72_113_175, + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, ProdTy [])], prim = PrintSym, - rands = [SymTriv 182], + rands = [SymTriv 199], bod = LetCallT {async = False, - binds = [(y_69_114_176, + binds = [(y_82_131_193, ProdTy [])], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_67_109_171"], - bod = LetPrimCallT {binds = [(wildcard_71_115_177, + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, ProdTy [])], prim = PrintSym, - rands = [SymTriv 179], + rands = [SymTriv 196], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_206")}, + (Just ErrT "Unknown tag in: tag_223")}, isPure = True}], mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_118_126", + {lhs = "fltPkd_135_143", vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_119_127", + bod = LetAllocT {lhs = "fltPkd_136_144", vals = [(IntTy, IntTriv 0), (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_117_128", + bod = LetAllocT {lhs = "fltAppE_134_145", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "fltPkd_118_126"), + VarTriv "fltPkd_135_143"), (CursorTy, - VarTriv "fltPkd_119_127")], + VarTriv "fltPkd_136_144")], bod = LetCallT {async = False, - binds = [(fltAppE_116_129, + binds = [(fltAppE_133_146, CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_117_128"], + rator = "Addone_add_5", + rands = [VarTriv "fltAppE_134_145"], bod = LetCallT {async = False, - binds = [(tmp_app_178, + binds = [(tmp_app_195, CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_116_129"], + rator = "Addtwo_add_6", + rands = [VarTriv "fltAppE_133_146"], bod = LetCallT {async = False, binds = [], rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_178"], + rands = [VarTriv "tmp_app_195"], bod = LetPrimCallT {binds = [], prim = PrintString "\n", rands = [], bod = RetValsT []}}}}}}})} - [compiler] Final C codegen: 13304 characters. + [compiler] Final C codegen: 13391 characters. ================================================================================ /* Gibbon program. */ @@ -2949,12 +3088,12 @@ typedef struct GibCursorGibCursorProd_struct { GibCursor field0; GibCursor field1; } GibCursorGibCursorProd; -GibCursor Addone_add_5(GibCursor t_7_74_130); -GibCursor Addtwo_add_6(GibCursor t_11_78_137); -GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144); -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151); -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158); -unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164); +GibCursor Addone_add_5(GibCursor t_8_87_147); +GibCursor Addtwo_add_6(GibCursor t_12_91_154); +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); typedef enum { GibInt_T, GibFloat_T, @@ -2996,220 +3135,220 @@ void info_table_initialize(void) } void symbol_table_initialize(void) { - gib_add_symbol(179, ")"); - gib_add_symbol(180, "(Node"); - gib_add_symbol(181, "(Leaf"); - gib_add_symbol(182, " "); + gib_add_symbol(196, ")"); + gib_add_symbol(197, "(Node"); + gib_add_symbol(198, "(Leaf"); + gib_add_symbol(199, " "); } -GibCursor Addone_add_5(GibCursor t_7_74_130) +GibCursor Addone_add_5(GibCursor t_8_87_147) { - GibPackedTag tag_183 = *(GibPackedTag *) t_7_74_130; - GibCursor tail_184 = t_7_74_130 + sizeof(GibInt); + GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; + GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); - switch_187: + switch_204: ; - switch (tag_183) { + switch (tag_200) { case 0: { - GibInt x_8_75_131 = ((GibIntProd *) tail_184)->field0; - GibInt fltPkd_120_132 = x_8_75_131 + 1; - GibPtr tailift_185 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; + GibInt fltPkd_137_149 = x_9_88_148 + 1; + GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_185)->field0 = 0; - ((GibIntGibIntProd *) tailift_185)->field1 = fltPkd_120_132; - return tailift_185; + ((GibIntGibIntProd *) tailift_202)->field0 = 0; + ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; + return tailift_202; break; } case 1: { - GibCursor x1_9_76_133 = - ((GibCursorGibCursorProd *) tail_184)->field0; - GibCursor x2_10_77_134 = - ((GibCursorGibCursorProd *) tail_184)->field1; - GibCursor fltPkd_121_135 = Addone_add_5(x1_9_76_133); - GibCursor fltPkd_122_136 = Addone_add_5(x2_10_77_134); - GibPtr tailift_186 = + GibCursor x1_10_89_150 = + ((GibCursorGibCursorProd *) tail_201)->field0; + GibCursor x2_11_90_151 = + ((GibCursorGibCursorProd *) tail_201)->field1; + GibCursor fltPkd_138_152 = Addone_add_5(x1_10_89_150); + GibCursor fltPkd_139_153 = Addone_add_5(x2_11_90_151); + GibPtr tailift_203 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_186)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_186)->field1 = - fltPkd_121_135; - ((GibIntGibCursorGibCursorProd *) tailift_186)->field2 = - fltPkd_122_136; - return tailift_186; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = + fltPkd_138_152; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = + fltPkd_139_153; + return tailift_203; break; } default: { - printf("%s\n", "Unknown tag in: tag_183"); + printf("%s\n", "Unknown tag in: tag_200"); exit(1); } } } -GibCursor Addtwo_add_6(GibCursor t_11_78_137) +GibCursor Addtwo_add_6(GibCursor t_12_91_154) { - GibPackedTag tag_188 = *(GibPackedTag *) t_11_78_137; - GibCursor tail_189 = t_11_78_137 + sizeof(GibInt); + GibPackedTag tag_205 = *(GibPackedTag *) t_12_91_154; + GibCursor tail_206 = t_12_91_154 + sizeof(GibInt); - switch_192: + switch_209: ; - switch (tag_188) { + switch (tag_205) { case 0: { - GibInt x_12_79_138 = ((GibIntProd *) tail_189)->field0; - GibInt fltPkd_123_139 = x_12_79_138 + 2; - GibPtr tailift_190 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_13_92_155 = ((GibIntProd *) tail_206)->field0; + GibInt fltPkd_140_156 = x_13_92_155 + 2; + GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_190)->field0 = 0; - ((GibIntGibIntProd *) tailift_190)->field1 = fltPkd_123_139; - return tailift_190; + ((GibIntGibIntProd *) tailift_207)->field0 = 0; + ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; + return tailift_207; break; } case 1: { - GibCursor x1_13_80_140 = - ((GibCursorGibCursorProd *) tail_189)->field0; - GibCursor x2_14_81_141 = - ((GibCursorGibCursorProd *) tail_189)->field1; - GibCursor fltPkd_124_142 = Addtwo_add_6(x1_13_80_140); - GibCursor fltPkd_125_143 = Addtwo_add_6(x2_14_81_141); - GibPtr tailift_191 = + GibCursor x1_14_93_157 = + ((GibCursorGibCursorProd *) tail_206)->field0; + GibCursor x2_15_94_158 = + ((GibCursorGibCursorProd *) tail_206)->field1; + GibCursor fltPkd_141_159 = Addtwo_add_6(x1_14_93_157); + GibCursor fltPkd_142_160 = Addtwo_add_6(x2_15_94_158); + GibPtr tailift_208 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_191)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_191)->field1 = - fltPkd_124_142; - ((GibIntGibCursorGibCursorProd *) tailift_191)->field2 = - fltPkd_125_143; - return tailift_191; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = + fltPkd_141_159; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = + fltPkd_142_160; + return tailift_208; break; } default: { - printf("%s\n", "Unknown tag in: tag_188"); + printf("%s\n", "Unknown tag in: tag_205"); exit(1); } } } -GibCursor _copy_AddTree_Tree_4(GibCursor arg_39_82_144) +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) { - GibPackedTag tag_193 = *(GibPackedTag *) arg_39_82_144; - GibCursor tail_194 = arg_39_82_144 + sizeof(GibInt); + GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; + GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); - switch_197: + switch_214: ; - switch (tag_193) { + switch (tag_210) { case 0: { - GibInt x_40_83_145 = ((GibIntProd *) tail_194)->field0; - GibPtr tailift_195 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; + GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_195)->field0 = 0; - ((GibIntGibIntProd *) tailift_195)->field1 = x_40_83_145; - return tailift_195; + ((GibIntGibIntProd *) tailift_212)->field0 = 0; + ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; + return tailift_212; break; } case 1: { - GibCursor x_42_85_147 = - ((GibCursorGibCursorProd *) tail_194)->field0; - GibCursor x_43_86_148 = - ((GibCursorGibCursorProd *) tail_194)->field1; - GibCursor y_44_87_149 = _copy_AddTree_Tree_4(x_42_85_147); - GibCursor y_45_88_150 = _copy_AddTree_Tree_4(x_43_86_148); - GibPtr tailift_196 = + GibCursor x_55_102_164 = + ((GibCursorGibCursorProd *) tail_211)->field0; + GibCursor x_56_103_165 = + ((GibCursorGibCursorProd *) tail_211)->field1; + GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); + GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); + GibPtr tailift_213 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_196)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_196)->field1 = - y_44_87_149; - ((GibIntGibCursorGibCursorProd *) tailift_196)->field2 = - y_45_88_150; - return tailift_196; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = + y_57_104_166; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = + y_58_105_167; + return tailift_213; break; } default: { - printf("%s\n", "Unknown tag in: tag_193"); + printf("%s\n", "Unknown tag in: tag_210"); exit(1); } } } -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_46_89_151) +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) { - GibPackedTag tag_198 = *(GibPackedTag *) arg_46_89_151; - GibCursor tail_199 = arg_46_89_151 + sizeof(GibInt); + GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; + GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); - switch_202: + switch_219: ; - switch (tag_198) { + switch (tag_215) { case 0: { - GibInt x_47_90_152 = ((GibIntProd *) tail_199)->field0; - GibPtr tailift_200 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; + GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_200)->field0 = 0; - ((GibIntGibIntProd *) tailift_200)->field1 = x_47_90_152; - return tailift_200; + ((GibIntGibIntProd *) tailift_217)->field0 = 0; + ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; + return tailift_217; break; } case 1: { - GibCursor x_49_92_154 = - ((GibCursorGibCursorProd *) tail_199)->field0; - GibCursor x_50_93_155 = - ((GibCursorGibCursorProd *) tail_199)->field1; - GibCursor y_51_94_156 = - _copy_without_ptrs_AddTree_Tree_4(x_49_92_154); - GibCursor y_52_95_157 = - _copy_without_ptrs_AddTree_Tree_4(x_50_93_155); - GibPtr tailift_201 = + GibCursor x_62_109_171 = + ((GibCursorGibCursorProd *) tail_216)->field0; + GibCursor x_63_110_172 = + ((GibCursorGibCursorProd *) tail_216)->field1; + GibCursor y_64_111_173 = + _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); + GibCursor y_65_112_174 = + _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); + GibPtr tailift_218 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_201)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_201)->field1 = - y_51_94_156; - ((GibIntGibCursorGibCursorProd *) tailift_201)->field2 = - y_52_95_157; - return tailift_201; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = + y_64_111_173; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = + y_65_112_174; + return tailift_218; break; } default: { - printf("%s\n", "Unknown tag in: tag_198"); + printf("%s\n", "Unknown tag in: tag_215"); exit(1); } } } -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) { - GibPackedTag tag_203 = *(GibPackedTag *) arg_53_96_158; - GibCursor tail_204 = arg_53_96_158 + sizeof(GibInt); + GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; + GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); - switch_205: + switch_222: ; - switch (tag_203) { + switch (tag_220) { case 0: { - GibInt x_54_97_159 = ((GibIntProd *) tail_204)->field0; + GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; return 0; break; @@ -3217,12 +3356,14 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) case 1: { - GibCursor x_56_98_160 = - ((GibCursorGibCursorProd *) tail_204)->field0; - GibCursor x_57_99_161 = - ((GibCursorGibCursorProd *) tail_204)->field1; - unsigned char y_58_100_162 = _traverse_AddTree_Tree_4(x_56_98_160); - unsigned char y_59_101_163 = _traverse_AddTree_Tree_4(x_57_99_161); + GibCursor x_69_115_177 = + ((GibCursorGibCursorProd *) tail_221)->field0; + GibCursor x_70_116_178 = + ((GibCursorGibCursorProd *) tail_221)->field1; + unsigned char y_71_117_179 = + _traverse_AddTree_Tree_4(x_69_115_177); + unsigned char y_72_118_180 = + _traverse_AddTree_Tree_4(x_70_116_178); return 0; break; @@ -3230,28 +3371,28 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_53_96_158) default: { - printf("%s\n", "Unknown tag in: tag_203"); + printf("%s\n", "Unknown tag in: tag_220"); exit(1); } } } -unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) { - GibPackedTag tag_206 = *(GibPackedTag *) arg_60_102_164; - GibCursor tail_207 = arg_60_102_164 + sizeof(GibInt); + GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; + GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); - switch_208: + switch_225: ; - switch (tag_206) { + switch (tag_223) { case 0: { - GibInt x_61_103_165 = ((GibIntProd *) tail_207)->field0; - unsigned char wildcard_63_104_166 = gib_print_symbol(181); - unsigned char wildcard_65_105_167 = gib_print_symbol(182); - unsigned char y_62_106_168 = printf("%ld", x_61_103_165); - unsigned char wildcard_64_107_169 = gib_print_symbol(179); + GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; + unsigned char wildcard_76_121_183 = gib_print_symbol(198); + unsigned char wildcard_78_122_184 = gib_print_symbol(199); + unsigned char y_75_123_185 = printf("%ld", x_74_120_182); + unsigned char wildcard_77_124_186 = gib_print_symbol(196); return 0; break; @@ -3259,16 +3400,16 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) case 1: { - GibCursor x_66_108_170 = - ((GibCursorGibCursorProd *) tail_207)->field0; - GibCursor x_67_109_171 = - ((GibCursorGibCursorProd *) tail_207)->field1; - unsigned char wildcard_70_110_172 = gib_print_symbol(180); - unsigned char wildcard_73_111_173 = gib_print_symbol(182); - unsigned char y_68_112_174 = _print_AddTree_Tree_4(x_66_108_170); - unsigned char wildcard_72_113_175 = gib_print_symbol(182); - unsigned char y_69_114_176 = _print_AddTree_Tree_4(x_67_109_171); - unsigned char wildcard_71_115_177 = gib_print_symbol(179); + GibCursor x_79_125_187 = + ((GibCursorGibCursorProd *) tail_224)->field0; + GibCursor x_80_126_188 = + ((GibCursorGibCursorProd *) tail_224)->field1; + unsigned char wildcard_83_127_189 = gib_print_symbol(197); + unsigned char wildcard_86_128_190 = gib_print_symbol(199); + unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); + unsigned char wildcard_85_130_192 = gib_print_symbol(199); + unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); + unsigned char wildcard_84_132_194 = gib_print_symbol(196); return 0; break; @@ -3276,7 +3417,7 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_60_102_164) default: { - printf("%s\n", "Unknown tag in: tag_206"); + printf("%s\n", "Unknown tag in: tag_223"); exit(1); } } @@ -3288,26 +3429,26 @@ int main(int argc, char **argv) info_table_initialize(); symbol_table_initialize(); - GibPtr fltPkd_118_126 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_118_126)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_118_126)->field1 = 1; + ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; - GibPtr fltPkd_119_127 = gib_alloc(sizeof(GibIntGibIntProd)); + GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) fltPkd_119_127)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_119_127)->field1 = 2; + ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; - GibPtr fltAppE_117_128 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field1 = fltPkd_118_126; - ((GibIntGibCursorGibCursorProd *) fltAppE_117_128)->field2 = fltPkd_119_127; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; - GibCursor fltAppE_116_129 = Addtwo_add_6(fltAppE_117_128); - GibCursor tmp_app_178 = Addone_add_5(fltAppE_116_129); + GibCursor fltAppE_133_146 = Addone_add_5(fltAppE_134_145); + GibCursor tmp_app_195 = Addtwo_add_6(fltAppE_133_146); - _print_AddTree_Tree_4(tmp_app_178); + _print_AddTree_Tree_4(tmp_app_195); printf("\n"); return 0; diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index e79c4d853..967f2cd13 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -203,6 +203,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports dbgPrintLn 2 "================================================================================" dbgPrintLn 2 $ "desugaring module: " ++ mod_name dbgPrintLn 2 $ "- imports: " ++ (show import_names) + dbgPrintLn 2 $ "- aliases: " ++ (show aliases) imported_progs :: [PassM Prog0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports let prog = do @@ -250,6 +251,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports funs''' (M.keys userOrderings') imported_progs' <- mapM id imported_progs + Prog defs'' funs'''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' let (defs0, funs0) = foldr (\Prog {ddefs, fundefs} (defs1, funs1) -> @@ -288,14 +290,21 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports error $ "Conflicting definitions of " ++ show (S.toList em2) ++ " found in " ++ mod_name) - (defs', funs''') + (defs'', funs'''') imported_progs' - fillImports (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + return $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) mod_name = moduleName head_mb - import_names = (map (\(ImportDecl _ (ModuleName _ imp_name) _ _ _ _ _ _) -> imp_name) imports) + import_names = (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ _ _) -> importName) imports) + aliases = M.fromList (map + (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ aliased _) -> + case aliased of + Just (ModuleName _ importAs) -> ((toVar importName), (toVar importAs)) + Nothing -> ((toVar importName), (toVar importName)) + ) + imports) coalese_constraints :: [(Var, M.Map DataCon [UserOrdering])] -> [(Var, M.Map DataCon [UserOrdering])] @@ -431,9 +440,9 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} error $ "Qualified imports not supported yet. Offending import: " ++ prettyPrint decl - when (isJust importAs) $ - error $ - "Module aliases not supported yet. Offending import: " ++ prettyPrint decl + --when (isJust importAs) $ + -- error $ + -- "Module aliases not supported yet. Offending import: " ++ prettyPrint decl when (isJust importSpecs) $ error $ "Selective imports not supported yet. Offending import: " ++ diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index ea60831ef..25c36a695 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -15,16 +15,34 @@ import Gibbon.Common import Gibbon.L0.Syntax import qualified Gibbon.L1.Syntax as L1 +import qualified Language.Haskell.Exts.Syntax as H + -------------------------------------------------------------------------------- type VarEnv = M.Map Var (M.Map Var Var) type TyVarEnv t = M.Map TyVar t -fillImports :: Prog0 -> PassM Prog0 -fillImports (Prog defs funs main) = +fillImports :: Prog0 -> Var -> [H.ImportDecl a] -> [Prog0]-> PassM Prog0 +fillImports (Prog defs funs main) localMod imports imported_progs = do - -- defs - let defNameMap = M.fromList $ zip (M.keys defs) (M.keys defs) + + -- resolve aliases in imported functions + let aliases = getAliases imports + let initImportedNames :: [(Var, Var)] = [] + let applyAlias :: Var -> M.Map Var Var -> (Var, Var) + applyAlias v aliasMap = do + let (mod, name) = parseOutMod v + case mod of + Just modName -> + case (M.lookup modName aliasMap) of + Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), v) + Nothing -> error $ "could not find module or alias: " ++ (show modName) + Nothing -> error "how did we get here?" + let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyAlias tyName aliases) (M.keys idefs))) initImportedNames imported_progs + let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyAlias funName aliases) (M.keys ifuns))) initImportedNames imported_progs + + -- build def env + let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (M.keys defs)) let initDefEnv :: VarEnv = M.empty let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap let transformDefKey :: Var -> Var @@ -32,8 +50,8 @@ fillImports (Prog defs funs main) = let (mod, name) = parseOutMod k resolveNameInEnv mod name defenv - -- funs - let funNameMap = M.fromList $ zip (M.keys funs) (M.keys funs) + -- build fun env + let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (M.keys funs)) let initFunEnv :: VarEnv = M.empty let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap let transformFunKey :: Var -> Var @@ -44,9 +62,11 @@ fillImports (Prog defs funs main) = -- main main' <- case main of Nothing -> return Nothing - Just (m,ty) -> do m' <- resolveModInExp m defenv funenv + Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) + m' <- resolveModInExp m defenv funenv return $ Just (m',ty) + defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs @@ -55,6 +75,27 @@ fillImports (Prog defs funs main) = return $ Prog defs'' funs'' main' +getAliases :: [H.ImportDecl a] -> M.Map Var Var +getAliases imports = do + M.fromList $ map + (\(H.ImportDecl _ (H.ModuleName _ importName) _ _ _ _ aliased _) -> + case aliased of + Just (H.ModuleName _ importAs) -> ((toVar importName), (toVar importAs)) + Nothing -> ((toVar importName), (toVar importName)) + ) + imports + +resolveAlias :: Var -> Var -> M.Map Var Var -> (Var, Var) +resolveAlias fullName localMod aliases = do + let (mod, name) = parseOutMod fullName + case mod of + Just modName -> + if modName == localMod then (fullName, fullName) + else case (M.lookup modName aliases) of + Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), fullName) + Nothing -> error $ "could not find import: " ++ (fromVar modName) ++ " in alias map: " ++ (show aliases) + Nothing -> error $ "tbh shoulding get here either -- resolving aliases, couldn't parse out module name in declaration" + resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = do @@ -119,7 +160,7 @@ resolveModInExp exp defenv funenv = let (mod, fun) = parseOutMod v let v' = resolveNameInEnv mod fun funenv ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls - return $ AppE v' locs ls + return $ AppE v' locs ls' PrimAppE p es -> return $ PrimAppE p es @@ -184,7 +225,7 @@ resolveNameInEnv mod name e = Just modspace -> case mod of Just m -> case (M.lookup m modspace) of Just n -> n - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) ++ " in env: " ++ (show e) Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find " ++ (fromVar name) - Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file + else error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) \ No newline at end of file From 7d61d813ca0eb0a98a6814b80b87066d6ec7d48c Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 22 Nov 2023 15:46:20 -0800 Subject: [PATCH 31/68] qualified imports --- gibbon-compiler/examples/addimport.hs | 6 +- gibbon-compiler/ir.log | 3453 +---------------- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 4 - .../src/Gibbon/Passes/ModuleFillImports.hs | 62 +- 4 files changed, 35 insertions(+), 3490 deletions(-) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index 6b0f947d0..e779665a0 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,6 +1,6 @@ module AddImport where - import Addone as On - import Addtwo as Tw + import qualified Addone as On + import qualified Addtwo as Tw import AddTree - gibbon_main = Tw.add (On.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = On.add (Tw.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index 156118cf7..3652f187a 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -32,3453 +32,6 @@ desugaring module: Addtwo - aliases: fromList [(Var "AddTree",Var "AddTree")] - [compiler] pipeline starting, parsed program: -================================================================================ -Prog {ddefs = [(AddTree.Tree, - DDef {tyName = "AddTree.Tree", - tyArgs = [], - dataCons = [("Leaf", [(False, IntTy)]), - ("Node", - [(False, PackedTy "AddTree.Tree" []), - (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(Addone.add, - FunDef {funName = "Addone.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addone.add" [] [VarE "x1"], - AppE "Addone.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.add, - FunDef {funName = "Addtwo.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addtwo.add" [] [VarE "x1"], - AppE "Addtwo.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.sub, - FunDef {funName = "Addtwo.sub", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addtwo.sub" [] [VarE "x1"], - AppE "Addtwo.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Addtwo.add" - [] - [AppE "Addone.add" - [] - [DataConE (MetaTv $0) - "Node" - [DataConE (MetaTv $1) "Leaf" [LitE 1], - DataConE (MetaTv $2) "Leaf" [LitE 2]]]], - MetaTv $3)} - - [compiler] Running pass, renameModules -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 1) - Node x1::$4 x2::$5 -> - (Node $3 (Addone_add_5 [] x1) (Addone_add_5 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 2) - Node x1::$4 x2::$5 -> - (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t = - case t of - Leaf x::$8 -> - (Leaf $7 x - 2) - Node x1::$10 x2::$11 -> - (Node $9 (Addtwo_sub_7 [] x1) (Addtwo_sub_7 [] x2)) - -gibbon_main :: $3 -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) - - [compiler] Running pass, freshen -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::$2 -> - (Leaf $1 x_9 + 1) - Node x1_10::$4 x2_11::$5 -> - (Node $3 (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::$2 -> - (Leaf $1 x_13 + 2) - Node x1_14::$4 x2_15::$5 -> - (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::$8 -> - (Leaf $7 x_17 - 2) - Node x1_18::$10 x2_19::$11 -> - (Node $9 (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: $3 -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, bindLambdas -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, monomorphize -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, specLambdas -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 + 1) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 - 2) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, desugarL0 -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::() -> - (Leaf () x_9 + 1) - Node x1_10::() x2_11::() -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 - 2) - Node x1_18::() x2_19::() -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, floatOutCase -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9::() -> - (Leaf () x_9 + 1) - Node x1_10::() x2_11::() -> - (Node () (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 - 2) - Node x1_18::() x2_19::() -> - (Node () (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node () (Leaf () 1) (Leaf () 2)))) - - [compiler] Running pass, toL1 -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, benchMainExp -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8 = - case t_8 of - Leaf x_9 -> - (Leaf x_9 + 1) - Node x1_10 x2_11 -> - (Node (Addone_add_5 [] x1_10) (Addone_add_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 - 2) - Node x1_18 x2_19 -> - (Node (Addtwo_sub_7 [] x1_18) (Addtwo_sub_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, simplify -Removed unused functions: [Var "Addtwo_sub_7"] -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 + 1) - Node x1_10_89 x2_11_90 -> - (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91 = - case t_12_91 of - Leaf x_13_92 -> - (Leaf x_13_92 + 2) - Node x1_14_93 x2_15_94 -> - (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 + 1) - Node x1_10_89 x2_11_90 -> - (Node (Addone_add_5 [] x1_10_89) (Addone_add_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91 = - case t_12_91 of - Leaf x_13_92 -> - (Leaf x_13_92 + 2) - Node x1_14_93 x2_15_94 -> - (Node (Addtwo_add_6 [] x1_14_93) (Addtwo_add_6 [] x2_15_94)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addtwo_add_6 [] (Addone_add_5 [] (Node (Leaf 1) (Leaf 2)))) - - [compiler] Running pass, flatten -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - let fltPkd_137 :: Int = x_9_88 + 1 in - (Leaf fltPkd_137) - Node x1_10_89 x2_11_90 -> - let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89) in - let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90) in - (Node fltPkd_138 fltPkd_139) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91 = - case t_12_91 of - Leaf x_13_92 -> - let fltPkd_140 :: Int = x_13_92 + 2 in - (Leaf fltPkd_140) - Node x1_14_93 x2_15_94 -> - let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93) in - let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94) in - (Node fltPkd_141 fltPkd_142) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in - let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134) in - (Addtwo_add_6 [] fltAppE_133) - - [compiler] Running pass, simplify -Removed unused functions: [] -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - let y_54_101_163 :: Int = x_53_100_162 in - (Leaf y_54_101_163) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - let y_61_108_170 :: Int = x_60_107_169 in - (Leaf y_61_108_170) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, inlineTriv -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, directL3 -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - (Addtwo_add_6 [] fltAppE_133_146) - - [compiler] Running pass, unariser -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, L3.flatten -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_5 :: Cursor -> Cursor -Addone_add_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 + 1 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addone_add_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addone_add_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: Cursor -> Cursor -Addtwo_add_6 t_12_91_154 = - case t_12_91_154 of - Leaf x_13_92_155 -> - let fltPkd_140_156 :: Int = x_13_92_155 + 2 in - (Leaf fltPkd_140_156) - Node x1_14_93_157 x2_15_94_158 -> - let fltPkd_141_159 :: Cursor = (Addtwo_add_6 [] x1_14_93_157) in - let fltPkd_142_160 :: Cursor = (Addtwo_add_6 [] x2_15_94_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addone_add_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addtwo_add_6 [] fltAppE_133_146) in - tmp_app_195 - - [compiler] Running pass, lower -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = AddP, - rands = [VarTriv "x_9_88_148", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_12_91_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_12_91_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_13_92_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_13_92_155", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_14_93_157, - CursorTy), - (x2_15_94_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x1_14_93_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x2_15_94_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), - (1, - LetUnpackT {binds = [(x_55_102_164, - CursorTy), - (x_56_103_165, - CursorTy)], - ptr = "tail_211", - bod = LetCallT {async = False, - binds = [(y_57_104_166, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], - bod = LetCallT {async = False, - binds = [(y_58_105_167, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_57_104_166"), - (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") - (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, - IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), - (1, - LetUnpackT {binds = [(x_62_109_171, - CursorTy), - (x_63_110_172, - CursorTy)], - ptr = "tail_216", - bod = LetCallT {async = False, - binds = [(y_64_111_173, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], - bod = LetCallT {async = False, - binds = [(y_65_112_174, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_64_111_173"), - (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") - (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, - IntTy)], - ptr = "tail_221", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_69_115_177, - CursorTy), - (x_70_116_178, - CursorTy)], - ptr = "tail_221", - bod = LetCallT {async = False, - binds = [(y_71_117_179, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], - bod = LetCallT {async = False, - binds = [(y_72_118_180, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") - (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, - IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_79_125_187, - CursorTy), - (x_80_126_188, - CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_81_129_191, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_82_131_193, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, - isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Running pass, lateInlineTriv -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = AddP, - rands = [VarTriv "x_9_88_148", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_12_91_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_12_91_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_13_92_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_13_92_155", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_14_93_157, - CursorTy), - (x2_15_94_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x1_14_93_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x2_15_94_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), - (1, - LetUnpackT {binds = [(x_55_102_164, - CursorTy), - (x_56_103_165, - CursorTy)], - ptr = "tail_211", - bod = LetCallT {async = False, - binds = [(y_57_104_166, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], - bod = LetCallT {async = False, - binds = [(y_58_105_167, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_57_104_166"), - (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") - (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, - IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), - (1, - LetUnpackT {binds = [(x_62_109_171, - CursorTy), - (x_63_110_172, - CursorTy)], - ptr = "tail_216", - bod = LetCallT {async = False, - binds = [(y_64_111_173, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], - bod = LetCallT {async = False, - binds = [(y_65_112_174, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_64_111_173"), - (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") - (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, - IntTy)], - ptr = "tail_221", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_69_115_177, - CursorTy), - (x_70_116_178, - CursorTy)], - ptr = "tail_221", - bod = LetCallT {async = False, - binds = [(y_71_117_179, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], - bod = LetCallT {async = False, - binds = [(y_72_118_180, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") - (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, - IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_79_125_187, - CursorTy), - (x_80_126_188, - CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_81_129_191, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_82_131_193, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, - isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Running pass, rearrangeFree -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addone_add_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = AddP, - rands = [VarTriv "x_9_88_148", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addtwo_add_6", - funArgs = [(t_12_91_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_12_91_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_13_92_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_13_92_155", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_14_93_157, - CursorTy), - (x2_15_94_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x1_14_93_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "x2_15_94_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), - (1, - LetUnpackT {binds = [(x_55_102_164, - CursorTy), - (x_56_103_165, - CursorTy)], - ptr = "tail_211", - bod = LetCallT {async = False, - binds = [(y_57_104_166, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], - bod = LetCallT {async = False, - binds = [(y_58_105_167, - CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_57_104_166"), - (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") - (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, - IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), - (1, - LetUnpackT {binds = [(x_62_109_171, - CursorTy), - (x_63_110_172, - CursorTy)], - ptr = "tail_216", - bod = LetCallT {async = False, - binds = [(y_64_111_173, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], - bod = LetCallT {async = False, - binds = [(y_65_112_174, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_64_111_173"), - (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") - (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, - IntTy)], - ptr = "tail_221", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_69_115_177, - CursorTy), - (x_70_116_178, - CursorTy)], - ptr = "tail_221", - bod = LetCallT {async = False, - binds = [(y_71_117_179, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], - bod = LetCallT {async = False, - binds = [(y_72_118_180, - ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") - (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, - IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_79_125_187, - CursorTy), - (x_80_126_188, - CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_81_129_191, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 199], - bod = LetCallT {async = False, - binds = [(y_82_131_193, - ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 196], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, - isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addone_add_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addtwo_add_6", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Final C codegen: 13391 characters. -================================================================================ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef struct GibIntProd_struct { - GibInt field0; - } GibIntProd; -typedef struct GibIntGibIntProd_struct { - GibInt field0; - GibInt field1; - } GibIntGibIntProd; -typedef struct GibIntGibCursorGibCursorProd_struct { - GibInt field0; - GibCursor field1; - GibCursor field2; - } GibIntGibCursorGibCursorProd; -typedef struct GibPackedTagGibCursorProd_struct { - GibPackedTag field0; - GibCursor field1; - } GibPackedTagGibCursorProd; -typedef struct GibCursorProd_struct { - GibCursor field0; - } GibCursorProd; -typedef struct GibCursorGibCursorProd_struct { - GibCursor field0; - GibCursor field1; - } GibCursorGibCursorProd; -GibCursor Addone_add_5(GibCursor t_8_87_147); -GibCursor Addtwo_add_6(GibCursor t_12_91_154); -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - AddTree_Tree_4_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(8); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[1]; - - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 0); - exit(1); - } - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 1); - exit(1); - } - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ - gib_add_symbol(196, ")"); - gib_add_symbol(197, "(Node"); - gib_add_symbol(198, "(Leaf"); - gib_add_symbol(199, " "); -} -GibCursor Addone_add_5(GibCursor t_8_87_147) -{ - GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; - GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); - - - switch_204: - ; - switch (tag_200) { - - case 0: - { - GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; - GibInt fltPkd_137_149 = x_9_88_148 + 1; - GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_202)->field0 = 0; - ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; - return tailift_202; - break; - } - - case 1: - { - GibCursor x1_10_89_150 = - ((GibCursorGibCursorProd *) tail_201)->field0; - GibCursor x2_11_90_151 = - ((GibCursorGibCursorProd *) tail_201)->field1; - GibCursor fltPkd_138_152 = Addone_add_5(x1_10_89_150); - GibCursor fltPkd_139_153 = Addone_add_5(x2_11_90_151); - GibPtr tailift_203 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = - fltPkd_138_152; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = - fltPkd_139_153; - return tailift_203; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_200"); - exit(1); - } - } -} -GibCursor Addtwo_add_6(GibCursor t_12_91_154) -{ - GibPackedTag tag_205 = *(GibPackedTag *) t_12_91_154; - GibCursor tail_206 = t_12_91_154 + sizeof(GibInt); - - - switch_209: - ; - switch (tag_205) { - - case 0: - { - GibInt x_13_92_155 = ((GibIntProd *) tail_206)->field0; - GibInt fltPkd_140_156 = x_13_92_155 + 2; - GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_207)->field0 = 0; - ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; - return tailift_207; - break; - } - - case 1: - { - GibCursor x1_14_93_157 = - ((GibCursorGibCursorProd *) tail_206)->field0; - GibCursor x2_15_94_158 = - ((GibCursorGibCursorProd *) tail_206)->field1; - GibCursor fltPkd_141_159 = Addtwo_add_6(x1_14_93_157); - GibCursor fltPkd_142_160 = Addtwo_add_6(x2_15_94_158); - GibPtr tailift_208 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = - fltPkd_141_159; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = - fltPkd_142_160; - return tailift_208; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_205"); - exit(1); - } - } -} -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) -{ - GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; - GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); - - - switch_214: - ; - switch (tag_210) { - - case 0: - { - GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; - GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_212)->field0 = 0; - ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; - return tailift_212; - break; - } - - case 1: - { - GibCursor x_55_102_164 = - ((GibCursorGibCursorProd *) tail_211)->field0; - GibCursor x_56_103_165 = - ((GibCursorGibCursorProd *) tail_211)->field1; - GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); - GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); - GibPtr tailift_213 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = - y_57_104_166; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = - y_58_105_167; - return tailift_213; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_210"); - exit(1); - } - } -} -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) -{ - GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; - GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); - - - switch_219: - ; - switch (tag_215) { - - case 0: - { - GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; - GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_217)->field0 = 0; - ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; - return tailift_217; - break; - } - - case 1: - { - GibCursor x_62_109_171 = - ((GibCursorGibCursorProd *) tail_216)->field0; - GibCursor x_63_110_172 = - ((GibCursorGibCursorProd *) tail_216)->field1; - GibCursor y_64_111_173 = - _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); - GibCursor y_65_112_174 = - _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); - GibPtr tailift_218 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = - y_64_111_173; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = - y_65_112_174; - return tailift_218; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_215"); - exit(1); - } - } -} -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) -{ - GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; - GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); - - - switch_222: - ; - switch (tag_220) { - - case 0: - { - GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; - - return 0; - break; - } - - case 1: - { - GibCursor x_69_115_177 = - ((GibCursorGibCursorProd *) tail_221)->field0; - GibCursor x_70_116_178 = - ((GibCursorGibCursorProd *) tail_221)->field1; - unsigned char y_71_117_179 = - _traverse_AddTree_Tree_4(x_69_115_177); - unsigned char y_72_118_180 = - _traverse_AddTree_Tree_4(x_70_116_178); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_220"); - exit(1); - } - } -} -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) -{ - GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; - GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); - - - switch_225: - ; - switch (tag_223) { - - case 0: - { - GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; - unsigned char wildcard_76_121_183 = gib_print_symbol(198); - unsigned char wildcard_78_122_184 = gib_print_symbol(199); - unsigned char y_75_123_185 = printf("%ld", x_74_120_182); - unsigned char wildcard_77_124_186 = gib_print_symbol(196); - - return 0; - break; - } - - case 1: - { - GibCursor x_79_125_187 = - ((GibCursorGibCursorProd *) tail_224)->field0; - GibCursor x_80_126_188 = - ((GibCursorGibCursorProd *) tail_224)->field1; - unsigned char wildcard_83_127_189 = gib_print_symbol(197); - unsigned char wildcard_86_128_190 = gib_print_symbol(199); - unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); - unsigned char wildcard_85_130_192 = gib_print_symbol(199); - unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); - unsigned char wildcard_84_132_194 = gib_print_symbol(196); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_223"); - exit(1); - } - } -} -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; - - GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; - - GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; - - GibCursor fltAppE_133_146 = Addone_add_5(fltAppE_134_145); - GibCursor tmp_app_195 = Addtwo_add_6(fltAppE_133_146); - - _print_AddTree_Tree_4(tmp_app_195); - printf("\n"); - return 0; - - int exit_1 = gib_exit(); - - return exit_1; -} - -Compiling RTS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 - -make: Nothing to be done for 'all'. - - - - -Compiling the program -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng - - - -In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] - #warning "Simple write barrier is disabled." - ^~~~~~~ - - -(Node (Leaf 4) (Leaf 5)) +gibbon: Ambiguous reference +CallStack (from HasCallStack): + error, called at src/Gibbon/Passes/ModuleFillImports.hs:226:35 in gibbon-0.3-inplace:Gibbon.Passes.ModuleFillImports diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 967f2cd13..356e93a21 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -436,10 +436,6 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} error $ "Circular dependency detected. Import path: " ++ show (mod_name : import_route) - when (importQualified) $ - error $ - "Qualified imports not supported yet. Offending import: " ++ - prettyPrint decl --when (isJust importAs) $ -- error $ -- "Module aliases not supported yet. Offending import: " ++ prettyPrint decl diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 25c36a695..12b58ae9a 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -19,7 +19,7 @@ import qualified Language.Haskell.Exts.Syntax as H -------------------------------------------------------------------------------- -type VarEnv = M.Map Var (M.Map Var Var) +type VarEnv = M.Map Var (M.Map Var (Var, Bool)) type TyVarEnv t = M.Map TyVar t fillImports :: Prog0 -> Var -> [H.ImportDecl a] -> [Prog0]-> PassM Prog0 @@ -27,22 +27,22 @@ fillImports (Prog defs funs main) localMod imports imported_progs = do -- resolve aliases in imported functions - let aliases = getAliases imports - let initImportedNames :: [(Var, Var)] = [] - let applyAlias :: Var -> M.Map Var Var -> (Var, Var) - applyAlias v aliasMap = do + let importMeta = getImportMeta imports + let initImportedNames :: [(Var, (Var, Bool))] = [] + let applyImportMeta :: Var -> M.Map Var (Var, Bool) -> (Var, (Var, Bool)) + applyImportMeta v importMap = do let (mod, name) = parseOutMod v case mod of Just modName -> - case (M.lookup modName aliasMap) of - Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), v) + case (M.lookup modName importMap) of + Just (alias, qual) -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual)) Nothing -> error $ "could not find module or alias: " ++ (show modName) Nothing -> error "how did we get here?" - let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyAlias tyName aliases) (M.keys idefs))) initImportedNames imported_progs - let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyAlias funName aliases) (M.keys ifuns))) initImportedNames imported_progs + let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs + let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs -- build def env - let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (M.keys defs)) + let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (map (\v -> (v, False)) (M.keys defs))) let initDefEnv :: VarEnv = M.empty let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap let transformDefKey :: Var -> Var @@ -51,7 +51,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = resolveNameInEnv mod name defenv -- build fun env - let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (M.keys funs)) + let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (map (\v -> (v, False)) (M.keys funs)) ) let initFunEnv :: VarEnv = M.empty let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap let transformFunKey :: Var -> Var @@ -75,27 +75,16 @@ fillImports (Prog defs funs main) localMod imports imported_progs = return $ Prog defs'' funs'' main' -getAliases :: [H.ImportDecl a] -> M.Map Var Var -getAliases imports = do +getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool) +getImportMeta imports = do M.fromList $ map - (\(H.ImportDecl _ (H.ModuleName _ importName) _ _ _ _ aliased _) -> + (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased _) -> case aliased of - Just (H.ModuleName _ importAs) -> ((toVar importName), (toVar importAs)) - Nothing -> ((toVar importName), (toVar importName)) + Just (H.ModuleName _ importAs) -> ((toVar importName), ((toVar importAs), qualified)) + Nothing -> ((toVar importName), ((toVar importName), qualified)) ) imports -resolveAlias :: Var -> Var -> M.Map Var Var -> (Var, Var) -resolveAlias fullName localMod aliases = do - let (mod, name) = parseOutMod fullName - case mod of - Just modName -> - if modName == localMod then (fullName, fullName) - else case (M.lookup modName aliases) of - Just alias -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), fullName) - Nothing -> error $ "could not find import: " ++ (fromVar modName) ++ " in alias map: " ++ (show aliases) - Nothing -> error $ "tbh shoulding get here either -- resolving aliases, couldn't parse out module name in declaration" - resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = do @@ -195,7 +184,7 @@ resolveModInExp exp defenv funenv = -- environment interactions -buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) +buildEnv :: VarEnv -> Var -> (Var, Bool) -> (VarEnv, (Var, Bool)) buildEnv env k v = do let (mod, name) = parseOutMod k let mod' = case mod of @@ -203,7 +192,7 @@ buildEnv env k v = do Nothing -> (toVar "") case (M.lookup name env) of Just m -> - if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') + if (M.member mod' m) then error $ "duplicate function call in module" ++ (fromVar mod') else ((M.insert name (M.insert mod' v m) env), v) Nothing -> ((M.insert name (M.singleton mod' v) env), v) @@ -224,8 +213,15 @@ resolveNameInEnv mod name e = do case (M.lookup name e) of Just modspace -> case mod of Just m -> case (M.lookup m modspace) of - Just n -> n + Just (n, _) -> n Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) ++ " in env: " ++ (show e) - Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) \ No newline at end of file + Nothing -> case (foldr findUnqualified (False, "") modspace) of + (True, n) -> n + (False, _) -> error $ "can't find unquilified reference to " ++ (fromVar name) + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) + +findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) +findUnqualified (n, q) (acc, out) = + if (not q) && (not acc) then (True, n) + else if (not q) && acc then error $ "Ambiguous reference" + else (acc, out) \ No newline at end of file From 0aa6bb32f9ab8118cc37d4d831ba27ec9a5e5341 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 22 Nov 2023 18:20:14 -0800 Subject: [PATCH 32/68] spec imports --- gibbon-compiler/examples/addimport.hs | 6 +- gibbon-compiler/ir.log | 3469 ++++++++++++++++- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 38 +- .../src/Gibbon/Passes/ModuleFillImports.hs | 46 +- 4 files changed, 3535 insertions(+), 24 deletions(-) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs index e779665a0..7d874a369 100644 --- a/gibbon-compiler/examples/addimport.hs +++ b/gibbon-compiler/examples/addimport.hs @@ -1,6 +1,6 @@ module AddImport where - import qualified Addone as On - import qualified Addtwo as Tw + import Addtwo (sub) + import Addone import AddTree - gibbon_main = On.add (Tw.add (Node (Leaf 1) (Leaf 2))) \ No newline at end of file + gibbon_main = add (sub (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index 3652f187a..bfe86e8f7 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -4,18 +4,22 @@ desugaring module: AddImport -- imports: ["Addone","Addtwo","AddTree"] +- imports: ["Addtwo","Addone","AddTree"] -- aliases: fromList [(Var "Addone",Var "On"),(Var "Addtwo",Var "Tw"),(Var "AddTree",Var "AddTree")] +- aliases: fromList [(Var "Addtwo",Var "Addtwo"),(Var "Addone",Var "Addone"),(Var "AddTree",Var "AddTree")] + +- imports: fromList [(Var "Addtwo",(Var "Addtwo",False,Just [Var "sub"])),(Var "Addone",(Var "Addone",False,Nothing)),(Var "AddTree",(Var "AddTree",False,Nothing))] ================================================================================ -desugaring module: Addone +desugaring module: Addtwo - imports: ["AddTree"] - aliases: fromList [(Var "AddTree",Var "AddTree")] +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + ================================================================================ desugaring module: AddTree @@ -24,14 +28,3465 @@ desugaring module: AddTree - aliases: fromList [] +- imports: fromList [] + ================================================================================ -desugaring module: Addtwo +desugaring module: Addone - imports: ["AddTree"] - aliases: fromList [(Var "AddTree",Var "AddTree")] -gibbon: Ambiguous reference -CallStack (from HasCallStack): - error, called at src/Gibbon/Passes/ModuleFillImports.hs:226:35 in gibbon-0.3-inplace:Gibbon.Passes.ModuleFillImports +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(AddTree.Tree, + DDef {tyName = "AddTree.Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "AddTree.Tree" []), + (False, PackedTy "AddTree.Tree" [])])]})], + fundefs = [(Addtwo.sub, + FunDef {funName = "Addtwo.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addtwo.sub" [] [VarE "x1"], + AppE "Addtwo.sub" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.add, + FunDef {funName = "Addtwo.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addtwo.add" [] [VarE "x1"], + AppE "Addtwo.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addone.add, + FunDef {funName = "Addone.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addone.add" [] [VarE "x1"], + AppE "Addone.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (AppE "Addone.add" + [] + [AppE "Addtwo.sub" + [] + [DataConE (MetaTv $0) + "Node" + [DataConE (MetaTv $1) "Leaf" [LitE 1], + DataConE (MetaTv $2) "Leaf" [LitE 2]]]], + MetaTv $3)} + + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 2) + Node x1::$10 x2::$11 -> + (Node $9 (Addtwo_sub_5 [] x1) (Addtwo_sub_5 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 2) + Node x1::$4 x2::$5 -> + (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 1) + Node x1::$4 x2::$5 -> + (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) + +gibbon_main :: $3 +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::$8 -> + (Leaf $7 x_9 - 2) + Node x1_10::$10 x2_11::$11 -> + (Node $9 (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::$2 -> + (Leaf $1 x_13 + 2) + Node x1_14::$4 x2_15::$5 -> + (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::$2 -> + (Leaf $1 x_17 + 1) + Node x1_18::$4 x2_19::$5 -> + (Node $3 (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: $3 +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, bindLambdas +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, monomorphize +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, specLambdas +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::Int -> + (Leaf () x_9 - 2) + Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::Int -> + (Leaf () x_13 + 2) + Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::Int -> + (Leaf () x_17 + 1) + Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, desugarL0 +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 - 2) + Node x1_10::() x2_11::() -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 + 1) + Node x1_18::() x2_19::() -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> + () + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, floatOutCase +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9::() -> + (Leaf () x_9 - 2) + Node x1_10::() x2_11::() -> + (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13::() -> + (Leaf () x_13 + 2) + Node x1_14::() x2_15::() -> + (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17::() -> + (Leaf () x_17 + 1) + Node x1_18::() x2_19::() -> + (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53::() -> + let y_54 :: Int = x_53 in + (Leaf () y_54) + Node x_55::() x_56::() -> + let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in + (Node () y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60::() -> + let y_61 :: Int = x_60 in + (Leaf () y_61) + Node x_62::() x_63::() -> + let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node () y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67::() -> + () + Node x_69::() x_70::() -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74::() -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79::() x_80::() -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4 []) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) + + [compiler] Running pass, toL1 +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, benchMainExp +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8 = + case t_8 of + Leaf x_9 -> + (Leaf x_9 - 2) + Node x1_10 x2_11 -> + (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_add_6 t_12 = + case t_12 of + Leaf x_13 -> + (Leaf x_13 + 2) + Node x1_14 x2_15 -> + (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16 = + case t_16 of + Leaf x_17 -> + (Leaf x_17 + 1) + Node x1_18 x2_19 -> + (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52 = + case arg_52 of + Leaf x_53 -> + let y_54 :: Int = x_53 in + (Leaf y_54) + Node x_55 x_56 -> + let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in + let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in + (Node y_57 y_58) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59 = + case arg_59 of + Leaf x_60 -> + let y_61 :: Int = x_60 in + (Leaf y_61) + Node x_62 x_63 -> + let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in + let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in + (Node y_64 y_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66 = + case arg_66 of + Leaf x_67 -> + () + Node x_69 x_70 -> + let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in + let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73 = + case arg_73 of + Leaf x_74 -> + let wildcard_76 :: () = printsym("(Leaf") in + let wildcard_78 :: () = printsym(" ") in + let y_75 :: () = printint(x_74) in + let wildcard_77 :: () = printsym(")") in + () + Node x_79 x_80 -> + let wildcard_83 :: () = printsym("(Node") in + let wildcard_86 :: () = printsym(" ") in + let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in + let wildcard_85 :: () = printsym(" ") in + let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in + let wildcard_84 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, simplify +Removed unused functions: [Var "Addtwo_add_6"] +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 - 2) + Node x1_10_89 x2_11_90 -> + (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95 = + case t_16_95 of + Leaf x_17_96 -> + (Leaf x_17_96 + 1) + Node x1_18_97 x2_19_98 -> + (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> + () + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + (Leaf x_9_88 - 2) + Node x1_10_89 x2_11_90 -> + (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95 = + case t_16_95 of + Leaf x_17_96 -> + (Leaf x_17_96 + 1) + Node x1_18_97 x2_19_98 -> + (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> + () + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) + + [compiler] Running pass, flatten +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87 = + case t_8_87 of + Leaf x_9_88 -> + let fltPkd_137 :: Int = x_9_88 - 2 in + (Leaf fltPkd_137) + Node x1_10_89 x2_11_90 -> + let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89) in + let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90) in + (Node fltPkd_138 fltPkd_139) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95 = + case t_16_95 of + Leaf x_17_96 -> + let fltPkd_140 :: Int = x_17_96 + 1 in + (Leaf fltPkd_140) + Node x1_18_97 x2_19_98 -> + let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97) in + let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98) in + (Node fltPkd_141 fltPkd_142) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99 = + case arg_52_99 of + Leaf x_53_100 -> + let y_54_101 :: Int = x_53_100 in + (Leaf y_54_101) + Node x_55_102 x_56_103 -> + let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in + let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in + (Node y_57_104 y_58_105) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = + case arg_59_106 of + Leaf x_60_107 -> + let y_61_108 :: Int = x_60_107 in + (Leaf y_61_108) + Node x_62_109 x_63_110 -> + let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in + let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in + (Node y_64_111 y_65_112) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113 = + case arg_66_113 of + Leaf x_67_114 -> + () + Node x_69_115 x_70_116 -> + let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in + let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119 = + case arg_73_119 of + Leaf x_74_120 -> + let wildcard_76_121 :: () = printsym("(Leaf") in + let wildcard_78_122 :: () = printsym(" ") in + let y_75_123 :: () = printint(x_74_120) in + let wildcard_77_124 :: () = printsym(")") in + () + Node x_79_125 x_80_126 -> + let wildcard_83_127 :: () = printsym("(Node") in + let wildcard_86_128 :: () = printsym(" ") in + let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in + let wildcard_85_130 :: () = printsym(" ") in + let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in + let wildcard_84_132 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in + let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134) in + (Addone_add_7 [] fltAppE_133) + + [compiler] Running pass, simplify +Removed unused functions: [] +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + let y_54_101_163 :: Int = x_53_100_162 in + (Leaf y_54_101_163) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + let y_61_108_170 :: Int = x_60_107_169 in + (Leaf y_61_108_170) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, inlineTriv +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in + let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in + let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, directL3 +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + (Addone_add_7 [] fltAppE_133_146) + + [compiler] Running pass, unariser +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, L3.flatten +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, L3.typecheck +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_5 :: Cursor -> Cursor +Addtwo_sub_5 t_8_87_147 = + case t_8_87_147 of + Leaf x_9_88_148 -> + let fltPkd_137_149 :: Int = x_9_88_148 - 2 in + (Leaf fltPkd_137_149) + Node x1_10_89_150 x2_11_90_151 -> + let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in + let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in + (Node fltPkd_138_152 fltPkd_139_153) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: Cursor -> Cursor +Addone_add_7 t_16_95_154 = + case t_16_95_154 of + Leaf x_17_96_155 -> + let fltPkd_140_156 :: Int = x_17_96_155 + 1 in + (Leaf fltPkd_140_156) + Node x1_18_97_157 x2_19_98_158 -> + let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in + let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in + (Node fltPkd_141_159 fltPkd_142_160) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_4 :: Cursor -> Cursor +_copy_AddTree_Tree_4 arg_52_99_161 = + case arg_52_99_161 of + Leaf x_53_100_162 -> + (Leaf x_53_100_162) + Node x_55_102_164 x_56_103_165 -> + let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in + let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in + (Node y_57_104_166 y_58_105_167) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = + case arg_59_106_168 of + Leaf x_60_107_169 -> + (Leaf x_60_107_169) + Node x_62_109_171 x_63_110_172 -> + let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in + let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in + (Node y_64_111_173 y_65_112_174) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_4 :: Cursor -> () +_traverse_AddTree_Tree_4 arg_66_113_175 = + case arg_66_113_175 of + Leaf x_67_114_176 -> + () + Node x_69_115_177 x_70_116_178 -> + let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in + let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_4 :: Cursor -> () +_print_AddTree_Tree_4 arg_73_119_181 = + case arg_73_119_181 of + Leaf x_74_120_182 -> + let wildcard_76_121_183 :: () = printsym("(Leaf") in + let wildcard_78_122_184 :: () = printsym(" ") in + let y_75_123_185 :: () = printint(x_74_120_182) in + let wildcard_77_124_186 :: () = printsym(")") in + () + Node x_79_125_187 x_80_126_188 -> + let wildcard_83_127_189 :: () = printsym("(Node") in + let wildcard_86_128_190 :: () = printsym(" ") in + let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in + let wildcard_85_130_192 :: () = printsym(" ") in + let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in + let wildcard_84_132_194 :: () = printsym(")") in + () + +gibbon_main :: (Packed AddTree_Tree_4) +gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in + let fltPkd_136_144 :: Cursor = (Leaf 2) in + let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in + let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in + let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in + tmp_app_195 + + [compiler] Running pass, lower +Pass output: +================================================================================ +Prog {infoTable = [("AddTree_Tree_4", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], + fundefs = [FunDecl {funName = "Addtwo_sub_5", + funArgs = [(t_8_87_147, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") + (IntAlts [(0, + LetUnpackT {binds = [(x_9_88_148, + IntTy)], + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, + IntTy)], + prim = SubP, + rands = [VarTriv "x_9_88_148", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_202", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), + (1, + LetUnpackT {binds = [(x1_10_89_150, + CursorTy), + (x2_11_90_151, + CursorTy)], + ptr = "tail_201", + bod = LetCallT {async = False, + binds = [(fltPkd_138_152, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x1_10_89_150"], + bod = LetCallT {async = False, + binds = [(fltPkd_139_153, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_138_152"), + (CursorTy, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, + isPure = True}, + FunDecl {funName = "Addone_add_7", + funArgs = [(t_16_95_154, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_16_95_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_96_155, + IntTy)], + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, + IntTy)], + prim = AddP, + rands = [VarTriv "x_17_96_155", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_207", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), + (1, + LetUnpackT {binds = [(x1_18_97_157, + CursorTy), + (x2_19_98_158, + CursorTy)], + ptr = "tail_206", + bod = LetCallT {async = False, + binds = [(fltPkd_141_159, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x1_18_97_157"], + bod = LetCallT {async = False, + binds = [(fltPkd_142_160, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x2_19_98_158"], + bod = LetAllocT {lhs = "tailift_208", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_141_159"), + (CursorTy, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_52_99_161, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") + (IntAlts [(0, + LetUnpackT {binds = [(x_53_100_162, + IntTy)], + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), + (1, + LetUnpackT {binds = [(x_55_102_164, + CursorTy), + (x_56_103_165, + CursorTy)], + ptr = "tail_211", + bod = LetCallT {async = False, + binds = [(y_57_104_166, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_55_102_164"], + bod = LetCallT {async = False, + binds = [(y_58_105_167, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_57_104_166"), + (CursorTy, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_59_106_168, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") + (IntAlts [(0, + LetUnpackT {binds = [(x_60_107_169, + IntTy)], + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), + (1, + LetUnpackT {binds = [(x_62_109_171, + CursorTy), + (x_63_110_172, + CursorTy)], + ptr = "tail_216", + bod = LetCallT {async = False, + binds = [(y_64_111_173, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_62_109_171"], + bod = LetCallT {async = False, + binds = [(y_65_112_174, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_64_111_173"), + (CursorTy, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, + isPure = True}, + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_66_113_175, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") + (IntAlts [(0, + LetUnpackT {binds = [(x_67_114_176, + IntTy)], + ptr = "tail_221", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_69_115_177, + CursorTy), + (x_70_116_178, + CursorTy)], + ptr = "tail_221", + bod = LetCallT {async = False, + binds = [(y_71_117_179, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_69_115_177"], + bod = LetCallT {async = False, + binds = [(y_72_118_180, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_70_116_178"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_220")}, + isPure = True}, + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_73_119_181, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") + (IntAlts [(0, + LetUnpackT {binds = [(x_74_120_182, + IntTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_79_125_187, + CursorTy), + (x_80_126_188, + CursorTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_81_129_191, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_82_131_193, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_223")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_135_143", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_136_144", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_134_145", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_135_143"), + (CursorTy, + VarTriv "fltPkd_136_144")], + bod = LetCallT {async = False, + binds = [(fltAppE_133_146, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "fltAppE_134_145"], + bod = LetCallT {async = False, + binds = [(tmp_app_195, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "fltAppE_133_146"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_195"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Running pass, lateInlineTriv +Pass output: +================================================================================ +Prog {infoTable = [("AddTree_Tree_4", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], + fundefs = [FunDecl {funName = "Addtwo_sub_5", + funArgs = [(t_8_87_147, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") + (IntAlts [(0, + LetUnpackT {binds = [(x_9_88_148, + IntTy)], + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, + IntTy)], + prim = SubP, + rands = [VarTriv "x_9_88_148", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_202", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), + (1, + LetUnpackT {binds = [(x1_10_89_150, + CursorTy), + (x2_11_90_151, + CursorTy)], + ptr = "tail_201", + bod = LetCallT {async = False, + binds = [(fltPkd_138_152, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x1_10_89_150"], + bod = LetCallT {async = False, + binds = [(fltPkd_139_153, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_138_152"), + (CursorTy, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, + isPure = True}, + FunDecl {funName = "Addone_add_7", + funArgs = [(t_16_95_154, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_16_95_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_96_155, + IntTy)], + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, + IntTy)], + prim = AddP, + rands = [VarTriv "x_17_96_155", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_207", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), + (1, + LetUnpackT {binds = [(x1_18_97_157, + CursorTy), + (x2_19_98_158, + CursorTy)], + ptr = "tail_206", + bod = LetCallT {async = False, + binds = [(fltPkd_141_159, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x1_18_97_157"], + bod = LetCallT {async = False, + binds = [(fltPkd_142_160, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x2_19_98_158"], + bod = LetAllocT {lhs = "tailift_208", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_141_159"), + (CursorTy, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_52_99_161, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") + (IntAlts [(0, + LetUnpackT {binds = [(x_53_100_162, + IntTy)], + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), + (1, + LetUnpackT {binds = [(x_55_102_164, + CursorTy), + (x_56_103_165, + CursorTy)], + ptr = "tail_211", + bod = LetCallT {async = False, + binds = [(y_57_104_166, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_55_102_164"], + bod = LetCallT {async = False, + binds = [(y_58_105_167, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_57_104_166"), + (CursorTy, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_59_106_168, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") + (IntAlts [(0, + LetUnpackT {binds = [(x_60_107_169, + IntTy)], + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), + (1, + LetUnpackT {binds = [(x_62_109_171, + CursorTy), + (x_63_110_172, + CursorTy)], + ptr = "tail_216", + bod = LetCallT {async = False, + binds = [(y_64_111_173, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_62_109_171"], + bod = LetCallT {async = False, + binds = [(y_65_112_174, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_64_111_173"), + (CursorTy, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, + isPure = True}, + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_66_113_175, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") + (IntAlts [(0, + LetUnpackT {binds = [(x_67_114_176, + IntTy)], + ptr = "tail_221", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_69_115_177, + CursorTy), + (x_70_116_178, + CursorTy)], + ptr = "tail_221", + bod = LetCallT {async = False, + binds = [(y_71_117_179, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_69_115_177"], + bod = LetCallT {async = False, + binds = [(y_72_118_180, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_70_116_178"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_220")}, + isPure = True}, + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_73_119_181, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") + (IntAlts [(0, + LetUnpackT {binds = [(x_74_120_182, + IntTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_79_125_187, + CursorTy), + (x_80_126_188, + CursorTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_81_129_191, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_82_131_193, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_223")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_135_143", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_136_144", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_134_145", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_135_143"), + (CursorTy, + VarTriv "fltPkd_136_144")], + bod = LetCallT {async = False, + binds = [(fltAppE_133_146, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "fltAppE_134_145"], + bod = LetCallT {async = False, + binds = [(tmp_app_195, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "fltAppE_133_146"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_195"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Running pass, rearrangeFree +Pass output: +================================================================================ +Prog {infoTable = [("AddTree_Tree_4", + [("Leaf", + DataConInfo {dcon_tag = 0, + scalar_bytes = 8, + num_shortcut = 0, + num_scalars = 1, + num_packed = 0, + field_tys = [IntTy]}), + ("Node", + DataConInfo {dcon_tag = 1, + scalar_bytes = 0, + num_shortcut = 2, + num_scalars = 0, + num_packed = 0, + field_tys = [CursorTy,CursorTy]})])], + symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), + (199, " ")], + fundefs = [FunDecl {funName = "Addtwo_sub_5", + funArgs = [(t_8_87_147, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), + (tail_201, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_8_87_147"], + bod = Switch "switch_204" + (VarTriv "tag_200") + (IntAlts [(0, + LetUnpackT {binds = [(x_9_88_148, + IntTy)], + ptr = "tail_201", + bod = LetPrimCallT {binds = [(fltPkd_137_149, + IntTy)], + prim = SubP, + rands = [VarTriv "x_9_88_148", + IntTriv 2], + bod = LetAllocT {lhs = "tailift_202", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_137_149")], + bod = RetValsT [VarTriv "tailift_202"]}}}), + (1, + LetUnpackT {binds = [(x1_10_89_150, + CursorTy), + (x2_11_90_151, + CursorTy)], + ptr = "tail_201", + bod = LetCallT {async = False, + binds = [(fltPkd_138_152, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x1_10_89_150"], + bod = LetCallT {async = False, + binds = [(fltPkd_139_153, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "x2_11_90_151"], + bod = LetAllocT {lhs = "tailift_203", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_138_152"), + (CursorTy, + VarTriv "fltPkd_139_153")], + bod = RetValsT [VarTriv "tailift_203"]}}}})]) + (Just ErrT "Unknown tag in: tag_200")}, + isPure = True}, + FunDecl {funName = "Addone_add_7", + funArgs = [(t_16_95_154, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), + (tail_206, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "t_16_95_154"], + bod = Switch "switch_209" + (VarTriv "tag_205") + (IntAlts [(0, + LetUnpackT {binds = [(x_17_96_155, + IntTy)], + ptr = "tail_206", + bod = LetPrimCallT {binds = [(fltPkd_140_156, + IntTy)], + prim = AddP, + rands = [VarTriv "x_17_96_155", + IntTriv 1], + bod = LetAllocT {lhs = "tailift_207", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "fltPkd_140_156")], + bod = RetValsT [VarTriv "tailift_207"]}}}), + (1, + LetUnpackT {binds = [(x1_18_97_157, + CursorTy), + (x2_19_98_158, + CursorTy)], + ptr = "tail_206", + bod = LetCallT {async = False, + binds = [(fltPkd_141_159, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x1_18_97_157"], + bod = LetCallT {async = False, + binds = [(fltPkd_142_160, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "x2_19_98_158"], + bod = LetAllocT {lhs = "tailift_208", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_141_159"), + (CursorTy, + VarTriv "fltPkd_142_160")], + bod = RetValsT [VarTriv "tailift_208"]}}}})]) + (Just ErrT "Unknown tag in: tag_205")}, + isPure = True}, + FunDecl {funName = "_copy_AddTree_Tree_4", + funArgs = [(arg_52_99_161, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), + (tail_211, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_52_99_161"], + bod = Switch "switch_214" + (VarTriv "tag_210") + (IntAlts [(0, + LetUnpackT {binds = [(x_53_100_162, + IntTy)], + ptr = "tail_211", + bod = LetAllocT {lhs = "tailift_212", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_53_100_162")], + bod = RetValsT [VarTriv "tailift_212"]}}), + (1, + LetUnpackT {binds = [(x_55_102_164, + CursorTy), + (x_56_103_165, + CursorTy)], + ptr = "tail_211", + bod = LetCallT {async = False, + binds = [(y_57_104_166, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_55_102_164"], + bod = LetCallT {async = False, + binds = [(y_58_105_167, + CursorTy)], + rator = "_copy_AddTree_Tree_4", + rands = [VarTriv "x_56_103_165"], + bod = LetAllocT {lhs = "tailift_213", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_57_104_166"), + (CursorTy, + VarTriv "y_58_105_167")], + bod = RetValsT [VarTriv "tailift_213"]}}}})]) + (Just ErrT "Unknown tag in: tag_210")}, + isPure = True}, + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", + funArgs = [(arg_59_106_168, CursorTy)], + funRetTy = CursorTy, + funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), + (tail_216, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_59_106_168"], + bod = Switch "switch_219" + (VarTriv "tag_215") + (IntAlts [(0, + LetUnpackT {binds = [(x_60_107_169, + IntTy)], + ptr = "tail_216", + bod = LetAllocT {lhs = "tailift_217", + vals = [(IntTy, + IntTriv 0), + (IntTy, + VarTriv "x_60_107_169")], + bod = RetValsT [VarTriv "tailift_217"]}}), + (1, + LetUnpackT {binds = [(x_62_109_171, + CursorTy), + (x_63_110_172, + CursorTy)], + ptr = "tail_216", + bod = LetCallT {async = False, + binds = [(y_64_111_173, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_62_109_171"], + bod = LetCallT {async = False, + binds = [(y_65_112_174, + CursorTy)], + rator = "_copy_without_ptrs_AddTree_Tree_4", + rands = [VarTriv "x_63_110_172"], + bod = LetAllocT {lhs = "tailift_218", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "y_64_111_173"), + (CursorTy, + VarTriv "y_65_112_174")], + bod = RetValsT [VarTriv "tailift_218"]}}}})]) + (Just ErrT "Unknown tag in: tag_215")}, + isPure = True}, + FunDecl {funName = "_traverse_AddTree_Tree_4", + funArgs = [(arg_66_113_175, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), + (tail_221, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_66_113_175"], + bod = Switch "switch_222" + (VarTriv "tag_220") + (IntAlts [(0, + LetUnpackT {binds = [(x_67_114_176, + IntTy)], + ptr = "tail_221", + bod = RetValsT []}), + (1, + LetUnpackT {binds = [(x_69_115_177, + CursorTy), + (x_70_116_178, + CursorTy)], + ptr = "tail_221", + bod = LetCallT {async = False, + binds = [(y_71_117_179, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_69_115_177"], + bod = LetCallT {async = False, + binds = [(y_72_118_180, + ProdTy [])], + rator = "_traverse_AddTree_Tree_4", + rands = [VarTriv "x_70_116_178"], + bod = RetValsT []}}})]) + (Just ErrT "Unknown tag in: tag_220")}, + isPure = True}, + FunDecl {funName = "_print_AddTree_Tree_4", + funArgs = [(arg_73_119_181, CursorTy)], + funRetTy = ProdTy [], + funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), + (tail_224, CursorTy)], + prim = ReadScalar IntS, + rands = [VarTriv "arg_73_119_181"], + bod = Switch "switch_225" + (VarTriv "tag_223") + (IntAlts [(0, + LetUnpackT {binds = [(x_74_120_182, + IntTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 198], + bod = LetPrimCallT {binds = [(wildcard_78_122_184, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetPrimCallT {binds = [(y_75_123_185, + ProdTy [])], + prim = PrintInt, + rands = [VarTriv "x_74_120_182"], + bod = LetPrimCallT {binds = [(wildcard_77_124_186, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}), + (1, + LetUnpackT {binds = [(x_79_125_187, + CursorTy), + (x_80_126_188, + CursorTy)], + ptr = "tail_224", + bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 197], + bod = LetPrimCallT {binds = [(wildcard_86_128_190, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_81_129_191, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_79_125_187"], + bod = LetPrimCallT {binds = [(wildcard_85_130_192, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 199], + bod = LetCallT {async = False, + binds = [(y_82_131_193, + ProdTy [])], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "x_80_126_188"], + bod = LetPrimCallT {binds = [(wildcard_84_132_194, + ProdTy [])], + prim = PrintSym, + rands = [SymTriv 196], + bod = RetValsT []}}}}}}})]) + (Just ErrT "Unknown tag in: tag_223")}, + isPure = True}], + mainExp = Just PrintExp (LetAllocT + {lhs = "fltPkd_135_143", + vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], + bod = LetAllocT {lhs = "fltPkd_136_144", + vals = [(IntTy, IntTriv 0), + (IntTy, IntTriv 2)], + bod = LetAllocT {lhs = "fltAppE_134_145", + vals = [(IntTy, + IntTriv 1), + (CursorTy, + VarTriv "fltPkd_135_143"), + (CursorTy, + VarTriv "fltPkd_136_144")], + bod = LetCallT {async = False, + binds = [(fltAppE_133_146, + CursorTy)], + rator = "Addtwo_sub_5", + rands = [VarTriv "fltAppE_134_145"], + bod = LetCallT {async = False, + binds = [(tmp_app_195, + CursorTy)], + rator = "Addone_add_7", + rands = [VarTriv "fltAppE_133_146"], + bod = LetCallT {async = False, + binds = [], + rator = "_print_AddTree_Tree_4", + rands = [VarTriv "tmp_app_195"], + bod = LetPrimCallT {binds = [], + prim = PrintString "\n", + rands = [], + bod = RetValsT []}}}}}}})} + + [compiler] Final C codegen: 13391 characters. +================================================================================ +/* Gibbon program. */ + +#include "gibbon_rts.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef _WIN64 +#include +#endif + +#ifdef _GIBBON_POINTER +#include +#endif + +#ifdef _GIBBON_PARALLEL +#include +#include +#endif + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Program starts here + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +typedef struct GibIntProd_struct { + GibInt field0; + } GibIntProd; +typedef struct GibIntGibIntProd_struct { + GibInt field0; + GibInt field1; + } GibIntGibIntProd; +typedef struct GibIntGibCursorGibCursorProd_struct { + GibInt field0; + GibCursor field1; + GibCursor field2; + } GibIntGibCursorGibCursorProd; +typedef struct GibPackedTagGibCursorProd_struct { + GibPackedTag field0; + GibCursor field1; + } GibPackedTagGibCursorProd; +typedef struct GibCursorProd_struct { + GibCursor field0; + } GibCursorProd; +typedef struct GibCursorGibCursorProd_struct { + GibCursor field0; + GibCursor field1; + } GibCursorGibCursorProd; +GibCursor Addtwo_sub_5(GibCursor t_8_87_147); +GibCursor Addone_add_7(GibCursor t_16_95_154); +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); +typedef enum { + GibInt_T, + GibFloat_T, + GibSym_T, + GibBool_T, + GibVector_T, + GibList_T, + GibCursor_T, + AddTree_Tree_4_T, + } GibDatatype; +void info_table_initialize(void) +{ + int error = gib_info_table_initialize(8); + + if (error < 0) { + fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); + exit(1); + } + + GibDatatype field_tys[1]; + + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, AddTree_Tree_4_T, 0); + exit(1); + } + error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, + field_tys, 0); + if (error < 0) { + fprintf(stderr, + "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", + error, AddTree_Tree_4_T, 1); + exit(1); + } + gib_info_table_finalize(); +} +void symbol_table_initialize(void) +{ + gib_add_symbol(196, ")"); + gib_add_symbol(197, "(Node"); + gib_add_symbol(198, "(Leaf"); + gib_add_symbol(199, " "); +} +GibCursor Addtwo_sub_5(GibCursor t_8_87_147) +{ + GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; + GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); + + + switch_204: + ; + switch (tag_200) { + + case 0: + { + GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; + GibInt fltPkd_137_149 = x_9_88_148 - 2; + GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_202)->field0 = 0; + ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; + return tailift_202; + break; + } + + case 1: + { + GibCursor x1_10_89_150 = + ((GibCursorGibCursorProd *) tail_201)->field0; + GibCursor x2_11_90_151 = + ((GibCursorGibCursorProd *) tail_201)->field1; + GibCursor fltPkd_138_152 = Addtwo_sub_5(x1_10_89_150); + GibCursor fltPkd_139_153 = Addtwo_sub_5(x2_11_90_151); + GibPtr tailift_203 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = + fltPkd_138_152; + ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = + fltPkd_139_153; + return tailift_203; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_200"); + exit(1); + } + } +} +GibCursor Addone_add_7(GibCursor t_16_95_154) +{ + GibPackedTag tag_205 = *(GibPackedTag *) t_16_95_154; + GibCursor tail_206 = t_16_95_154 + sizeof(GibInt); + + + switch_209: + ; + switch (tag_205) { + + case 0: + { + GibInt x_17_96_155 = ((GibIntProd *) tail_206)->field0; + GibInt fltPkd_140_156 = x_17_96_155 + 1; + GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_207)->field0 = 0; + ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; + return tailift_207; + break; + } + + case 1: + { + GibCursor x1_18_97_157 = + ((GibCursorGibCursorProd *) tail_206)->field0; + GibCursor x2_19_98_158 = + ((GibCursorGibCursorProd *) tail_206)->field1; + GibCursor fltPkd_141_159 = Addone_add_7(x1_18_97_157); + GibCursor fltPkd_142_160 = Addone_add_7(x2_19_98_158); + GibPtr tailift_208 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = + fltPkd_141_159; + ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = + fltPkd_142_160; + return tailift_208; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_205"); + exit(1); + } + } +} +GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) +{ + GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; + GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); + + + switch_214: + ; + switch (tag_210) { + + case 0: + { + GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; + GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_212)->field0 = 0; + ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; + return tailift_212; + break; + } + + case 1: + { + GibCursor x_55_102_164 = + ((GibCursorGibCursorProd *) tail_211)->field0; + GibCursor x_56_103_165 = + ((GibCursorGibCursorProd *) tail_211)->field1; + GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); + GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); + GibPtr tailift_213 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = + y_57_104_166; + ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = + y_58_105_167; + return tailift_213; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_210"); + exit(1); + } + } +} +GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) +{ + GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; + GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); + + + switch_219: + ; + switch (tag_215) { + + case 0: + { + GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; + GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) tailift_217)->field0 = 0; + ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; + return tailift_217; + break; + } + + case 1: + { + GibCursor x_62_109_171 = + ((GibCursorGibCursorProd *) tail_216)->field0; + GibCursor x_63_110_172 = + ((GibCursorGibCursorProd *) tail_216)->field1; + GibCursor y_64_111_173 = + _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); + GibCursor y_65_112_174 = + _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); + GibPtr tailift_218 = + gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = + y_64_111_173; + ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = + y_65_112_174; + return tailift_218; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_215"); + exit(1); + } + } +} +unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) +{ + GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; + GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); + + + switch_222: + ; + switch (tag_220) { + + case 0: + { + GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; + + return 0; + break; + } + + case 1: + { + GibCursor x_69_115_177 = + ((GibCursorGibCursorProd *) tail_221)->field0; + GibCursor x_70_116_178 = + ((GibCursorGibCursorProd *) tail_221)->field1; + unsigned char y_71_117_179 = + _traverse_AddTree_Tree_4(x_69_115_177); + unsigned char y_72_118_180 = + _traverse_AddTree_Tree_4(x_70_116_178); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_220"); + exit(1); + } + } +} +unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) +{ + GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; + GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); + + + switch_225: + ; + switch (tag_223) { + + case 0: + { + GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; + unsigned char wildcard_76_121_183 = gib_print_symbol(198); + unsigned char wildcard_78_122_184 = gib_print_symbol(199); + unsigned char y_75_123_185 = printf("%ld", x_74_120_182); + unsigned char wildcard_77_124_186 = gib_print_symbol(196); + + return 0; + break; + } + + case 1: + { + GibCursor x_79_125_187 = + ((GibCursorGibCursorProd *) tail_224)->field0; + GibCursor x_80_126_188 = + ((GibCursorGibCursorProd *) tail_224)->field1; + unsigned char wildcard_83_127_189 = gib_print_symbol(197); + unsigned char wildcard_86_128_190 = gib_print_symbol(199); + unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); + unsigned char wildcard_85_130_192 = gib_print_symbol(199); + unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); + unsigned char wildcard_84_132_194 = gib_print_symbol(196); + + return 0; + break; + } + + default: + { + printf("%s\n", "Unknown tag in: tag_223"); + exit(1); + } + } +} +int main(int argc, char **argv) +{ + int init_0 = gib_init(argc, argv); + + info_table_initialize(); + symbol_table_initialize(); + + GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; + + GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); + + ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; + ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; + + GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); + + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; + ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; + + GibCursor fltAppE_133_146 = Addtwo_sub_5(fltAppE_134_145); + GibCursor tmp_app_195 = Addone_add_7(fltAppE_133_146); + + _print_AddTree_Tree_4(tmp_app_195); + printf("\n"); + return 0; + + int exit_1 = gib_exit(); + + return exit_1; +} + +Compiling RTS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 + +make: Nothing to be done for 'all'. + + + + +Compiling the program +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng + + + +In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: +/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] + #warning "Simple write barrier is disabled." + ^~~~~~~ + + +(Node (Leaf 0) (Leaf 1)) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 356e93a21..213d566e9 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -183,6 +183,35 @@ type TypeSynEnv = M.Map TyCon Ty0 -- ======================================================== +getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool, Maybe [Var]) +getImportMeta imports = do + let parseSpecs :: Maybe (H.ImportSpecList a)-> Maybe [Var] + parseSpecs maybeSpec = do + case maybeSpec of + Just (H.ImportSpecList _ _ specList) -> + Just $ map (\spec -> case spec of + H.IVar _ n -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + H.IAbs _ _ n -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + H.IThingAll _ n -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + H.IThingWith _ n _ -> case n of + Ident _ v -> toVar v + Symbol _ v -> toVar v + ) specList + Nothing -> Nothing + M.fromList $ map + (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased spec) -> + case aliased of + Just (H.ModuleName _ importAs) -> + ((toVar importName), ((toVar importAs), qualified, (parseSpecs spec))) + Nothing -> ((toVar importName), ((toVar importName), qualified, (parseSpecs spec))) + ) + imports -- ======================================================== @@ -204,6 +233,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports dbgPrintLn 2 $ "desugaring module: " ++ mod_name dbgPrintLn 2 $ "- imports: " ++ (show import_names) dbgPrintLn 2 $ "- aliases: " ++ (show aliases) + dbgPrintLn 2 $ "- imports: " ++ (show (getImportMeta imports)) imported_progs :: [PassM Prog0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports let prog = do @@ -439,10 +469,10 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} --when (isJust importAs) $ -- error $ -- "Module aliases not supported yet. Offending import: " ++ prettyPrint decl - when (isJust importSpecs) $ - error $ - "Selective imports not supported yet. Offending import: " ++ - prettyPrint decl + --when (isJust importSpecs) $ + -- error $ + -- "Selective imports not supported yet. Offending import: " ++ + -- prettyPrint decl (ParseState imported) <- readIORef pstate_ref mod_fp <- if mod_name `elem` stdlibModules diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 12b58ae9a..f01e22c71 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -29,17 +29,23 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- resolve aliases in imported functions let importMeta = getImportMeta imports let initImportedNames :: [(Var, (Var, Bool))] = [] - let applyImportMeta :: Var -> M.Map Var (Var, Bool) -> (Var, (Var, Bool)) - applyImportMeta v importMap = do + let applyImportMeta :: Var -> [(Var, (Var, Bool))] -> [(Var, (Var, Bool))] + applyImportMeta v acc = do let (mod, name) = parseOutMod v case mod of Just modName -> - case (M.lookup modName importMap) of - Just (alias, qual) -> (toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual)) + case (M.lookup modName importMeta) of + Just (alias, qual, specs) -> + case specs of + Just spec -> if (elem name spec) then acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] + else acc + Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] Nothing -> error $ "could not find module or alias: " ++ (show modName) Nothing -> error "how did we get here?" - let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs - let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs + let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (M.keys idefs))) initImportedNames imported_progs + let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (foldr applyImportMeta [] (M.keys ifuns))) initImportedNames imported_progs + --let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs + --let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs -- build def env let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (map (\v -> (v, False)) (M.keys defs))) @@ -75,13 +81,33 @@ fillImports (Prog defs funs main) localMod imports imported_progs = return $ Prog defs'' funs'' main' -getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool) +getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool, Maybe [Var]) getImportMeta imports = do + let parseSpecs :: Maybe (H.ImportSpecList a)-> Maybe [Var] + parseSpecs maybeSpec = do + case maybeSpec of + Just (H.ImportSpecList _ _ specList) -> + Just $ map (\spec -> case spec of + H.IVar _ n -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + H.IAbs _ _ n -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + H.IThingAll _ n -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + H.IThingWith _ n _ -> case n of + H.Ident _ v -> toVar v + H.Symbol _ v -> toVar v + ) specList + Nothing -> Nothing M.fromList $ map - (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased _) -> + (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased spec) -> case aliased of - Just (H.ModuleName _ importAs) -> ((toVar importName), ((toVar importAs), qualified)) - Nothing -> ((toVar importName), ((toVar importName), qualified)) + Just (H.ModuleName _ importAs) -> + ((toVar importName), ((toVar importAs), qualified, (parseSpecs spec))) + Nothing -> ((toVar importName), ((toVar importName), qualified, (parseSpecs spec))) ) imports From d42d2581d371e9caf9ad3b639e73a5f8b10595d0 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 29 Nov 2023 18:13:06 -0800 Subject: [PATCH 33/68] finished test cases --- gibbon-compiler/examples/AddTree.hs | 2 - gibbon-compiler/examples/Addone.hs | 10 - gibbon-compiler/examples/addimport.hs | 6 - gibbon-compiler/examples/imports/AddTree.hs | 8 + gibbon-compiler/examples/imports/Addone.hs | 15 + .../examples/{ => imports}/Addtwo.hs | 4 +- .../imports/AllThreeImportModifications.hs | 6 + .../examples/imports/ImportAliased.hs | 6 + .../examples/imports/ImportQualified.hs | 6 + .../imports/ImportQualifiedAndSpecified.hs | 6 + .../examples/imports/ImportSpecified.hs | 6 + .../examples/imports/import_tests.md | 9 + gibbon-compiler/examples/imports/ir.log | 282 ++ .../imports/{ => no-modifiers}/Bar.hs | 0 .../imports/{ => no-modifiers}/Baz.hs | 0 .../imports/{ => no-modifiers}/Foo.ans | 0 .../imports/{ => no-modifiers}/Foo.hs | 0 gibbon-compiler/gibbon.cabal | 1 + gibbon-compiler/ir.log | 4408 ++++++----------- gibbon-compiler/src/Gibbon/Compiler.hs | 4 +- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 2 +- .../src/Gibbon/Passes/FreshConstructors.hs | 131 + .../src/Gibbon/Passes/ModuleFillImports.hs | 99 +- .../src/Gibbon/Passes/ModuleRename.hs | 43 +- 24 files changed, 2177 insertions(+), 2877 deletions(-) delete mode 100644 gibbon-compiler/examples/AddTree.hs delete mode 100644 gibbon-compiler/examples/Addone.hs delete mode 100644 gibbon-compiler/examples/addimport.hs create mode 100644 gibbon-compiler/examples/imports/AddTree.hs create mode 100644 gibbon-compiler/examples/imports/Addone.hs rename gibbon-compiler/examples/{ => imports}/Addtwo.hs (81%) create mode 100644 gibbon-compiler/examples/imports/AllThreeImportModifications.hs create mode 100644 gibbon-compiler/examples/imports/ImportAliased.hs create mode 100644 gibbon-compiler/examples/imports/ImportQualified.hs create mode 100644 gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs create mode 100644 gibbon-compiler/examples/imports/ImportSpecified.hs create mode 100644 gibbon-compiler/examples/imports/import_tests.md create mode 100644 gibbon-compiler/examples/imports/ir.log rename gibbon-compiler/examples/imports/{ => no-modifiers}/Bar.hs (100%) rename gibbon-compiler/examples/imports/{ => no-modifiers}/Baz.hs (100%) rename gibbon-compiler/examples/imports/{ => no-modifiers}/Foo.ans (100%) rename gibbon-compiler/examples/imports/{ => no-modifiers}/Foo.hs (100%) create mode 100644 gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs diff --git a/gibbon-compiler/examples/AddTree.hs b/gibbon-compiler/examples/AddTree.hs deleted file mode 100644 index 1ac4ba955..000000000 --- a/gibbon-compiler/examples/AddTree.hs +++ /dev/null @@ -1,2 +0,0 @@ -module AddTree where - data Tree = Leaf Int | Node Tree Tree \ No newline at end of file diff --git a/gibbon-compiler/examples/Addone.hs b/gibbon-compiler/examples/Addone.hs deleted file mode 100644 index a32a620e5..000000000 --- a/gibbon-compiler/examples/Addone.hs +++ /dev/null @@ -1,10 +0,0 @@ -module Addone where - import AddTree - - add :: Tree -> Tree - add t = case t of - Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add x1) (add x2) - - main :: Tree - main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/addimport.hs b/gibbon-compiler/examples/addimport.hs deleted file mode 100644 index 7d874a369..000000000 --- a/gibbon-compiler/examples/addimport.hs +++ /dev/null @@ -1,6 +0,0 @@ -module AddImport where - import Addtwo (sub) - import Addone - import AddTree - - gibbon_main = add (sub (Node (Leaf 1) (Leaf 2))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/AddTree.hs b/gibbon-compiler/examples/imports/AddTree.hs new file mode 100644 index 000000000..4da208e66 --- /dev/null +++ b/gibbon-compiler/examples/imports/AddTree.hs @@ -0,0 +1,8 @@ +module AddTree where + data Tree = Leaf Int | Node Tree Tree + + sum :: Tree -> Int + sum t = + case t of + Leaf v -> v + Node l r -> (sum l) + (sum r) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/Addone.hs b/gibbon-compiler/examples/imports/Addone.hs new file mode 100644 index 000000000..c073e31d9 --- /dev/null +++ b/gibbon-compiler/examples/imports/Addone.hs @@ -0,0 +1,15 @@ +module Addone where + import AddTree + + add :: Tree -> Tree + add t = case t of + Leaf x -> Leaf (x + 1) + Node x1 x2 -> Node (add x1) (add x2) + + sub :: Tree -> Tree + sub t = case t of + Leaf x -> Leaf (x - 1) + Node x1 x2 -> Node (sub x1) (sub x2) + + gibbon_main :: Tree + gibbon_main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/Addtwo.hs b/gibbon-compiler/examples/imports/Addtwo.hs similarity index 81% rename from gibbon-compiler/examples/Addtwo.hs rename to gibbon-compiler/examples/imports/Addtwo.hs index 9056b48e1..9b022b537 100644 --- a/gibbon-compiler/examples/Addtwo.hs +++ b/gibbon-compiler/examples/imports/Addtwo.hs @@ -11,5 +11,5 @@ module Addtwo where Leaf x -> Leaf (x - 2) Node x1 x2 -> Node (sub x1) (sub x2) - main :: Tree - main = add (Node (Leaf 1) (Leaf 2)) + gibbon_main :: Tree + gibbon_main = add (Node (Leaf 1) (Leaf 2)) diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs new file mode 100644 index 000000000..37764a7f3 --- /dev/null +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs @@ -0,0 +1,6 @@ +module AllThreeImportModifications where + import qualified Addtwo as T (add) + import qualified Addone as O (add) + import AddTree as Tree (Node, Lead) + + gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportAliased.hs b/gibbon-compiler/examples/imports/ImportAliased.hs new file mode 100644 index 000000000..e976a39b8 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportAliased.hs @@ -0,0 +1,6 @@ +module ImportAliased where + import qualified Addtwo as T + import qualified Addone as O + import AddTree as Tree + + gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualified.hs b/gibbon-compiler/examples/imports/ImportQualified.hs new file mode 100644 index 000000000..7b1e36334 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualified.hs @@ -0,0 +1,6 @@ +module ImportQualified where + import qualified Addtwo + import qualified Addone + import AddTree + + gibbon_main = sum (Addtwo.add (Addone.add (Node (Leaf 1) (Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs new file mode 100644 index 000000000..61755a076 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.hs @@ -0,0 +1,6 @@ +module ImportQualifiedAndSpecified where + import qualified Addtwo (add) + import qualified Addone (sub) + import AddTree + + gibbon_main = sum (Addtwo.add (Addone.sub (Node (Leaf 1) (Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportSpecified.hs b/gibbon-compiler/examples/imports/ImportSpecified.hs new file mode 100644 index 000000000..735426c15 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportSpecified.hs @@ -0,0 +1,6 @@ +module ImportSpecified where + import Addtwo (add) + import Addone (sub) + import AddTree + + gibbon_main = sum (add (sub (Node (Leaf 1) (Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/import_tests.md b/gibbon-compiler/examples/imports/import_tests.md new file mode 100644 index 000000000..c1e3ea8bd --- /dev/null +++ b/gibbon-compiler/examples/imports/import_tests.md @@ -0,0 +1,9 @@ +# Import Features +- no modifiers +- qualified +- specified +- aliased +- qualified & specified +- qualified & aliased +- specified & aliased +- qualified & specified & aliased \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ir.log b/gibbon-compiler/examples/imports/ir.log new file mode 100644 index 000000000..db7db6b2e --- /dev/null +++ b/gibbon-compiler/examples/imports/ir.log @@ -0,0 +1,282 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 +================================================================================ + +desugaring module: ImportAliased + +- imports: ["Addtwo","Addone","AddTree"] + +- aliases: fromList [(Var "Addtwo",Var "T"),(Var "Addone",Var "O"),(Var "AddTree",Var "Tree")] + +- imports: fromList [(Var "Addtwo",(Var "T",True,Nothing)),(Var "Addone",(Var "O",True,Nothing)),(Var "AddTree",(Var "Tree",False,Nothing))] + +================================================================================ + +desugaring module: Addtwo + +- imports: ["AddTree"] + +- aliases: fromList [(Var "AddTree",Var "AddTree")] + +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + +================================================================================ + +desugaring module: AddTree + +- imports: [] + +- aliases: fromList [] + +- imports: fromList [] + +================================================================================ + +desugaring module: Addone + +- imports: ["AddTree"] + +- aliases: fromList [(Var "AddTree",Var "AddTree")] + +- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] + + [compiler] pipeline starting, parsed program: +================================================================================ +Prog {ddefs = [(AddTree.Tree, + DDef {tyName = "AddTree.Tree", + tyArgs = [], + dataCons = [("Leaf", [(False, IntTy)]), + ("Node", + [(False, PackedTy "AddTree.Tree" []), + (False, PackedTy "AddTree.Tree" [])])]})], + fundefs = [(Addtwo.add, + FunDef {funName = "Addtwo.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addtwo.add" [] [VarE "x1"], + AppE "Addtwo.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addtwo.sub, + FunDef {funName = "Addtwo.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 2]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addtwo.sub" [] [VarE "x1"], + AppE "Addtwo.sub" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addone.add, + FunDef {funName = "Addone.add", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $2)], + DataConE (MetaTv $1) + "Leaf" + [PrimAppE AddP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $4),(x2, MetaTv $5)], + DataConE (MetaTv $3) + "Node" + [AppE "Addone.add" [] [VarE "x1"], + AppE "Addone.add" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (Addone.sub, + FunDef {funName = "Addone.sub", + funArgs = [t], + funTy = ForAll [] + (ArrowTy [PackedTy "AddTree.Tree" []] + (PackedTy "AddTree.Tree" [])), + funBody = CaseE (VarE "t") + [("Leaf", + [(x, MetaTv $8)], + DataConE (MetaTv $7) + "Leaf" + [PrimAppE SubP [VarE "x",LitE 1]]), + ("Node", + [(x1, MetaTv $10),(x2, MetaTv $11)], + DataConE (MetaTv $9) + "Node" + [AppE "Addone.sub" [] [VarE "x1"], + AppE "Addone.sub" [] [VarE "x2"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (AddTree.sum, + FunDef {funName = "AddTree.sum", + funArgs = [t], + funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), + funBody = CaseE (VarE "t") + [("Leaf", [(v, MetaTv $1)], VarE "v"), + ("Node", + [(l, MetaTv $2),(r, MetaTv $3)], + PrimAppE AddP + [AppE "sum" [] [VarE "l"], + AppE "sum" [] [VarE "r"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (AppE "AddTree.sum" + [] + [AppE "Addtwo.add" + [] + [AppE "Addone.add" + [] + [DataConE (MetaTv $0) + "Tree.Node" + [DataConE (MetaTv $1) "Tree.Leaf" [LitE 1], + DataConE (MetaTv $2) "Tree.Leaf" [LitE 2]]]]], + MetaTv $3)} + + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_5 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 2) + Node x1::$4 x2::$5 -> + (Node $3 (Addtwo_add_5 [] x1) (Addtwo_add_5 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_6 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 2) + Node x1::$10 x2::$11 -> + (Node $9 (Addtwo_sub_6 [] x1) (Addtwo_sub_6 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t = + case t of + Leaf x::$2 -> + (Leaf $1 x + 1) + Node x1::$4 x2::$5 -> + (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_sub_8 t = + case t of + Leaf x::$8 -> + (Leaf $7 x - 1) + Node x1::$10 x2::$11 -> + (Node $9 (Addone_sub_8 [] x1) (Addone_sub_8 [] x2)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) +AddTree_sum_9 t = + case t of + Leaf v::$1 -> + v + Node l::$2 r::$3 -> + (sum [] l) + (sum [] r) + +gibbon_main :: $3 +gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) + + [compiler] Running pass, freshen +Pass output: +================================================================================ +data AddTree_Tree_4 = Leaf Int | + Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_add_5 t_10 = + case t_10 of + Leaf x_11::$2 -> + (Leaf $1 x_11 + 2) + Node x1_12::$4 x2_13::$5 -> + (Node $3 (Addtwo_add_5 [] x1_12) (Addtwo_add_5 [] x2_13)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addtwo_sub_6 t_14 = + case t_14 of + Leaf x_15::$8 -> + (Leaf $7 x_15 - 2) + Node x1_16::$10 x2_17::$11 -> + (Node $9 (Addtwo_sub_6 [] x1_16) (Addtwo_sub_6 [] x2_17)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_add_7 t_18 = + case t_18 of + Leaf x_19::$2 -> + (Leaf $1 x_19 + 1) + Node x1_20::$4 x2_21::$5 -> + (Node $3 (Addone_add_7 [] x1_20) (Addone_add_7 [] x2_21)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) +Addone_sub_8 t_22 = + case t_22 of + Leaf x_23::$8 -> + (Leaf $7 x_23 - 1) + Node x1_24::$10 x2_25::$11 -> + (Node $9 (Addone_sub_8 [] x1_24) (Addone_sub_8 [] x2_25)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) +AddTree_sum_9 t_26 = + case t_26 of + Leaf v_27::$1 -> + v_27 + Node l_28::$2 r_29::$3 -> + (sum [] l_28) + (sum [] r_29) + +gibbon_main :: $3 +gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) + + [compiler] Running pass, typecheck +gibbon: L0.Typecheck: + Unknown function: sum in Var "AddTree_sum_9" +CallStack (from HasCallStack): + error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/examples/imports/Bar.hs b/gibbon-compiler/examples/imports/no-modifiers/Bar.hs similarity index 100% rename from gibbon-compiler/examples/imports/Bar.hs rename to gibbon-compiler/examples/imports/no-modifiers/Bar.hs diff --git a/gibbon-compiler/examples/imports/Baz.hs b/gibbon-compiler/examples/imports/no-modifiers/Baz.hs similarity index 100% rename from gibbon-compiler/examples/imports/Baz.hs rename to gibbon-compiler/examples/imports/no-modifiers/Baz.hs diff --git a/gibbon-compiler/examples/imports/Foo.ans b/gibbon-compiler/examples/imports/no-modifiers/Foo.ans similarity index 100% rename from gibbon-compiler/examples/imports/Foo.ans rename to gibbon-compiler/examples/imports/no-modifiers/Foo.ans diff --git a/gibbon-compiler/examples/imports/Foo.hs b/gibbon-compiler/examples/imports/no-modifiers/Foo.hs similarity index 100% rename from gibbon-compiler/examples/imports/Foo.hs rename to gibbon-compiler/examples/imports/no-modifiers/Foo.hs diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index f7ca3373a..361ddc44b 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -59,6 +59,7 @@ library Gibbon.NewL2.FromOldL2 -- compiler passes, roughly in the order they're run + Gibbon.Passes.FreshConstructors Gibbon.Passes.ModuleRename Gibbon.Passes.ModuleFillImports Gibbon.Passes.Freshen diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index bfe86e8f7..d7325d4eb 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -2,26 +2,6 @@ ! We set DEBUG based on command-line verbose arg: 4 ================================================================================ -desugaring module: AddImport - -- imports: ["Addtwo","Addone","AddTree"] - -- aliases: fromList [(Var "Addtwo",Var "Addtwo"),(Var "Addone",Var "Addone"),(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "Addtwo",(Var "Addtwo",False,Just [Var "sub"])),(Var "Addone",(Var "Addone",False,Nothing)),(Var "AddTree",(Var "AddTree",False,Nothing))] - -================================================================================ - -desugaring module: Addtwo - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - -================================================================================ - desugaring module: AddTree - imports: [] @@ -30,3007 +10,1947 @@ desugaring module: AddTree - imports: fromList [] -================================================================================ - -desugaring module: Addone - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - [compiler] pipeline starting, parsed program: ================================================================================ Prog {ddefs = [(AddTree.Tree, DDef {tyName = "AddTree.Tree", tyArgs = [], - dataCons = [("Leaf", [(False, IntTy)]), - ("Node", + dataCons = [("AddTree.Leaf", [(False, IntTy)]), + ("AddTree.Node", [(False, PackedTy "AddTree.Tree" []), (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(Addtwo.sub, - FunDef {funName = "Addtwo.sub", + fundefs = [(AddTree.sum, + FunDef {funName = "AddTree.sum", funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), + funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addtwo.sub" [] [VarE "x1"], - AppE "Addtwo.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.add, - FunDef {funName = "Addtwo.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addtwo.add" [] [VarE "x1"], - AppE "Addtwo.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addone.add, - FunDef {funName = "Addone.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addone.add" [] [VarE "x1"], - AppE "Addone.add" [] [VarE "x2"]])], + [("AddTree.Leaf", [(v, MetaTv $1)], VarE "v"), + ("AddTree.Node", + [(l, MetaTv $2),(r, MetaTv $3)], + PrimAppE AddP + [AppE "AddTree.sum" [] [VarE "l"], + AppE "AddTree.sum" [] [VarE "r"]])], funMeta = FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "Addone.add" - [] - [AppE "Addtwo.sub" - [] - [DataConE (MetaTv $0) - "Node" - [DataConE (MetaTv $1) "Leaf" [LitE 1], - DataConE (MetaTv $2) "Leaf" [LitE 2]]]], - MetaTv $3)} + mainExp = Nothing} - [compiler] Running pass, renameModules + [compiler] Running pass, freshConstructors Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree.Tree = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree.Tree []) (Packed AddTree.Tree []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t = +AddTree.sum :: forall. ((Packed AddTree.Tree []) -> Int) +AddTree.sum t = case t of - Leaf x::$8 -> - (Leaf $7 x - 2) - Node x1::$10 x2::$11 -> - (Node $9 (Addtwo_sub_5 [] x1) (Addtwo_sub_5 [] x2)) + AddTree_Leaf_4 v::$1 -> + v + AddTree_Node_5 l::$2 r::$3 -> + (AddTree.sum [] l) + (AddTree.sum [] r) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 2) - Node x1::$4 x2::$5 -> - (Node $3 (Addtwo_add_6 [] x1) (Addtwo_add_6 [] x2)) + [compiler] Running pass, renameModules +Pass output: +================================================================================ +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t = case t of - Leaf x::$2 -> - (Leaf $1 x + 1) - Node x1::$4 x2::$5 -> - (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) + AddTree_Leaf_4 v::$1 -> + v + AddTree_Node_5 l::$2 r::$3 -> + (AddTree_sum_7 [] l) + (AddTree_sum_7 [] r) -gibbon_main :: $3 -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, freshen Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::$8 -> - (Leaf $7 x_9 - 2) - Node x1_10::$10 x2_11::$11 -> - (Node $9 (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::$2 -> - (Leaf $1 x_13 + 2) - Node x1_14::$4 x2_15::$5 -> - (Node $3 (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::$2 -> - (Leaf $1 x_17 + 1) - Node x1_18::$4 x2_19::$5 -> - (Node $3 (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + AddTree_Leaf_4 v_9::$1 -> + v_9 + AddTree_Node_5 l_10::$2 r_11::$3 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -gibbon_main :: $3 -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node $0 (Leaf $1 1) (Leaf $2 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, bindLambdas Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, monomorphize Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, specLambdas Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::Int -> - (Leaf () x_9 - 2) - Node x1_10::(Packed AddTree_Tree_4 []) x2_11::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::Int -> - (Leaf () x_13 + 2) - Node x1_14::(Packed AddTree_Tree_4 []) x2_15::(Packed AddTree_Tree_4 []) -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9::Int -> + v_9 + AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::Int -> - (Leaf () x_17 + 1) - Node x1_18::(Packed AddTree_Tree_4 []) x2_19::(Packed AddTree_Tree_4 []) -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, desugarL0 Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::() -> - (Leaf () x_9 - 2) - Node x1_10::() x2_11::() -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9::() -> + v_9 + AddTree_Node_5 l_10::() r_11::() -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21::() -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 () y_22) + AddTree_Node_5 x_23::() x_24::() -> + let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 () y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28::() -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 () y_29) + AddTree_Node_5 x_30::() x_31::() -> + let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 () y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35::() -> + () + AddTree_Node_5 x_37::() x_38::() -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42::() -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47::() x_48::() -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 + 1) - Node x1_18::() x2_19::() -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, floatOutCase Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9::() -> - (Leaf () x_9 - 2) - Node x1_10::() x2_11::() -> - (Node () (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) + AddTree_Leaf_4 v_9::() -> + v_9 + AddTree_Node_5 l_10::() r_11::() -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21::() -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 () y_22) + AddTree_Node_5 x_23::() x_24::() -> + let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 () y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28::() -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 () y_29) + AddTree_Node_5 x_30::() x_31::() -> + let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 () y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35::() -> + () + AddTree_Node_5 x_37::() x_38::() -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42::() -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47::() x_48::() -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13::() -> - (Leaf () x_13 + 2) - Node x1_14::() x2_15::() -> - (Node () (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17::() -> - (Leaf () x_17 + 1) - Node x1_18::() x2_19::() -> - (Node () (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53::() -> - let y_54 :: Int = x_53 in - (Leaf () y_54) - Node x_55::() x_56::() -> - let y_57 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4 []) = (_copy_AddTree_Tree_4 [] x_56) in - (Node () y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60::() -> - let y_61 :: Int = x_60 in - (Leaf () y_61) - Node x_62::() x_63::() -> - let y_64 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4 []) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node () y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67::() -> - () - Node x_69::() x_70::() -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: forall. ((Packed AddTree_Tree_4 []) -> ()) -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74::() -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79::() x_80::() -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4 []) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node () (Leaf () 1) (Leaf () 2)))) [compiler] Running pass, toL1 Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, benchMainExp Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) {meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8 = +AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int +AddTree_sum_7 t_8 = case t_8 of - Leaf x_9 -> - (Leaf x_9 - 2) - Node x1_10 x2_11 -> - (Node (Addtwo_sub_5 [] x1_10) (Addtwo_sub_5 [] x2_11)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_6 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_add_6 t_12 = - case t_12 of - Leaf x_13 -> - (Leaf x_13 + 2) - Node x1_14 x2_15 -> - (Node (Addtwo_add_6 [] x1_14) (Addtwo_add_6 [] x2_15)) + AddTree_Leaf_4 v_9 -> + v_9 + AddTree_Node_5 l_10 r_11 -> + (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20 = + case arg_20 of + AddTree_Leaf_4 x_21 -> + let y_22 :: Int = x_21 in + (AddTree_Leaf_4 y_22) + AddTree_Node_5 x_23 x_24 -> + let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in + let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in + (AddTree_Node_5 y_25 y_26) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27 = + case arg_27 of + AddTree_Leaf_4 x_28 -> + let y_29 :: Int = x_28 in + (AddTree_Leaf_4 y_29) + AddTree_Node_5 x_30 x_31 -> + let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in + let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in + (AddTree_Node_5 y_32 y_33) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34 = + case arg_34 of + AddTree_Leaf_4 x_35 -> + () + AddTree_Node_5 x_37 x_38 -> + let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in + let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41 = + case arg_41 of + AddTree_Leaf_4 x_42 -> + let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46 :: () = printsym(" ") in + let y_43 :: () = printint(x_42) in + let wildcard_45 :: () = printsym(")") in + () + AddTree_Node_5 x_47 x_48 -> + let wildcard_51 :: () = printsym("(AddTree_Node_5") in + let wildcard_54 :: () = printsym(" ") in + let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in + let wildcard_53 :: () = printsym(" ") in + let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in + let wildcard_52 :: () = printsym(")") in + () -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16 = - case t_16 of - Leaf x_17 -> - (Leaf x_17 + 1) - Node x1_18 x2_19 -> - (Node (Addone_add_7 [] x1_18) (Addone_add_7 [] x2_19)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52 = - case arg_52 of - Leaf x_53 -> - let y_54 :: Int = x_53 in - (Leaf y_54) - Node x_55 x_56 -> - let y_57 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55) in - let y_58 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56) in - (Node y_57 y_58) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59 = - case arg_59 of - Leaf x_60 -> - let y_61 :: Int = x_60 in - (Leaf y_61) - Node x_62 x_63 -> - let y_64 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62) in - let y_65 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63) in - (Node y_64 y_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66 = - case arg_66 of - Leaf x_67 -> - () - Node x_69 x_70 -> - let y_71 :: () = (_traverse_AddTree_Tree_4 [] x_69) in - let y_72 :: () = (_traverse_AddTree_Tree_4 [] x_70) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73 = - case arg_73 of - Leaf x_74 -> - let wildcard_76 :: () = printsym("(Leaf") in - let wildcard_78 :: () = printsym(" ") in - let y_75 :: () = printint(x_74) in - let wildcard_77 :: () = printsym(")") in - () - Node x_79 x_80 -> - let wildcard_83 :: () = printsym("(Node") in - let wildcard_86 :: () = printsym(" ") in - let y_81 :: () = (_print_AddTree_Tree_4 [] x_79) in - let wildcard_85 :: () = printsym(" ") in - let y_82 :: () = (_print_AddTree_Tree_4 [] x_80) in - let wildcard_84 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) [compiler] Running pass, simplify -Removed unused functions: [Var "Addtwo_add_6"] +Removed unused functions: [Var "AddTree_sum_7"] Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 - 2) - Node x1_10_89 x2_11_90 -> - (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95 = - case t_16_95 of - Leaf x_17_96 -> - (Leaf x_17_96 + 1) - Node x1_18_97 x2_19_98 -> - (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59 = + case arg_20_59 of + AddTree_Leaf_4 x_21_60 -> + let y_22_61 :: Int = x_21_60 in + (AddTree_Leaf_4 y_22_61) + AddTree_Node_5 x_23_62 x_24_63 -> + let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in + let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in + (AddTree_Node_5 y_25_64 y_26_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = + case arg_27_66 of + AddTree_Leaf_4 x_28_67 -> + let y_29_68 :: Int = x_28_67 in + (AddTree_Leaf_4 y_29_68) + AddTree_Node_5 x_30_69 x_31_70 -> + let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in + let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in + (AddTree_Node_5 y_32_71 y_33_72) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73 = + case arg_34_73 of + AddTree_Leaf_4 x_35_74 -> + () + AddTree_Node_5 x_37_75 x_38_76 -> + let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in + let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79 = + case arg_41_79 of + AddTree_Leaf_4 x_42_80 -> + let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82 :: () = printsym(" ") in + let y_43_83 :: () = printint(x_42_80) in + let wildcard_45_84 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85 x_48_86 -> + let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88 :: () = printsym(" ") in + let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in + let wildcard_53_90 :: () = printsym(" ") in + let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in + let wildcard_52_92 :: () = printsym(")") in + () + [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - (Leaf x_9_88 - 2) - Node x1_10_89 x2_11_90 -> - (Node (Addtwo_sub_5 [] x1_10_89) (Addtwo_sub_5 [] x2_11_90)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95 = - case t_16_95 of - Leaf x_17_96 -> - (Leaf x_17_96 + 1) - Node x1_18_97 x2_19_98 -> - (Node (Addone_add_7 [] x1_18_97) (Addone_add_7 [] x2_19_98)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = (Addone_add_7 [] (Addtwo_sub_5 [] (Node (Leaf 1) (Leaf 2)))) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59 = + case arg_20_59 of + AddTree_Leaf_4 x_21_60 -> + let y_22_61 :: Int = x_21_60 in + (AddTree_Leaf_4 y_22_61) + AddTree_Node_5 x_23_62 x_24_63 -> + let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in + let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in + (AddTree_Node_5 y_25_64 y_26_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = + case arg_27_66 of + AddTree_Leaf_4 x_28_67 -> + let y_29_68 :: Int = x_28_67 in + (AddTree_Leaf_4 y_29_68) + AddTree_Node_5 x_30_69 x_31_70 -> + let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in + let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in + (AddTree_Node_5 y_32_71 y_33_72) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73 = + case arg_34_73 of + AddTree_Leaf_4 x_35_74 -> + () + AddTree_Node_5 x_37_75 x_38_76 -> + let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in + let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79 = + case arg_41_79 of + AddTree_Leaf_4 x_42_80 -> + let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82 :: () = printsym(" ") in + let y_43_83 :: () = printint(x_42_80) in + let wildcard_45_84 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85 x_48_86 -> + let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88 :: () = printsym(" ") in + let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in + let wildcard_53_90 :: () = printsym(" ") in + let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in + let wildcard_52_92 :: () = printsym(")") in + () + [compiler] Running pass, flatten Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87 = - case t_8_87 of - Leaf x_9_88 -> - let fltPkd_137 :: Int = x_9_88 - 2 in - (Leaf fltPkd_137) - Node x1_10_89 x2_11_90 -> - let fltPkd_138 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89) in - let fltPkd_139 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90) in - (Node fltPkd_138 fltPkd_139) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95 = - case t_16_95 of - Leaf x_17_96 -> - let fltPkd_140 :: Int = x_17_96 + 1 in - (Leaf fltPkd_140) - Node x1_18_97 x2_19_98 -> - let fltPkd_141 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97) in - let fltPkd_142 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98) in - (Node fltPkd_141 fltPkd_142) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99 = - case arg_52_99 of - Leaf x_53_100 -> - let y_54_101 :: Int = x_53_100 in - (Leaf y_54_101) - Node x_55_102 x_56_103 -> - let y_57_104 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102) in - let y_58_105 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103) in - (Node y_57_104 y_58_105) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106 = - case arg_59_106 of - Leaf x_60_107 -> - let y_61_108 :: Int = x_60_107 in - (Leaf y_61_108) - Node x_62_109 x_63_110 -> - let y_64_111 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109) in - let y_65_112 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110) in - (Node y_64_111 y_65_112) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113 = - case arg_66_113 of - Leaf x_67_114 -> - () - Node x_69_115 x_70_116 -> - let y_71_117 :: () = (_traverse_AddTree_Tree_4 [] x_69_115) in - let y_72_118 :: () = (_traverse_AddTree_Tree_4 [] x_70_116) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119 = - case arg_73_119 of - Leaf x_74_120 -> - let wildcard_76_121 :: () = printsym("(Leaf") in - let wildcard_78_122 :: () = printsym(" ") in - let y_75_123 :: () = printint(x_74_120) in - let wildcard_77_124 :: () = printsym(")") in - () - Node x_79_125 x_80_126 -> - let wildcard_83_127 :: () = printsym("(Node") in - let wildcard_86_128 :: () = printsym(" ") in - let y_81_129 :: () = (_print_AddTree_Tree_4 [] x_79_125) in - let wildcard_85_130 :: () = printsym(" ") in - let y_82_131 :: () = (_print_AddTree_Tree_4 [] x_80_126) in - let wildcard_84_132 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134 :: (Packed AddTree_Tree_4) = (Node fltPkd_135 fltPkd_136) in - let fltAppE_133 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134) in - (Addone_add_7 [] fltAppE_133) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59 = + case arg_20_59 of + AddTree_Leaf_4 x_21_60 -> + let y_22_61 :: Int = x_21_60 in + (AddTree_Leaf_4 y_22_61) + AddTree_Node_5 x_23_62 x_24_63 -> + let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in + let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in + (AddTree_Node_5 y_25_64 y_26_65) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = + case arg_27_66 of + AddTree_Leaf_4 x_28_67 -> + let y_29_68 :: Int = x_28_67 in + (AddTree_Leaf_4 y_29_68) + AddTree_Node_5 x_30_69 x_31_70 -> + let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in + let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in + (AddTree_Node_5 y_32_71 y_33_72) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73 = + case arg_34_73 of + AddTree_Leaf_4 x_35_74 -> + () + AddTree_Node_5 x_37_75 x_38_76 -> + let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in + let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79 = + case arg_41_79 of + AddTree_Leaf_4 x_42_80 -> + let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82 :: () = printsym(" ") in + let y_43_83 :: () = printint(x_42_80) in + let wildcard_45_84 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85 x_48_86 -> + let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88 :: () = printsym(" ") in + let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in + let wildcard_53_90 :: () = printsym(" ") in + let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in + let wildcard_52_92 :: () = printsym(")") in + () + [compiler] Running pass, simplify Removed unused functions: [] Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - let y_54_101_163 :: Int = x_53_100_162 in - (Leaf y_54_101_163) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - let y_61_108_170 :: Int = x_60_107_169 in - (Leaf y_61_108_170) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + let y_22_61_95 :: Int = x_21_60_94 in + (AddTree_Leaf_4 y_22_61_95) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + let y_29_68_102 :: Int = x_28_67_101 in + (AddTree_Leaf_4 y_29_68_102) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, inlineTriv Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4) (Packed AddTree_Tree_4) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: (Packed AddTree_Tree_4) = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: (Packed AddTree_Tree_4) = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> (Packed AddTree_Tree_4) -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: (Packed AddTree_Tree_4) = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: (Packed AddTree_Tree_4) -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: (Packed AddTree_Tree_4) = (Leaf 1) in - let fltPkd_136_144 :: (Packed AddTree_Tree_4) = (Leaf 2) in - let fltAppE_134_145 :: (Packed AddTree_Tree_4) = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: (Packed AddTree_Tree_4) = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, directL3 Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - (Addone_add_7 [] fltAppE_133_146) +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, unariser Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.flatten Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, L3.typecheck Pass output: ================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_5 :: Cursor -> Cursor -Addtwo_sub_5 t_8_87_147 = - case t_8_87_147 of - Leaf x_9_88_148 -> - let fltPkd_137_149 :: Int = x_9_88_148 - 2 in - (Leaf fltPkd_137_149) - Node x1_10_89_150 x2_11_90_151 -> - let fltPkd_138_152 :: Cursor = (Addtwo_sub_5 [] x1_10_89_150) in - let fltPkd_139_153 :: Cursor = (Addtwo_sub_5 [] x2_11_90_151) in - (Node fltPkd_138_152 fltPkd_139_153) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: Cursor -> Cursor -Addone_add_7 t_16_95_154 = - case t_16_95_154 of - Leaf x_17_96_155 -> - let fltPkd_140_156 :: Int = x_17_96_155 + 1 in - (Leaf fltPkd_140_156) - Node x1_18_97_157 x2_19_98_158 -> - let fltPkd_141_159 :: Cursor = (Addone_add_7 [] x1_18_97_157) in - let fltPkd_142_160 :: Cursor = (Addone_add_7 [] x2_19_98_158) in - (Node fltPkd_141_159 fltPkd_142_160) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_4 :: Cursor -> Cursor -_copy_AddTree_Tree_4 arg_52_99_161 = - case arg_52_99_161 of - Leaf x_53_100_162 -> - (Leaf x_53_100_162) - Node x_55_102_164 x_56_103_165 -> - let y_57_104_166 :: Cursor = (_copy_AddTree_Tree_4 [] x_55_102_164) in - let y_58_105_167 :: Cursor = (_copy_AddTree_Tree_4 [] x_56_103_165) in - (Node y_57_104_166 y_58_105_167) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_4 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_4 arg_59_106_168 = - case arg_59_106_168 of - Leaf x_60_107_169 -> - (Leaf x_60_107_169) - Node x_62_109_171 x_63_110_172 -> - let y_64_111_173 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_62_109_171) in - let y_65_112_174 :: Cursor = (_copy_without_ptrs_AddTree_Tree_4 [] x_63_110_172) in - (Node y_64_111_173 y_65_112_174) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_4 :: Cursor -> () -_traverse_AddTree_Tree_4 arg_66_113_175 = - case arg_66_113_175 of - Leaf x_67_114_176 -> - () - Node x_69_115_177 x_70_116_178 -> - let y_71_117_179 :: () = (_traverse_AddTree_Tree_4 [] x_69_115_177) in - let y_72_118_180 :: () = (_traverse_AddTree_Tree_4 [] x_70_116_178) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_4 :: Cursor -> () -_print_AddTree_Tree_4 arg_73_119_181 = - case arg_73_119_181 of - Leaf x_74_120_182 -> - let wildcard_76_121_183 :: () = printsym("(Leaf") in - let wildcard_78_122_184 :: () = printsym(" ") in - let y_75_123_185 :: () = printint(x_74_120_182) in - let wildcard_77_124_186 :: () = printsym(")") in - () - Node x_79_125_187 x_80_126_188 -> - let wildcard_83_127_189 :: () = printsym("(Node") in - let wildcard_86_128_190 :: () = printsym(" ") in - let y_81_129_191 :: () = (_print_AddTree_Tree_4 [] x_79_125_187) in - let wildcard_85_130_192 :: () = printsym(" ") in - let y_82_131_193 :: () = (_print_AddTree_Tree_4 [] x_80_126_188) in - let wildcard_84_132_194 :: () = printsym(")") in - () - -gibbon_main :: (Packed AddTree_Tree_4) -gibbon_main = let fltPkd_135_143 :: Cursor = (Leaf 1) in - let fltPkd_136_144 :: Cursor = (Leaf 2) in - let fltAppE_134_145 :: Cursor = (Node fltPkd_135_143 fltPkd_136_144) in - let fltAppE_133_146 :: Cursor = (Addtwo_sub_5 [] fltAppE_134_145) in - let tmp_app_195 :: Cursor = (Addone_add_7 [] fltAppE_133_146) in - tmp_app_195 +data AddTree_Tree_6 = AddTree_Leaf_4 Int | + AddTree_Node_5 Cursor Cursor +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_AddTree_Tree_6 :: Cursor -> Cursor +_copy_AddTree_Tree_6 arg_20_59_93 = + case arg_20_59_93 of + AddTree_Leaf_4 x_21_60_94 -> + (AddTree_Leaf_4 x_21_60_94) + AddTree_Node_5 x_23_62_96 x_24_63_97 -> + let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in + let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in + (AddTree_Node_5 y_25_64_98 y_26_65_99) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor +_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = + case arg_27_66_100 of + AddTree_Leaf_4 x_28_67_101 -> + (AddTree_Leaf_4 x_28_67_101) + AddTree_Node_5 x_30_69_103 x_31_70_104 -> + let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in + let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in + (AddTree_Node_5 y_32_71_105 y_33_72_106) + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_traverse_AddTree_Tree_6 :: Cursor -> () +_traverse_AddTree_Tree_6 arg_34_73_107 = + case arg_34_73_107 of + AddTree_Leaf_4 x_35_74_108 -> + () + AddTree_Node_5 x_37_75_109 x_38_76_110 -> + let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in + let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in + () + +{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +_print_AddTree_Tree_6 :: Cursor -> () +_print_AddTree_Tree_6 arg_41_79_113 = + case arg_41_79_113 of + AddTree_Leaf_4 x_42_80_114 -> + let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in + let wildcard_46_82_116 :: () = printsym(" ") in + let y_43_83_117 :: () = printint(x_42_80_114) in + let wildcard_45_84_118 :: () = printsym(")") in + () + AddTree_Node_5 x_47_85_119 x_48_86_120 -> + let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in + let wildcard_54_88_122 :: () = printsym(" ") in + let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in + let wildcard_53_90_124 :: () = printsym(" ") in + let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in + let wildcard_52_92_126 :: () = printsym(")") in + () + [compiler] Running pass, lower Pass output: ================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", +Prog {infoTable = [("AddTree_Tree_6", + [("AddTree_Leaf_4", DataConInfo {dcon_tag = 0, scalar_bytes = 8, num_shortcut = 0, num_scalars = 1, num_packed = 0, field_tys = [IntTy]}), - ("Node", + ("AddTree_Node_5", DataConInfo {dcon_tag = 1, scalar_bytes = 0, num_shortcut = 2, num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addtwo_sub_5", - funArgs = [(t_8_87_147, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") - (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, - IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = SubP, - rands = [VarTriv "x_9_88_148", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addone_add_7", - funArgs = [(t_16_95_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_16_95_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_96_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_17_96_155", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_18_97_157, - CursorTy), - (x2_19_98_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x1_18_97_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x2_19_98_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], + symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), + (129, "(AddTree_Leaf_4"),(130, " ")], + fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", + funArgs = [(arg_20_59_93, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), + (tail_132, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") + rands = [VarTriv "arg_20_59_93"], + bod = Switch "switch_135" + (VarTriv "tag_131") (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, + LetUnpackT {binds = [(x_21_60_94, IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", + ptr = "tail_132", + bod = LetAllocT {lhs = "tailift_133", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), + VarTriv "x_21_60_94")], + bod = RetValsT [VarTriv "tailift_133"]}}), (1, - LetUnpackT {binds = [(x_55_102_164, + LetUnpackT {binds = [(x_23_62_96, CursorTy), - (x_56_103_165, + (x_24_63_97, CursorTy)], - ptr = "tail_211", + ptr = "tail_132", bod = LetCallT {async = False, - binds = [(y_57_104_166, + binds = [(y_25_64_98, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_23_62_96"], bod = LetCallT {async = False, - binds = [(y_58_105_167, + binds = [(y_26_65_99, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_24_63_97"], + bod = LetAllocT {lhs = "tailift_134", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_57_104_166"), + VarTriv "y_25_64_98"), (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, + VarTriv "y_26_65_99")], + bod = RetValsT [VarTriv "tailift_134"]}}}})]) + (Just ErrT "Unknown tag in: tag_131")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", + funArgs = [(arg_27_66_100, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), + (tail_137, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") + rands = [VarTriv "arg_27_66_100"], + bod = Switch "switch_140" + (VarTriv "tag_136") (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, + LetUnpackT {binds = [(x_28_67_101, IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", + ptr = "tail_137", + bod = LetAllocT {lhs = "tailift_138", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), + VarTriv "x_28_67_101")], + bod = RetValsT [VarTriv "tailift_138"]}}), (1, - LetUnpackT {binds = [(x_62_109_171, + LetUnpackT {binds = [(x_30_69_103, CursorTy), - (x_63_110_172, + (x_31_70_104, CursorTy)], - ptr = "tail_216", + ptr = "tail_137", bod = LetCallT {async = False, - binds = [(y_64_111_173, + binds = [(y_32_71_105, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_30_69_103"], bod = LetCallT {async = False, - binds = [(y_65_112_174, + binds = [(y_33_72_106, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_31_70_104"], + bod = LetAllocT {lhs = "tailift_139", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_64_111_173"), + VarTriv "y_32_71_105"), (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, + VarTriv "y_33_72_106")], + bod = RetValsT [VarTriv "tailift_139"]}}}})]) + (Just ErrT "Unknown tag in: tag_136")}, isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_6", + funArgs = [(arg_34_73_107, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), + (tail_142, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") + rands = [VarTriv "arg_34_73_107"], + bod = Switch "switch_143" + (VarTriv "tag_141") (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, + LetUnpackT {binds = [(x_35_74_108, IntTy)], - ptr = "tail_221", + ptr = "tail_142", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_69_115_177, + LetUnpackT {binds = [(x_37_75_109, CursorTy), - (x_70_116_178, + (x_38_76_110, CursorTy)], - ptr = "tail_221", + ptr = "tail_142", bod = LetCallT {async = False, - binds = [(y_71_117_179, + binds = [(y_39_77_111, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_37_75_109"], bod = LetCallT {async = False, - binds = [(y_72_118_180, + binds = [(y_40_78_112, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_38_76_110"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, + (Just ErrT "Unknown tag in: tag_141")}, isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_6", + funArgs = [(arg_41_79_113, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), + (tail_145, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") + rands = [VarTriv "arg_41_79_113"], + bod = Switch "switch_146" + (VarTriv "tag_144") (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, + LetUnpackT {binds = [(x_42_80_114, IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_44_81_115, ProdTy [])], prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, + rands = [SymTriv 129], + bod = LetPrimCallT {binds = [(wildcard_46_82_116, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, + rands = [SymTriv 130], + bod = LetPrimCallT {binds = [(y_43_83_117, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, + rands = [VarTriv "x_42_80_114"], + bod = LetPrimCallT {binds = [(wildcard_45_84_118, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_79_125_187, + LetUnpackT {binds = [(x_47_85_119, CursorTy), - (x_80_126_188, + (x_48_86_120, CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_51_87_121, ProdTy [])], prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, + rands = [SymTriv 128], + bod = LetPrimCallT {binds = [(wildcard_54_88_122, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_81_129_191, + binds = [(y_49_89_123, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_47_85_119"], + bod = LetPrimCallT {binds = [(wildcard_53_90_124, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_82_131_193, + binds = [(y_50_91_125, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_48_86_120"], + bod = LetPrimCallT {binds = [(wildcard_52_92_126, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, + (Just ErrT "Unknown tag in: tag_144")}, isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} + mainExp = Nothing} [compiler] Running pass, lateInlineTriv Pass output: ================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", +Prog {infoTable = [("AddTree_Tree_6", + [("AddTree_Leaf_4", DataConInfo {dcon_tag = 0, scalar_bytes = 8, num_shortcut = 0, num_scalars = 1, num_packed = 0, field_tys = [IntTy]}), - ("Node", + ("AddTree_Node_5", DataConInfo {dcon_tag = 1, scalar_bytes = 0, num_shortcut = 2, num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addtwo_sub_5", - funArgs = [(t_8_87_147, CursorTy)], + symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), + (129, "(AddTree_Leaf_4"),(130, " ")], + fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", + funArgs = [(arg_20_59_93, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), + (tail_132, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") + rands = [VarTriv "arg_20_59_93"], + bod = Switch "switch_135" + (VarTriv "tag_131") (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, + LetUnpackT {binds = [(x_21_60_94, IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = SubP, - rands = [VarTriv "x_9_88_148", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addone_add_7", - funArgs = [(t_16_95_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_16_95_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_96_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_17_96_155", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_18_97_157, - CursorTy), - (x2_19_98_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x1_18_97_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x2_19_98_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", + ptr = "tail_132", + bod = LetAllocT {lhs = "tailift_133", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), + VarTriv "x_21_60_94")], + bod = RetValsT [VarTriv "tailift_133"]}}), (1, - LetUnpackT {binds = [(x_55_102_164, + LetUnpackT {binds = [(x_23_62_96, CursorTy), - (x_56_103_165, + (x_24_63_97, CursorTy)], - ptr = "tail_211", + ptr = "tail_132", bod = LetCallT {async = False, - binds = [(y_57_104_166, + binds = [(y_25_64_98, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_23_62_96"], bod = LetCallT {async = False, - binds = [(y_58_105_167, + binds = [(y_26_65_99, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_24_63_97"], + bod = LetAllocT {lhs = "tailift_134", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_57_104_166"), + VarTriv "y_25_64_98"), (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, + VarTriv "y_26_65_99")], + bod = RetValsT [VarTriv "tailift_134"]}}}})]) + (Just ErrT "Unknown tag in: tag_131")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", + funArgs = [(arg_27_66_100, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), + (tail_137, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") + rands = [VarTriv "arg_27_66_100"], + bod = Switch "switch_140" + (VarTriv "tag_136") (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, + LetUnpackT {binds = [(x_28_67_101, IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", + ptr = "tail_137", + bod = LetAllocT {lhs = "tailift_138", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), + VarTriv "x_28_67_101")], + bod = RetValsT [VarTriv "tailift_138"]}}), (1, - LetUnpackT {binds = [(x_62_109_171, + LetUnpackT {binds = [(x_30_69_103, CursorTy), - (x_63_110_172, + (x_31_70_104, CursorTy)], - ptr = "tail_216", + ptr = "tail_137", bod = LetCallT {async = False, - binds = [(y_64_111_173, + binds = [(y_32_71_105, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_30_69_103"], bod = LetCallT {async = False, - binds = [(y_65_112_174, + binds = [(y_33_72_106, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_31_70_104"], + bod = LetAllocT {lhs = "tailift_139", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_64_111_173"), + VarTriv "y_32_71_105"), (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, + VarTriv "y_33_72_106")], + bod = RetValsT [VarTriv "tailift_139"]}}}})]) + (Just ErrT "Unknown tag in: tag_136")}, isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_6", + funArgs = [(arg_34_73_107, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), + (tail_142, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") + rands = [VarTriv "arg_34_73_107"], + bod = Switch "switch_143" + (VarTriv "tag_141") (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, + LetUnpackT {binds = [(x_35_74_108, IntTy)], - ptr = "tail_221", + ptr = "tail_142", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_69_115_177, + LetUnpackT {binds = [(x_37_75_109, CursorTy), - (x_70_116_178, + (x_38_76_110, CursorTy)], - ptr = "tail_221", + ptr = "tail_142", bod = LetCallT {async = False, - binds = [(y_71_117_179, + binds = [(y_39_77_111, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_37_75_109"], bod = LetCallT {async = False, - binds = [(y_72_118_180, + binds = [(y_40_78_112, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_38_76_110"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, + (Just ErrT "Unknown tag in: tag_141")}, isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_6", + funArgs = [(arg_41_79_113, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), + (tail_145, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") + rands = [VarTriv "arg_41_79_113"], + bod = Switch "switch_146" + (VarTriv "tag_144") (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, + LetUnpackT {binds = [(x_42_80_114, IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_44_81_115, ProdTy [])], prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, + rands = [SymTriv 129], + bod = LetPrimCallT {binds = [(wildcard_46_82_116, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, + rands = [SymTriv 130], + bod = LetPrimCallT {binds = [(y_43_83_117, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, + rands = [VarTriv "x_42_80_114"], + bod = LetPrimCallT {binds = [(wildcard_45_84_118, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_79_125_187, + LetUnpackT {binds = [(x_47_85_119, CursorTy), - (x_80_126_188, + (x_48_86_120, CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_51_87_121, ProdTy [])], prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, + rands = [SymTriv 128], + bod = LetPrimCallT {binds = [(wildcard_54_88_122, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_81_129_191, + binds = [(y_49_89_123, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_47_85_119"], + bod = LetPrimCallT {binds = [(wildcard_53_90_124, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_82_131_193, + binds = [(y_50_91_125, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_48_86_120"], + bod = LetPrimCallT {binds = [(wildcard_52_92_126, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, + (Just ErrT "Unknown tag in: tag_144")}, isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} + mainExp = Nothing} [compiler] Running pass, rearrangeFree Pass output: ================================================================================ -Prog {infoTable = [("AddTree_Tree_4", - [("Leaf", +Prog {infoTable = [("AddTree_Tree_6", + [("AddTree_Leaf_4", DataConInfo {dcon_tag = 0, scalar_bytes = 8, num_shortcut = 0, num_scalars = 1, num_packed = 0, field_tys = [IntTy]}), - ("Node", + ("AddTree_Node_5", DataConInfo {dcon_tag = 1, scalar_bytes = 0, num_shortcut = 2, num_scalars = 0, num_packed = 0, field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(196, ")"),(197, "(Node"),(198, "(Leaf"), - (199, " ")], - fundefs = [FunDecl {funName = "Addtwo_sub_5", - funArgs = [(t_8_87_147, CursorTy)], + symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), + (129, "(AddTree_Leaf_4"),(130, " ")], + fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", + funArgs = [(arg_20_59_93, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_200, TagTyPacked), - (tail_201, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), + (tail_132, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "t_8_87_147"], - bod = Switch "switch_204" - (VarTriv "tag_200") + rands = [VarTriv "arg_20_59_93"], + bod = Switch "switch_135" + (VarTriv "tag_131") (IntAlts [(0, - LetUnpackT {binds = [(x_9_88_148, + LetUnpackT {binds = [(x_21_60_94, IntTy)], - ptr = "tail_201", - bod = LetPrimCallT {binds = [(fltPkd_137_149, - IntTy)], - prim = SubP, - rands = [VarTriv "x_9_88_148", - IntTriv 2], - bod = LetAllocT {lhs = "tailift_202", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_137_149")], - bod = RetValsT [VarTriv "tailift_202"]}}}), - (1, - LetUnpackT {binds = [(x1_10_89_150, - CursorTy), - (x2_11_90_151, - CursorTy)], - ptr = "tail_201", - bod = LetCallT {async = False, - binds = [(fltPkd_138_152, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x1_10_89_150"], - bod = LetCallT {async = False, - binds = [(fltPkd_139_153, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "x2_11_90_151"], - bod = LetAllocT {lhs = "tailift_203", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_138_152"), - (CursorTy, - VarTriv "fltPkd_139_153")], - bod = RetValsT [VarTriv "tailift_203"]}}}})]) - (Just ErrT "Unknown tag in: tag_200")}, - isPure = True}, - FunDecl {funName = "Addone_add_7", - funArgs = [(t_16_95_154, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_205, TagTyPacked), - (tail_206, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "t_16_95_154"], - bod = Switch "switch_209" - (VarTriv "tag_205") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_96_155, - IntTy)], - ptr = "tail_206", - bod = LetPrimCallT {binds = [(fltPkd_140_156, - IntTy)], - prim = AddP, - rands = [VarTriv "x_17_96_155", - IntTriv 1], - bod = LetAllocT {lhs = "tailift_207", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "fltPkd_140_156")], - bod = RetValsT [VarTriv "tailift_207"]}}}), - (1, - LetUnpackT {binds = [(x1_18_97_157, - CursorTy), - (x2_19_98_158, - CursorTy)], - ptr = "tail_206", - bod = LetCallT {async = False, - binds = [(fltPkd_141_159, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x1_18_97_157"], - bod = LetCallT {async = False, - binds = [(fltPkd_142_160, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "x2_19_98_158"], - bod = LetAllocT {lhs = "tailift_208", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_141_159"), - (CursorTy, - VarTriv "fltPkd_142_160")], - bod = RetValsT [VarTriv "tailift_208"]}}}})]) - (Just ErrT "Unknown tag in: tag_205")}, - isPure = True}, - FunDecl {funName = "_copy_AddTree_Tree_4", - funArgs = [(arg_52_99_161, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_210, TagTyPacked), - (tail_211, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_52_99_161"], - bod = Switch "switch_214" - (VarTriv "tag_210") - (IntAlts [(0, - LetUnpackT {binds = [(x_53_100_162, - IntTy)], - ptr = "tail_211", - bod = LetAllocT {lhs = "tailift_212", + ptr = "tail_132", + bod = LetAllocT {lhs = "tailift_133", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_53_100_162")], - bod = RetValsT [VarTriv "tailift_212"]}}), + VarTriv "x_21_60_94")], + bod = RetValsT [VarTriv "tailift_133"]}}), (1, - LetUnpackT {binds = [(x_55_102_164, + LetUnpackT {binds = [(x_23_62_96, CursorTy), - (x_56_103_165, + (x_24_63_97, CursorTy)], - ptr = "tail_211", + ptr = "tail_132", bod = LetCallT {async = False, - binds = [(y_57_104_166, + binds = [(y_25_64_98, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_55_102_164"], + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_23_62_96"], bod = LetCallT {async = False, - binds = [(y_58_105_167, + binds = [(y_26_65_99, CursorTy)], - rator = "_copy_AddTree_Tree_4", - rands = [VarTriv "x_56_103_165"], - bod = LetAllocT {lhs = "tailift_213", + rator = "_copy_AddTree_Tree_6", + rands = [VarTriv "x_24_63_97"], + bod = LetAllocT {lhs = "tailift_134", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_57_104_166"), + VarTriv "y_25_64_98"), (CursorTy, - VarTriv "y_58_105_167")], - bod = RetValsT [VarTriv "tailift_213"]}}}})]) - (Just ErrT "Unknown tag in: tag_210")}, + VarTriv "y_26_65_99")], + bod = RetValsT [VarTriv "tailift_134"]}}}})]) + (Just ErrT "Unknown tag in: tag_131")}, isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_4", - funArgs = [(arg_59_106_168, CursorTy)], + FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", + funArgs = [(arg_27_66_100, CursorTy)], funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_215, TagTyPacked), - (tail_216, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), + (tail_137, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_59_106_168"], - bod = Switch "switch_219" - (VarTriv "tag_215") + rands = [VarTriv "arg_27_66_100"], + bod = Switch "switch_140" + (VarTriv "tag_136") (IntAlts [(0, - LetUnpackT {binds = [(x_60_107_169, + LetUnpackT {binds = [(x_28_67_101, IntTy)], - ptr = "tail_216", - bod = LetAllocT {lhs = "tailift_217", + ptr = "tail_137", + bod = LetAllocT {lhs = "tailift_138", vals = [(IntTy, IntTriv 0), (IntTy, - VarTriv "x_60_107_169")], - bod = RetValsT [VarTriv "tailift_217"]}}), + VarTriv "x_28_67_101")], + bod = RetValsT [VarTriv "tailift_138"]}}), (1, - LetUnpackT {binds = [(x_62_109_171, + LetUnpackT {binds = [(x_30_69_103, CursorTy), - (x_63_110_172, + (x_31_70_104, CursorTy)], - ptr = "tail_216", + ptr = "tail_137", bod = LetCallT {async = False, - binds = [(y_64_111_173, + binds = [(y_32_71_105, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_62_109_171"], + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_30_69_103"], bod = LetCallT {async = False, - binds = [(y_65_112_174, + binds = [(y_33_72_106, CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_4", - rands = [VarTriv "x_63_110_172"], - bod = LetAllocT {lhs = "tailift_218", + rator = "_copy_without_ptrs_AddTree_Tree_6", + rands = [VarTriv "x_31_70_104"], + bod = LetAllocT {lhs = "tailift_139", vals = [(IntTy, IntTriv 1), (CursorTy, - VarTriv "y_64_111_173"), + VarTriv "y_32_71_105"), (CursorTy, - VarTriv "y_65_112_174")], - bod = RetValsT [VarTriv "tailift_218"]}}}})]) - (Just ErrT "Unknown tag in: tag_215")}, + VarTriv "y_33_72_106")], + bod = RetValsT [VarTriv "tailift_139"]}}}})]) + (Just ErrT "Unknown tag in: tag_136")}, isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_4", - funArgs = [(arg_66_113_175, CursorTy)], + FunDecl {funName = "_traverse_AddTree_Tree_6", + funArgs = [(arg_34_73_107, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_220, TagTyPacked), - (tail_221, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), + (tail_142, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_66_113_175"], - bod = Switch "switch_222" - (VarTriv "tag_220") + rands = [VarTriv "arg_34_73_107"], + bod = Switch "switch_143" + (VarTriv "tag_141") (IntAlts [(0, - LetUnpackT {binds = [(x_67_114_176, + LetUnpackT {binds = [(x_35_74_108, IntTy)], - ptr = "tail_221", + ptr = "tail_142", bod = RetValsT []}), (1, - LetUnpackT {binds = [(x_69_115_177, + LetUnpackT {binds = [(x_37_75_109, CursorTy), - (x_70_116_178, + (x_38_76_110, CursorTy)], - ptr = "tail_221", + ptr = "tail_142", bod = LetCallT {async = False, - binds = [(y_71_117_179, + binds = [(y_39_77_111, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_69_115_177"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_37_75_109"], bod = LetCallT {async = False, - binds = [(y_72_118_180, + binds = [(y_40_78_112, ProdTy [])], - rator = "_traverse_AddTree_Tree_4", - rands = [VarTriv "x_70_116_178"], + rator = "_traverse_AddTree_Tree_6", + rands = [VarTriv "x_38_76_110"], bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_220")}, + (Just ErrT "Unknown tag in: tag_141")}, isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_4", - funArgs = [(arg_73_119_181, CursorTy)], + FunDecl {funName = "_print_AddTree_Tree_6", + funArgs = [(arg_41_79_113, CursorTy)], funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_223, TagTyPacked), - (tail_224, CursorTy)], + funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), + (tail_145, CursorTy)], prim = ReadScalar IntS, - rands = [VarTriv "arg_73_119_181"], - bod = Switch "switch_225" - (VarTriv "tag_223") + rands = [VarTriv "arg_41_79_113"], + bod = Switch "switch_146" + (VarTriv "tag_144") (IntAlts [(0, - LetUnpackT {binds = [(x_74_120_182, + LetUnpackT {binds = [(x_42_80_114, IntTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_76_121_183, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_44_81_115, ProdTy [])], prim = PrintSym, - rands = [SymTriv 198], - bod = LetPrimCallT {binds = [(wildcard_78_122_184, + rands = [SymTriv 129], + bod = LetPrimCallT {binds = [(wildcard_46_82_116, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], - bod = LetPrimCallT {binds = [(y_75_123_185, + rands = [SymTriv 130], + bod = LetPrimCallT {binds = [(y_43_83_117, ProdTy [])], prim = PrintInt, - rands = [VarTriv "x_74_120_182"], - bod = LetPrimCallT {binds = [(wildcard_77_124_186, + rands = [VarTriv "x_42_80_114"], + bod = LetPrimCallT {binds = [(wildcard_45_84_118, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}), (1, - LetUnpackT {binds = [(x_79_125_187, + LetUnpackT {binds = [(x_47_85_119, CursorTy), - (x_80_126_188, + (x_48_86_120, CursorTy)], - ptr = "tail_224", - bod = LetPrimCallT {binds = [(wildcard_83_127_189, + ptr = "tail_145", + bod = LetPrimCallT {binds = [(wildcard_51_87_121, ProdTy [])], prim = PrintSym, - rands = [SymTriv 197], - bod = LetPrimCallT {binds = [(wildcard_86_128_190, + rands = [SymTriv 128], + bod = LetPrimCallT {binds = [(wildcard_54_88_122, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_81_129_191, + binds = [(y_49_89_123, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_79_125_187"], - bod = LetPrimCallT {binds = [(wildcard_85_130_192, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_47_85_119"], + bod = LetPrimCallT {binds = [(wildcard_53_90_124, ProdTy [])], prim = PrintSym, - rands = [SymTriv 199], + rands = [SymTriv 130], bod = LetCallT {async = False, - binds = [(y_82_131_193, + binds = [(y_50_91_125, ProdTy [])], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "x_80_126_188"], - bod = LetPrimCallT {binds = [(wildcard_84_132_194, + rator = "_print_AddTree_Tree_6", + rands = [VarTriv "x_48_86_120"], + bod = LetPrimCallT {binds = [(wildcard_52_92_126, ProdTy [])], prim = PrintSym, - rands = [SymTriv 196], + rands = [SymTriv 127], bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_223")}, + (Just ErrT "Unknown tag in: tag_144")}, isPure = True}], - mainExp = Just PrintExp (LetAllocT - {lhs = "fltPkd_135_143", - vals = [(IntTy, IntTriv 0),(IntTy, IntTriv 1)], - bod = LetAllocT {lhs = "fltPkd_136_144", - vals = [(IntTy, IntTriv 0), - (IntTy, IntTriv 2)], - bod = LetAllocT {lhs = "fltAppE_134_145", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "fltPkd_135_143"), - (CursorTy, - VarTriv "fltPkd_136_144")], - bod = LetCallT {async = False, - binds = [(fltAppE_133_146, - CursorTy)], - rator = "Addtwo_sub_5", - rands = [VarTriv "fltAppE_134_145"], - bod = LetCallT {async = False, - binds = [(tmp_app_195, - CursorTy)], - rator = "Addone_add_7", - rands = [VarTriv "fltAppE_133_146"], - bod = LetCallT {async = False, - binds = [], - rator = "_print_AddTree_Tree_4", - rands = [VarTriv "tmp_app_195"], - bod = LetPrimCallT {binds = [], - prim = PrintString "\n", - rands = [], - bod = RetValsT []}}}}}}})} - - [compiler] Final C codegen: 13391 characters. + mainExp = Nothing} + + [compiler] Final C codegen: 9069 characters. ================================================================================ /* Gibbon program. */ @@ -3096,12 +2016,10 @@ typedef struct GibCursorGibCursorProd_struct { GibCursor field0; GibCursor field1; } GibCursorGibCursorProd; -GibCursor Addtwo_sub_5(GibCursor t_8_87_147); -GibCursor Addone_add_7(GibCursor t_16_95_154); -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161); -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168); -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175); -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181); +GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93); +GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100); +unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107); +unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113); typedef enum { GibInt_T, GibFloat_T, @@ -3110,7 +2028,7 @@ typedef enum { GibVector_T, GibList_T, GibCursor_T, - AddTree_Tree_4_T, + AddTree_Tree_6_T, } GibDatatype; void info_table_initialize(void) { @@ -3123,240 +2041,140 @@ void info_table_initialize(void) GibDatatype field_tys[1]; - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 0, 8, 0, 1, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 0, 8, 0, 1, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 0); + error, AddTree_Tree_6_T, 0); exit(1); } - error = gib_info_table_insert_packed_dcon(AddTree_Tree_4_T, 1, 0, 2, 0, 0, + error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 1, 0, 2, 0, 0, field_tys, 0); if (error < 0) { fprintf(stderr, "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_4_T, 1); + error, AddTree_Tree_6_T, 1); exit(1); } gib_info_table_finalize(); } void symbol_table_initialize(void) { - gib_add_symbol(196, ")"); - gib_add_symbol(197, "(Node"); - gib_add_symbol(198, "(Leaf"); - gib_add_symbol(199, " "); + gib_add_symbol(127, ")"); + gib_add_symbol(128, "(AddTree_Node_5"); + gib_add_symbol(129, "(AddTree_Leaf_4"); + gib_add_symbol(130, " "); } -GibCursor Addtwo_sub_5(GibCursor t_8_87_147) +GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93) { - GibPackedTag tag_200 = *(GibPackedTag *) t_8_87_147; - GibCursor tail_201 = t_8_87_147 + sizeof(GibInt); + GibPackedTag tag_131 = *(GibPackedTag *) arg_20_59_93; + GibCursor tail_132 = arg_20_59_93 + sizeof(GibInt); - switch_204: + switch_135: ; - switch (tag_200) { + switch (tag_131) { case 0: { - GibInt x_9_88_148 = ((GibIntProd *) tail_201)->field0; - GibInt fltPkd_137_149 = x_9_88_148 - 2; - GibPtr tailift_202 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_21_60_94 = ((GibIntProd *) tail_132)->field0; + GibPtr tailift_133 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_202)->field0 = 0; - ((GibIntGibIntProd *) tailift_202)->field1 = fltPkd_137_149; - return tailift_202; + ((GibIntGibIntProd *) tailift_133)->field0 = 0; + ((GibIntGibIntProd *) tailift_133)->field1 = x_21_60_94; + return tailift_133; break; } case 1: { - GibCursor x1_10_89_150 = - ((GibCursorGibCursorProd *) tail_201)->field0; - GibCursor x2_11_90_151 = - ((GibCursorGibCursorProd *) tail_201)->field1; - GibCursor fltPkd_138_152 = Addtwo_sub_5(x1_10_89_150); - GibCursor fltPkd_139_153 = Addtwo_sub_5(x2_11_90_151); - GibPtr tailift_203 = + GibCursor x_23_62_96 = + ((GibCursorGibCursorProd *) tail_132)->field0; + GibCursor x_24_63_97 = + ((GibCursorGibCursorProd *) tail_132)->field1; + GibCursor y_25_64_98 = _copy_AddTree_Tree_6(x_23_62_96); + GibCursor y_26_65_99 = _copy_AddTree_Tree_6(x_24_63_97); + GibPtr tailift_134 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_203)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field1 = - fltPkd_138_152; - ((GibIntGibCursorGibCursorProd *) tailift_203)->field2 = - fltPkd_139_153; - return tailift_203; + ((GibIntGibCursorGibCursorProd *) tailift_134)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_134)->field1 = y_25_64_98; + ((GibIntGibCursorGibCursorProd *) tailift_134)->field2 = y_26_65_99; + return tailift_134; break; } default: { - printf("%s\n", "Unknown tag in: tag_200"); + printf("%s\n", "Unknown tag in: tag_131"); exit(1); } } } -GibCursor Addone_add_7(GibCursor t_16_95_154) +GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100) { - GibPackedTag tag_205 = *(GibPackedTag *) t_16_95_154; - GibCursor tail_206 = t_16_95_154 + sizeof(GibInt); + GibPackedTag tag_136 = *(GibPackedTag *) arg_27_66_100; + GibCursor tail_137 = arg_27_66_100 + sizeof(GibInt); - switch_209: + switch_140: ; - switch (tag_205) { + switch (tag_136) { case 0: { - GibInt x_17_96_155 = ((GibIntProd *) tail_206)->field0; - GibInt fltPkd_140_156 = x_17_96_155 + 1; - GibPtr tailift_207 = gib_alloc(sizeof(GibIntGibIntProd)); + GibInt x_28_67_101 = ((GibIntProd *) tail_137)->field0; + GibPtr tailift_138 = gib_alloc(sizeof(GibIntGibIntProd)); - ((GibIntGibIntProd *) tailift_207)->field0 = 0; - ((GibIntGibIntProd *) tailift_207)->field1 = fltPkd_140_156; - return tailift_207; + ((GibIntGibIntProd *) tailift_138)->field0 = 0; + ((GibIntGibIntProd *) tailift_138)->field1 = x_28_67_101; + return tailift_138; break; } case 1: { - GibCursor x1_18_97_157 = - ((GibCursorGibCursorProd *) tail_206)->field0; - GibCursor x2_19_98_158 = - ((GibCursorGibCursorProd *) tail_206)->field1; - GibCursor fltPkd_141_159 = Addone_add_7(x1_18_97_157); - GibCursor fltPkd_142_160 = Addone_add_7(x2_19_98_158); - GibPtr tailift_208 = + GibCursor x_30_69_103 = + ((GibCursorGibCursorProd *) tail_137)->field0; + GibCursor x_31_70_104 = + ((GibCursorGibCursorProd *) tail_137)->field1; + GibCursor y_32_71_105 = + _copy_without_ptrs_AddTree_Tree_6(x_30_69_103); + GibCursor y_33_72_106 = + _copy_without_ptrs_AddTree_Tree_6(x_31_70_104); + GibPtr tailift_139 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - ((GibIntGibCursorGibCursorProd *) tailift_208)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field1 = - fltPkd_141_159; - ((GibIntGibCursorGibCursorProd *) tailift_208)->field2 = - fltPkd_142_160; - return tailift_208; + ((GibIntGibCursorGibCursorProd *) tailift_139)->field0 = 1; + ((GibIntGibCursorGibCursorProd *) tailift_139)->field1 = + y_32_71_105; + ((GibIntGibCursorGibCursorProd *) tailift_139)->field2 = + y_33_72_106; + return tailift_139; break; } default: { - printf("%s\n", "Unknown tag in: tag_205"); + printf("%s\n", "Unknown tag in: tag_136"); exit(1); } } } -GibCursor _copy_AddTree_Tree_4(GibCursor arg_52_99_161) +unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107) { - GibPackedTag tag_210 = *(GibPackedTag *) arg_52_99_161; - GibCursor tail_211 = arg_52_99_161 + sizeof(GibInt); + GibPackedTag tag_141 = *(GibPackedTag *) arg_34_73_107; + GibCursor tail_142 = arg_34_73_107 + sizeof(GibInt); - switch_214: + switch_143: ; - switch (tag_210) { + switch (tag_141) { case 0: { - GibInt x_53_100_162 = ((GibIntProd *) tail_211)->field0; - GibPtr tailift_212 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_212)->field0 = 0; - ((GibIntGibIntProd *) tailift_212)->field1 = x_53_100_162; - return tailift_212; - break; - } - - case 1: - { - GibCursor x_55_102_164 = - ((GibCursorGibCursorProd *) tail_211)->field0; - GibCursor x_56_103_165 = - ((GibCursorGibCursorProd *) tail_211)->field1; - GibCursor y_57_104_166 = _copy_AddTree_Tree_4(x_55_102_164); - GibCursor y_58_105_167 = _copy_AddTree_Tree_4(x_56_103_165); - GibPtr tailift_213 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_213)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field1 = - y_57_104_166; - ((GibIntGibCursorGibCursorProd *) tailift_213)->field2 = - y_58_105_167; - return tailift_213; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_210"); - exit(1); - } - } -} -GibCursor _copy_without_ptrs_AddTree_Tree_4(GibCursor arg_59_106_168) -{ - GibPackedTag tag_215 = *(GibPackedTag *) arg_59_106_168; - GibCursor tail_216 = arg_59_106_168 + sizeof(GibInt); - - - switch_219: - ; - switch (tag_215) { - - case 0: - { - GibInt x_60_107_169 = ((GibIntProd *) tail_216)->field0; - GibPtr tailift_217 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_217)->field0 = 0; - ((GibIntGibIntProd *) tailift_217)->field1 = x_60_107_169; - return tailift_217; - break; - } - - case 1: - { - GibCursor x_62_109_171 = - ((GibCursorGibCursorProd *) tail_216)->field0; - GibCursor x_63_110_172 = - ((GibCursorGibCursorProd *) tail_216)->field1; - GibCursor y_64_111_173 = - _copy_without_ptrs_AddTree_Tree_4(x_62_109_171); - GibCursor y_65_112_174 = - _copy_without_ptrs_AddTree_Tree_4(x_63_110_172); - GibPtr tailift_218 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_218)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field1 = - y_64_111_173; - ((GibIntGibCursorGibCursorProd *) tailift_218)->field2 = - y_65_112_174; - return tailift_218; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_215"); - exit(1); - } - } -} -unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) -{ - GibPackedTag tag_220 = *(GibPackedTag *) arg_66_113_175; - GibCursor tail_221 = arg_66_113_175 + sizeof(GibInt); - - - switch_222: - ; - switch (tag_220) { - - case 0: - { - GibInt x_67_114_176 = ((GibIntProd *) tail_221)->field0; + GibInt x_35_74_108 = ((GibIntProd *) tail_142)->field0; return 0; break; @@ -3364,14 +2182,12 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) case 1: { - GibCursor x_69_115_177 = - ((GibCursorGibCursorProd *) tail_221)->field0; - GibCursor x_70_116_178 = - ((GibCursorGibCursorProd *) tail_221)->field1; - unsigned char y_71_117_179 = - _traverse_AddTree_Tree_4(x_69_115_177); - unsigned char y_72_118_180 = - _traverse_AddTree_Tree_4(x_70_116_178); + GibCursor x_37_75_109 = + ((GibCursorGibCursorProd *) tail_142)->field0; + GibCursor x_38_76_110 = + ((GibCursorGibCursorProd *) tail_142)->field1; + unsigned char y_39_77_111 = _traverse_AddTree_Tree_6(x_37_75_109); + unsigned char y_40_78_112 = _traverse_AddTree_Tree_6(x_38_76_110); return 0; break; @@ -3379,28 +2195,28 @@ unsigned char _traverse_AddTree_Tree_4(GibCursor arg_66_113_175) default: { - printf("%s\n", "Unknown tag in: tag_220"); + printf("%s\n", "Unknown tag in: tag_141"); exit(1); } } } -unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) +unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113) { - GibPackedTag tag_223 = *(GibPackedTag *) arg_73_119_181; - GibCursor tail_224 = arg_73_119_181 + sizeof(GibInt); + GibPackedTag tag_144 = *(GibPackedTag *) arg_41_79_113; + GibCursor tail_145 = arg_41_79_113 + sizeof(GibInt); - switch_225: + switch_146: ; - switch (tag_223) { + switch (tag_144) { case 0: { - GibInt x_74_120_182 = ((GibIntProd *) tail_224)->field0; - unsigned char wildcard_76_121_183 = gib_print_symbol(198); - unsigned char wildcard_78_122_184 = gib_print_symbol(199); - unsigned char y_75_123_185 = printf("%ld", x_74_120_182); - unsigned char wildcard_77_124_186 = gib_print_symbol(196); + GibInt x_42_80_114 = ((GibIntProd *) tail_145)->field0; + unsigned char wildcard_44_81_115 = gib_print_symbol(129); + unsigned char wildcard_46_82_116 = gib_print_symbol(130); + unsigned char y_43_83_117 = printf("%ld", x_42_80_114); + unsigned char wildcard_45_84_118 = gib_print_symbol(127); return 0; break; @@ -3408,16 +2224,16 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) case 1: { - GibCursor x_79_125_187 = - ((GibCursorGibCursorProd *) tail_224)->field0; - GibCursor x_80_126_188 = - ((GibCursorGibCursorProd *) tail_224)->field1; - unsigned char wildcard_83_127_189 = gib_print_symbol(197); - unsigned char wildcard_86_128_190 = gib_print_symbol(199); - unsigned char y_81_129_191 = _print_AddTree_Tree_4(x_79_125_187); - unsigned char wildcard_85_130_192 = gib_print_symbol(199); - unsigned char y_82_131_193 = _print_AddTree_Tree_4(x_80_126_188); - unsigned char wildcard_84_132_194 = gib_print_symbol(196); + GibCursor x_47_85_119 = + ((GibCursorGibCursorProd *) tail_145)->field0; + GibCursor x_48_86_120 = + ((GibCursorGibCursorProd *) tail_145)->field1; + unsigned char wildcard_51_87_121 = gib_print_symbol(128); + unsigned char wildcard_54_88_122 = gib_print_symbol(130); + unsigned char y_49_89_123 = _print_AddTree_Tree_6(x_47_85_119); + unsigned char wildcard_53_90_124 = gib_print_symbol(130); + unsigned char y_50_91_125 = _print_AddTree_Tree_6(x_48_86_120); + unsigned char wildcard_52_92_126 = gib_print_symbol(127); return 0; break; @@ -3425,7 +2241,7 @@ unsigned char _print_AddTree_Tree_4(GibCursor arg_73_119_181) default: { - printf("%s\n", "Unknown tag in: tag_223"); + printf("%s\n", "Unknown tag in: tag_144"); exit(1); } } @@ -3437,29 +2253,6 @@ int main(int argc, char **argv) info_table_initialize(); symbol_table_initialize(); - GibPtr fltPkd_135_143 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_135_143)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_135_143)->field1 = 1; - - GibPtr fltPkd_136_144 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) fltPkd_136_144)->field0 = 0; - ((GibIntGibIntProd *) fltPkd_136_144)->field1 = 2; - - GibPtr fltAppE_134_145 = gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field1 = fltPkd_135_143; - ((GibIntGibCursorGibCursorProd *) fltAppE_134_145)->field2 = fltPkd_136_144; - - GibCursor fltAppE_133_146 = Addtwo_sub_5(fltAppE_134_145); - GibCursor tmp_app_195 = Addone_add_7(fltAppE_133_146); - - _print_AddTree_Tree_4(tmp_app_195); - printf("\n"); - return 0; - int exit_1 = gib_exit(); return exit_1; @@ -3468,25 +2261,10 @@ int main(int argc, char **argv) Compiling RTS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 - -make: Nothing to be done for 'all'. - - - - -Compiling the program -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng - - - -In file included from /home/timmy/git/gibbon/gibbon-compiler/./examples/addimport.c:3:0: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] - #warning "Simple write barrier is disabled." - ^~~~~~~ +make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 +codegen: C RTS could not be compiled: +make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory +make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. -(Node (Leaf 0) (Leaf 1)) +Code: 2 diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 8b6eeb532..efc79c83d 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -59,6 +59,7 @@ import qualified Gibbon.L0.Specialize2 as L0 import qualified Gibbon.L1.Typecheck as L1 import qualified Gibbon.L2.Typecheck as L2 import qualified Gibbon.L3.Typecheck as L3 +import Gibbon.Passes.FreshConstructors (freshConstructors) import Gibbon.Passes.ModuleRename (moduleRename) import Gibbon.Passes.Freshen (freshNames) import Gibbon.Passes.Flatten (flattenL1, flattenL2, flattenL3) @@ -652,9 +653,10 @@ passes config@Config{dynflags} l0 = do opt_layout_global = gopt Opt_Layout_Global dynflags use_solver = gopt Opt_Layout_Use_Solver dynflags tcProg3 = L3.tcProg isPacked + l0 <- go "freshConstructors" freshConstructors l0 l0 <- go "renameModules" moduleRename l0 l0 <- go "freshen" freshNames l0 - l0 <- goE0 "typecheck" L0.tcProg l0 + l0 <- goE0 "typecheck" L0.tcProg l0 l0 <- goE0 "bindLambdas" L0.bindLambdas l0 l0 <- goE0 "monomorphize" L0.monomorphize l0 -- l0 <- goE0 "closureConvert" L0.closureConvert l0 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 213d566e9..14519cb6c 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -241,7 +241,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - defs' = M.mapWithKey (\k dDef -> dDef {tyName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) + defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs'' = diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs new file mode 100644 index 000000000..18477ca45 --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs @@ -0,0 +1,131 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} + +module Gibbon.Passes.FreshConstructors (freshConstructors) where + +import qualified Data.List as L +import qualified Data.Map as M + +import Gibbon.Common +import Gibbon.L0.Syntax + +type VarEnv = M.Map Var Var + +freshConstructors :: Prog0 -> PassM Prog0 +freshConstructors (Prog defs funs main) = do + let constrs :: [Var] = (L.map (\(constrName, _) -> + (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> + acc ++ dataCons + ) [] (M.elems defs)) + ) + freshNames <- (mapM (\v -> gensym v) constrs) + let constrenv :: VarEnv = M.fromList $ zip constrs freshNames + + main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) + m' <- freshConstrsInExp m constrenv + return $ Just (m',ty) + defs' <- traverse (\v -> freshConstrsInDef v constrenv) defs + funs' <- traverse (\v -> freshConstrsInFun v constrenv) funs + + return $ Prog defs' funs' main' + +freshConstrsInDef :: DDef Ty0 -> VarEnv -> PassM (DDef Ty0) +freshConstrsInDef (DDef tyName tyArgs dataCons) constrenv = + do + let dataCons' = map (\(dataCon, vs) -> + case (M.lookup (toVar dataCon) constrenv) of + Just dataCon' -> ((fromVar dataCon'), vs) + Nothing -> error $ "shouldn't get here" + ) dataCons + pure $ DDef tyName tyArgs dataCons' + +-- + +freshConstrsInFun :: FunDef Exp0 -> VarEnv -> PassM (FunDef Exp0) +freshConstrsInFun (FunDef nam nargs funty bod meta) constrenv = + do + bod' <- freshConstrsInExp bod constrenv + pure $ FunDef nam nargs funty bod' meta + +freshConstrsInExp :: Exp0 -> VarEnv -> PassM Exp0 +freshConstrsInExp exp constrenv = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + --VarE v -> return $ VarE (varAppend (toVar "seen-") v) + VarE v -> return $ VarE v + + AppE v locs ls -> do + ls' <- traverse (\v -> freshConstrsInExp v constrenv) ls + return $ AppE v locs ls' + + PrimAppE p es -> do + es' <- traverse (\v -> freshConstrsInExp v constrenv) es + return $ PrimAppE p es' + + LetE (v,_locs,ty, e1) e2 -> do + e1' <- freshConstrsInExp e1 constrenv + e2' <- freshConstrsInExp e2 constrenv + return $ LetE (v, [], ty, e1') e2' + + IfE e1 e2 e3 -> do + e1' <- freshConstrsInExp e1 constrenv + e2' <- freshConstrsInExp e2 constrenv + e3' <- freshConstrsInExp e3 constrenv + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- freshConstrsInExp e constrenv + return $ ProjE i e' + + MkProdE es -> do + es' <- traverse (\v -> freshConstrsInExp v constrenv) es + return $ MkProdE es' + + CaseE e mp -> do + e' <- freshConstrsInExp e constrenv + mp' <- mapM (\(c,prs,ae) -> do + let c' = (fromVar (resolveNameInEnv (toVar c) constrenv)) + ae' <- freshConstrsInExp ae constrenv + return (c', prs, ae')) mp + return $ CaseE e' mp' + + DataConE loc c es -> do + let c' = (fromVar (resolveNameInEnv (toVar c) constrenv)) + es' <- traverse (\v -> freshConstrsInExp v constrenv) es + return $ DataConE loc c' es' + + TimeIt e t b -> do + e' <- freshConstrsInExp e constrenv + return $ TimeIt e' t b + WithArenaE v e -> do + e' <- freshConstrsInExp e constrenv + return $ WithArenaE v e' + SpawnE v locs ls -> do + ls' <- traverse (\v -> freshConstrsInExp v constrenv) ls + return $ SpawnE v locs ls' + SyncE -> return $ SyncE + + MapE (v, d, ve) e -> do + e' <- freshConstrsInExp e constrenv + ve' <- freshConstrsInExp ve constrenv + return $ MapE (v, d, ve') e' + FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do + e1' <- freshConstrsInExp e1 constrenv + e2' <- freshConstrsInExp e2 constrenv + e3' <- freshConstrsInExp e3 constrenv + return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' + Ext ext -> return $ Ext ext + +-- + +resolveNameInEnv :: Var -> VarEnv -> Var +resolveNameInEnv name e = + do case (M.lookup name e) of + --Just freshName -> (toVar ((fromVar freshName) ++ "*")) + Just freshName -> freshName + Nothing -> error $ "can't find " ++ (fromVar name) ++ " in constructor env: " ++ (show e) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index f01e22c71..54d8711ce 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -42,15 +42,25 @@ fillImports (Prog defs funs main) localMod imports imported_progs = Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] Nothing -> error $ "could not find module or alias: " ++ (show modName) Nothing -> error "how did we get here?" + + let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs + let localConstrs = (L.map (\(constrName, _) -> + (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> + acc ++ dataCons + ) [] (M.elems defs)) + ) let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (M.keys idefs))) initImportedNames imported_progs let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (foldr applyImportMeta [] (M.keys ifuns))) initImportedNames imported_progs - --let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (map (\tyName -> applyImportMeta tyName importMeta) (M.keys idefs))) initImportedNames imported_progs - --let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (map (\funName -> applyImportMeta funName importMeta) (M.keys ifuns))) initImportedNames imported_progs + + let initEnv :: VarEnv = M.empty + -- build constructor env + + let constrNameMap = M.fromList $ importedConstrs ++ (zip localConstrs (map (\v -> (v, False)) localConstrs)) + let (constrenv, _) = M.mapAccumWithKey buildEnv initEnv constrNameMap -- build def env let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (map (\v -> (v, False)) (M.keys defs))) - let initDefEnv :: VarEnv = M.empty - let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap + let (defenv, _) = M.mapAccumWithKey buildEnv initEnv defNameMap let transformDefKey :: Var -> Var transformDefKey k = do let (mod, name) = parseOutMod k @@ -58,8 +68,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- build fun env let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (map (\v -> (v, False)) (M.keys funs)) ) - let initFunEnv :: VarEnv = M.empty - let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap + let (funenv, _) = M.mapAccumWithKey buildEnv initEnv funNameMap let transformFunKey :: Var -> Var transformFunKey k = do let (mod, name) = parseOutMod k @@ -69,12 +78,12 @@ fillImports (Prog defs funs main) localMod imports imported_progs = main' <- case main of Nothing -> return Nothing Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) - m' <- resolveModInExp m defenv funenv + m' <- resolveModInExp m defenv funenv constrenv return $ Just (m',ty) defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs - funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs + funs' <- traverse (\v -> resolveModsInFuns v defenv funenv constrenv) funs let defs'' = M.mapKeys transformDefKey defs' let funs'' = M.mapKeys transformFunKey funs' @@ -118,12 +127,12 @@ resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' -resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = +resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM (FunDef Exp0) +resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv constrenv = do let nam' = parseAndResolve nam funenv let funty' = resolveModsInTyScheme funty defenv - bod' <- resolveModInExp bod defenv funenv + bod' <- resolveModInExp bod defenv funenv constrenv pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme @@ -161,8 +170,8 @@ resolveModInTy ty defenv = ListTy el_t -> ListTy $ resolveModInTy el_t defenv IntHashTy -> ty -resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> PassM Exp0 -resolveModInExp exp defenv funenv = +resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM Exp0 +resolveModInExp exp defenv funenv constrenv = case exp of LitE i -> return $ LitE i CharE c -> return $ CharE c @@ -174,37 +183,65 @@ resolveModInExp exp defenv funenv = AppE v locs ls -> do let (mod, fun) = parseOutMod v let v' = resolveNameInEnv mod fun funenv - ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls return $ AppE v' locs ls' - PrimAppE p es -> return $ PrimAppE p es + PrimAppE p es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es + return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do - e1' <- resolveModInExp e1 defenv funenv - e2' <- resolveModInExp e2 defenv funenv + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv return $ LetE (v, [], ty, e1') e2' - IfE e1 e2 e3 -> return $ IfE e1 e2 e3 - ProjE i e -> return $ ProjE i e - MkProdE es -> return $ MkProdE es + IfE e1 e2 e3 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + e3' <- resolveModInExp e3 defenv funenv constrenv + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ ProjE i e' + + MkProdE es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es + return $ MkProdE es' CaseE e mp -> do - e' <- resolveModInExp e defenv funenv + e' <- resolveModInExp e defenv funenv constrenv mp' <- mapM (\(c,prs,ae) -> do - ae' <- resolveModInExp ae defenv funenv - return (c, prs, ae')) mp + let c' = (fromVar (parseAndResolve (toVar c) constrenv)) + ae' <- resolveModInExp ae defenv funenv constrenv + return (c', prs, ae')) mp return $ CaseE e' mp' DataConE loc c es -> do - es' <- traverse (\v -> resolveModInExp v defenv funenv) es - return $ DataConE loc c es' - - TimeIt e t b -> return $ TimeIt e t b - WithArenaE v e -> return $ WithArenaE v e - SpawnE v locs ls -> return $ SpawnE v locs ls + let c' = (fromVar (parseAndResolve (toVar c) constrenv)) + es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es + return $ DataConE loc c' es' + + TimeIt e t b -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ TimeIt e' t b + WithArenaE v e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ WithArenaE v e' + SpawnE v locs ls -> do + ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls + return $ SpawnE v locs ls' SyncE -> return $ SyncE - MapE v e -> return $ MapE v e - FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + + MapE (v, d, ve) e -> do + e' <- resolveModInExp e defenv funenv constrenv + ve' <- resolveModInExp ve defenv funenv constrenv + return $ MapE (v, d, ve') e' + FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + e3' <- resolveModInExp e3 defenv funenv constrenv + return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' Ext ext -> return $ Ext ext diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 88abe2f2b..e634a2862 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -123,16 +123,28 @@ resolveModInExp exp defenv funenv = ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls return $ AppE v' locs ls' - PrimAppE p es -> return $ PrimAppE p es + PrimAppE p es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv) es + return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do e1' <- resolveModInExp e1 defenv funenv e2' <- resolveModInExp e2 defenv funenv return $ LetE (v, [], ty, e1') e2' - IfE e1 e2 e3 -> return $ IfE e1 e2 e3 - ProjE i e -> return $ ProjE i e - MkProdE es -> return $ MkProdE es + IfE e1 e2 e3 -> do + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv + e3' <- resolveModInExp e3 defenv funenv + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- resolveModInExp e defenv funenv + return $ ProjE i e' + + MkProdE es -> do + es' <- traverse (\v -> resolveModInExp v defenv funenv) es + return $ MkProdE es' CaseE e mp -> do e' <- resolveModInExp e defenv funenv @@ -145,12 +157,25 @@ resolveModInExp exp defenv funenv = es' <- traverse (\v -> resolveModInExp v defenv funenv) es return $ DataConE loc c es' - TimeIt e t b -> return $ TimeIt e t b - WithArenaE v e -> return $ WithArenaE v e - SpawnE v locs ls -> return $ SpawnE v locs ls + TimeIt e t b -> do + e' <- resolveModInExp e defenv funenv + return $ TimeIt e' t b + WithArenaE v e -> do + e' <- resolveModInExp e defenv funenv + return $ WithArenaE v e' + SpawnE v locs ls -> do + ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls + return $ SpawnE v locs ls' SyncE -> return $ SyncE - MapE v e -> return $ MapE v e - FoldE e1 e2 e3 -> return $ FoldE e1 e2 e3 + MapE (v, d, ve) e -> do + e' <- resolveModInExp e defenv funenv + ve' <- resolveModInExp ve defenv funenv + return $ MapE (v, d, ve') e' + FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do + e1' <- resolveModInExp e1 defenv funenv + e2' <- resolveModInExp e2 defenv funenv + e3' <- resolveModInExp e3 defenv funenv + return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' Ext ext -> return $ Ext ext From a430af311fc45e62b846eaa6375e6c81d89cdf39 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 7 Dec 2023 13:40:53 -0500 Subject: [PATCH 34/68] fix? handling local identifier --- gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs | 3 ++- gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 54d8711ce..0bea41744 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -281,7 +281,8 @@ resolveNameInEnv mod name e = Nothing -> case (foldr findUnqualified (False, "") modspace) of (True, n) -> n (False, _) -> error $ "can't find unquilified reference to " ++ (fromVar name) - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) + Nothing -> name + --Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) findUnqualified (n, q) (acc, out) = diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index e634a2862..61dcc4309 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -115,7 +115,7 @@ resolveModInExp exp defenv funenv = FloatE i -> return $ FloatE i LitSymE v -> return $ LitSymE v --VarE v -> return $ VarE (varAppend (toVar "seen-") v) - VarE v -> return $ VarE v + VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) AppE v locs ls -> do let (mod, fun) = parseOutMod v @@ -214,4 +214,5 @@ resolveNameInEnv mod name e = Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) Nothing -> if(M.size modspace == 1) then head $ M.elems modspace else error $ "can't find " ++ (fromVar name) - Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file + Nothing -> name + --Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file From 375baae1a9e24822ccd881fe6ff37205db85dc69 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 7 Dec 2023 18:51:26 -0500 Subject: [PATCH 35/68] some testing --- gibbon-compiler/examples/imports/AddTree.hs | 2 +- .../imports/AllThreeImportModifications.ans | 1 + .../imports/AllThreeImportModifications.hs | 2 +- .../examples/imports/ImportAliased.ans | 1 + .../examples/imports/ImportQualified.ans | 1 + .../imports/ImportQualifiedAndSpecified.ans | 1 + .../examples/imports/ImportSpecified.ans | 1 + gibbon-compiler/examples/imports/ir.log | 282 ------------------ .../src/Gibbon/Passes/ModuleFillImports.hs | 3 +- .../tests/test-gibbon-examples.yaml | 20 +- 10 files changed, 26 insertions(+), 288 deletions(-) create mode 100644 gibbon-compiler/examples/imports/AllThreeImportModifications.ans create mode 100644 gibbon-compiler/examples/imports/ImportAliased.ans create mode 100644 gibbon-compiler/examples/imports/ImportQualified.ans create mode 100644 gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans create mode 100644 gibbon-compiler/examples/imports/ImportSpecified.ans delete mode 100644 gibbon-compiler/examples/imports/ir.log diff --git a/gibbon-compiler/examples/imports/AddTree.hs b/gibbon-compiler/examples/imports/AddTree.hs index 4da208e66..9acdf78cc 100644 --- a/gibbon-compiler/examples/imports/AddTree.hs +++ b/gibbon-compiler/examples/imports/AddTree.hs @@ -1,5 +1,5 @@ module AddTree where - data Tree = Leaf Int | Node Tree Tree + data Tree = Node Tree Tree | Leaf Int sum :: Tree -> Int sum t = diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.ans b/gibbon-compiler/examples/imports/AllThreeImportModifications.ans new file mode 100644 index 000000000..f11c82a4c --- /dev/null +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.ans @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs index 37764a7f3..987a05acd 100644 --- a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs @@ -1,6 +1,6 @@ module AllThreeImportModifications where import qualified Addtwo as T (add) import qualified Addone as O (add) - import AddTree as Tree (Node, Lead) + import AddTree as Tree (Node, Leaf) gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportAliased.ans b/gibbon-compiler/examples/imports/ImportAliased.ans new file mode 100644 index 000000000..f11c82a4c --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportAliased.ans @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualified.ans b/gibbon-compiler/examples/imports/ImportQualified.ans new file mode 100644 index 000000000..f11c82a4c --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualified.ans @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans new file mode 100644 index 000000000..7813681f5 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportQualifiedAndSpecified.ans @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ImportSpecified.ans b/gibbon-compiler/examples/imports/ImportSpecified.ans new file mode 100644 index 000000000..7813681f5 --- /dev/null +++ b/gibbon-compiler/examples/imports/ImportSpecified.ans @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/gibbon-compiler/examples/imports/ir.log b/gibbon-compiler/examples/imports/ir.log deleted file mode 100644 index db7db6b2e..000000000 --- a/gibbon-compiler/examples/imports/ir.log +++ /dev/null @@ -1,282 +0,0 @@ - ! Responding to env Var: GIBBON_DEBUG=4 - ! We set DEBUG based on command-line verbose arg: 4 -================================================================================ - -desugaring module: ImportAliased - -- imports: ["Addtwo","Addone","AddTree"] - -- aliases: fromList [(Var "Addtwo",Var "T"),(Var "Addone",Var "O"),(Var "AddTree",Var "Tree")] - -- imports: fromList [(Var "Addtwo",(Var "T",True,Nothing)),(Var "Addone",(Var "O",True,Nothing)),(Var "AddTree",(Var "Tree",False,Nothing))] - -================================================================================ - -desugaring module: Addtwo - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - -================================================================================ - -desugaring module: AddTree - -- imports: [] - -- aliases: fromList [] - -- imports: fromList [] - -================================================================================ - -desugaring module: Addone - -- imports: ["AddTree"] - -- aliases: fromList [(Var "AddTree",Var "AddTree")] - -- imports: fromList [(Var "AddTree",(Var "AddTree",False,Nothing))] - - [compiler] pipeline starting, parsed program: -================================================================================ -Prog {ddefs = [(AddTree.Tree, - DDef {tyName = "AddTree.Tree", - tyArgs = [], - dataCons = [("Leaf", [(False, IntTy)]), - ("Node", - [(False, PackedTy "AddTree.Tree" []), - (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(Addtwo.add, - FunDef {funName = "Addtwo.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addtwo.add" [] [VarE "x1"], - AppE "Addtwo.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addtwo.sub, - FunDef {funName = "Addtwo.sub", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 2]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addtwo.sub" [] [VarE "x1"], - AppE "Addtwo.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addone.add, - FunDef {funName = "Addone.add", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "Addone.add" [] [VarE "x1"], - AppE "Addone.add" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (Addone.sub, - FunDef {funName = "Addone.sub", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "AddTree.Tree" []] - (PackedTy "AddTree.Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $8)], - DataConE (MetaTv $7) - "Leaf" - [PrimAppE SubP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $10),(x2, MetaTv $11)], - DataConE (MetaTv $9) - "Node" - [AppE "Addone.sub" [] [VarE "x1"], - AppE "Addone.sub" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (AddTree.sum, - FunDef {funName = "AddTree.sum", - funArgs = [t], - funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), - funBody = CaseE (VarE "t") - [("Leaf", [(v, MetaTv $1)], VarE "v"), - ("Node", - [(l, MetaTv $2),(r, MetaTv $3)], - PrimAppE AddP - [AppE "sum" [] [VarE "l"], - AppE "sum" [] [VarE "r"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Just (AppE "AddTree.sum" - [] - [AppE "Addtwo.add" - [] - [AppE "Addone.add" - [] - [DataConE (MetaTv $0) - "Tree.Node" - [DataConE (MetaTv $1) "Tree.Leaf" [LitE 1], - DataConE (MetaTv $2) "Tree.Leaf" [LitE 2]]]]], - MetaTv $3)} - - [compiler] Running pass, renameModules -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_5 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 2) - Node x1::$4 x2::$5 -> - (Node $3 (Addtwo_add_5 [] x1) (Addtwo_add_5 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_6 t = - case t of - Leaf x::$8 -> - (Leaf $7 x - 2) - Node x1::$10 x2::$11 -> - (Node $9 (Addtwo_sub_6 [] x1) (Addtwo_sub_6 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t = - case t of - Leaf x::$2 -> - (Leaf $1 x + 1) - Node x1::$4 x2::$5 -> - (Node $3 (Addone_add_7 [] x1) (Addone_add_7 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_sub_8 t = - case t of - Leaf x::$8 -> - (Leaf $7 x - 1) - Node x1::$10 x2::$11 -> - (Node $9 (Addone_sub_8 [] x1) (Addone_sub_8 [] x2)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) -AddTree_sum_9 t = - case t of - Leaf v::$1 -> - v - Node l::$2 r::$3 -> - (sum [] l) + (sum [] r) - -gibbon_main :: $3 -gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) - - [compiler] Running pass, freshen -Pass output: -================================================================================ -data AddTree_Tree_4 = Leaf Int | - Node (Packed AddTree_Tree_4 []) (Packed AddTree_Tree_4 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_add_5 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_add_5 t_10 = - case t_10 of - Leaf x_11::$2 -> - (Leaf $1 x_11 + 2) - Node x1_12::$4 x2_13::$5 -> - (Node $3 (Addtwo_add_5 [] x1_12) (Addtwo_add_5 [] x2_13)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addtwo_sub_6 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addtwo_sub_6 t_14 = - case t_14 of - Leaf x_15::$8 -> - (Leaf $7 x_15 - 2) - Node x1_16::$10 x2_17::$11 -> - (Node $9 (Addtwo_sub_6 [] x1_16) (Addtwo_sub_6 [] x2_17)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_add_7 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_add_7 t_18 = - case t_18 of - Leaf x_19::$2 -> - (Leaf $1 x_19 + 1) - Node x1_20::$4 x2_21::$5 -> - (Node $3 (Addone_add_7 [] x1_20) (Addone_add_7 [] x2_21)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -Addone_sub_8 :: forall. ((Packed AddTree_Tree_4 []) -> (Packed AddTree_Tree_4 [])) -Addone_sub_8 t_22 = - case t_22 of - Leaf x_23::$8 -> - (Leaf $7 x_23 - 1) - Node x1_24::$10 x2_25::$11 -> - (Node $9 (Addone_sub_8 [] x1_24) (Addone_sub_8 [] x2_25)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_9 :: forall. ((Packed AddTree_Tree_4 []) -> Int) -AddTree_sum_9 t_26 = - case t_26 of - Leaf v_27::$1 -> - v_27 - Node l_28::$2 r_29::$3 -> - (sum [] l_28) + (sum [] r_29) - -gibbon_main :: $3 -gibbon_main = (AddTree_sum_9 [] (Addtwo_add_5 [] (Addone_add_7 [] (Tree.Node $0 (Tree.Leaf $1 1) (Tree.Leaf $2 2))))) - - [compiler] Running pass, typecheck -gibbon: L0.Typecheck: - Unknown function: sum in Var "AddTree_sum_9" -CallStack (from HasCallStack): - error, called at src/Gibbon/L0/Typecheck.hs:83:18 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 0bea41744..a47ea8587 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -181,8 +181,7 @@ resolveModInExp exp defenv funenv constrenv = VarE v -> return $ VarE v AppE v locs ls -> do - let (mod, fun) = parseOutMod v - let v' = resolveNameInEnv mod fun funenv + let v' = parseAndResolve v funenv ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls return $ AppE v' locs ls' diff --git a/gibbon-compiler/tests/test-gibbon-examples.yaml b/gibbon-compiler/tests/test-gibbon-examples.yaml index ff123bb0d..6ec2dc3e9 100644 --- a/gibbon-compiler/tests/test-gibbon-examples.yaml +++ b/gibbon-compiler/tests/test-gibbon-examples.yaml @@ -330,9 +330,25 @@ tests: - name: Tuples.hs answer-file: examples/Tuples.hs.ans - - name: Foo.hs + - name: AllThreeImportModifications.hs dir: examples/imports/ - answer-file: examples/imports/Foo.ans + answer-file: examples/imports/AllThreeImportModifications.ans + + - name: ImportQualifiedAndSpecified.hs + dir: examples/imports/ + answer-file: examples/imports/ImportQualifiedAndSpecified.ans + + - name: ImportAliased.hs + dir: examples/imports/ + answer-file: examples/imports/ImportAliased.ans + + - name: ImportQualified.hs + dir: examples/imports/ + answer-file: examples/imports/ImportQualified.ans + + - name: ImportSpecified.hs + dir: examples/imports/ + answer-file: examples/imports/ImportSpecified.ans - name: NeedsClosure.hs dir: examples/poly From 6847ca926f5cb3c634d5ecb6ed019406567d8bd4 Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 18:34:50 -0500 Subject: [PATCH 36/68] fixed interp --- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 4 ++-- gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs | 7 +++++-- gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 14519cb6c..66c9aaa22 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -281,7 +281,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports funs''' (M.keys userOrderings') imported_progs' <- mapM id imported_progs - Prog defs'' funs'''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' + Prog defs'' funs''''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' let (defs0, funs0) = foldr (\Prog {ddefs, fundefs} (defs1, funs1) -> @@ -320,7 +320,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports error $ "Conflicting definitions of " ++ show (S.toList em2) ++ " found in " ++ mod_name) - (defs'', funs'''') + (defs'', funs''''') imported_progs' return $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) pure prog diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index a47ea8587..df412875c 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -178,7 +178,8 @@ resolveModInExp exp defenv funenv constrenv = FloatE i -> return $ FloatE i LitSymE v -> return $ LitSymE v --VarE v -> return $ VarE (varAppend (toVar "seen-") v) - VarE v -> return $ VarE v + --VarE v -> return $ VarE v + VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) AppE v locs ls -> do let v' = parseAndResolve v funenv @@ -280,7 +281,9 @@ resolveNameInEnv mod name e = Nothing -> case (foldr findUnqualified (False, "") modspace) of (True, n) -> n (False, _) -> error $ "can't find unquilified reference to " ++ (fromVar name) - Nothing -> name + Nothing -> case mod of + Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) + Nothing -> name --Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 61dcc4309..218ad021a 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -214,5 +214,7 @@ resolveNameInEnv mod name e = Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) Nothing -> if(M.size modspace == 1) then head $ M.elems modspace else error $ "can't find " ++ (fromVar name) - Nothing -> name + Nothing -> case mod of + Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) + Nothing -> name --Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file From 0350baf038ba284b75d04e62e50ecef895a8a3c1 Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 18:53:13 -0500 Subject: [PATCH 37/68] fixing a test (did not specify the sum function) --- gibbon-compiler/examples/imports/AllThreeImportModifications.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs index 987a05acd..472ad4f79 100644 --- a/gibbon-compiler/examples/imports/AllThreeImportModifications.hs +++ b/gibbon-compiler/examples/imports/AllThreeImportModifications.hs @@ -1,6 +1,6 @@ module AllThreeImportModifications where import qualified Addtwo as T (add) import qualified Addone as O (add) - import AddTree as Tree (Node, Leaf) + import AddTree as Tree (sum, Node, Leaf) gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2)))) \ No newline at end of file From da753a5babc8dbb2e22b98a63673d3a25d90b67c Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 20:05:13 -0500 Subject: [PATCH 38/68] added ext parsing --- .../src/Gibbon/Passes/FreshConstructors.hs | 29 ++++++++++++++- .../src/Gibbon/Passes/ModuleFillImports.hs | 36 +++++++++++++++++-- .../src/Gibbon/Passes/ModuleRename.hs | 32 ++++++++++++++++- 3 files changed, 93 insertions(+), 4 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs index 18477ca45..febd2899e 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs @@ -119,7 +119,34 @@ freshConstrsInExp exp constrenv = e2' <- freshConstrsInExp e2 constrenv e3' <- freshConstrsInExp e3 constrenv return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> return $ Ext ext + Ext ext -> case ext of + LambdaE args bod -> do + bod' <- freshConstrsInExp bod constrenv + return $ Ext $ LambdaE args bod' + PolyAppE a b -> do + return $ Ext $ PolyAppE a b + FunRefE tyapps f -> do + return $ Ext $ FunRefE tyapps f + BenchE fn tyapps args b -> do + args' <- mapM (\arg -> freshConstrsInExp arg constrenv) args + return $ Ext $ BenchE fn tyapps args' b + ParE0 ls -> do + ls' <- mapM (\l -> freshConstrsInExp l constrenv) ls + return $ Ext $ ParE0 ls' + PrintPacked ty arg -> do + arg' <- freshConstrsInExp arg constrenv + return $ Ext $ PrintPacked ty arg' + CopyPacked ty arg -> do + arg' <- freshConstrsInExp arg constrenv + return $ Ext $ CopyPacked ty arg' + TravPacked ty arg -> do + arg' <- freshConstrsInExp arg constrenv + return $ Ext $ TravPacked ty arg' + L p e -> do + e' <- freshConstrsInExp e constrenv + return $ Ext $ L p e' + LinearExt a -> do + return $ Ext $ LinearExt a -- diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index df412875c..c95e7760a 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -218,7 +218,7 @@ resolveModInExp exp defenv funenv constrenv = return $ CaseE e' mp' DataConE loc c es -> do - let c' = (fromVar (parseAndResolve (toVar c) constrenv)) + let c' = fromVar (parseAndResolve (toVar c) constrenv) es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es return $ DataConE loc c' es' @@ -242,7 +242,39 @@ resolveModInExp exp defenv funenv constrenv = e2' <- resolveModInExp e2 defenv funenv constrenv e3' <- resolveModInExp e3 defenv funenv constrenv return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> return $ Ext ext + --Ext ext -> return $ Ext ext + Ext ext -> case ext of + LambdaE args bod -> do + bod' <- resolveModInExp bod defenv funenv constrenv + return $ Ext $ LambdaE args bod' + PolyAppE a b -> do + return $ Ext $ PolyAppE a b + FunRefE tyapps f -> do + return $ Ext $ FunRefE tyapps f + BenchE fn tyapps args b -> do + args' <- mapM (\arg -> resolveModInExp arg defenv funenv constrenv) args + return $ Ext $ BenchE fn tyapps args' b + ParE0 ls -> do + ls' <- mapM (\l -> resolveModInExp l defenv funenv constrenv) ls + return $ Ext $ ParE0 ls' + PrintPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv constrenv + return $ Ext $ PrintPacked ty' arg' + CopyPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv constrenv + return $ Ext $ CopyPacked ty' arg' + TravPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv constrenv + return $ Ext $ TravPacked ty' arg' + L p e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ Ext $ L p e' + LinearExt a -> do + return $ Ext $ LinearExt a + -- environment interactions diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 218ad021a..98ccde891 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -176,7 +176,37 @@ resolveModInExp exp defenv funenv = e2' <- resolveModInExp e2 defenv funenv e3' <- resolveModInExp e3 defenv funenv return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> return $ Ext ext + Ext ext -> case ext of + LambdaE args bod -> do + bod' <- resolveModInExp bod defenv funenv + return $ Ext $ LambdaE args bod' + PolyAppE a b -> do + return $ Ext $ PolyAppE a b + FunRefE tyapps f -> do + return $ Ext $ FunRefE tyapps f + BenchE fn tyapps args b -> do + args' <- mapM (\arg -> resolveModInExp arg defenv funenv) args + return $ Ext $ BenchE fn tyapps args' b + ParE0 ls -> do + ls' <- mapM (\l -> resolveModInExp l defenv funenv) ls + return $ Ext $ ParE0 ls' + PrintPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv + return $ Ext $ PrintPacked ty' arg' + CopyPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv + return $ Ext $ CopyPacked ty' arg' + TravPacked ty arg -> do + let ty' = resolveModInTy ty defenv + arg' <- resolveModInExp arg defenv funenv + return $ Ext $ TravPacked ty' arg' + L p e -> do + e' <- resolveModInExp e defenv funenv + return $ Ext $ L p e' + LinearExt a -> do + return $ Ext $ LinearExt a -- environment interactions From f8863112eb40895c459f64b5474d0d0af474e11c Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 20:32:19 -0500 Subject: [PATCH 39/68] fixed an issue with LetE --- gibbon-compiler/ir.log | 2270 ----------------- .../src/Gibbon/Passes/ModuleFillImports.hs | 3 +- .../src/Gibbon/Passes/ModuleRename.hs | 6 +- 3 files changed, 5 insertions(+), 2274 deletions(-) delete mode 100644 gibbon-compiler/ir.log diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log deleted file mode 100644 index d7325d4eb..000000000 --- a/gibbon-compiler/ir.log +++ /dev/null @@ -1,2270 +0,0 @@ - ! Responding to env Var: GIBBON_DEBUG=4 - ! We set DEBUG based on command-line verbose arg: 4 -================================================================================ - -desugaring module: AddTree - -- imports: [] - -- aliases: fromList [] - -- imports: fromList [] - - [compiler] pipeline starting, parsed program: -================================================================================ -Prog {ddefs = [(AddTree.Tree, - DDef {tyName = "AddTree.Tree", - tyArgs = [], - dataCons = [("AddTree.Leaf", [(False, IntTy)]), - ("AddTree.Node", - [(False, PackedTy "AddTree.Tree" []), - (False, PackedTy "AddTree.Tree" [])])]})], - fundefs = [(AddTree.sum, - FunDef {funName = "AddTree.sum", - funArgs = [t], - funTy = ForAll [] (ArrowTy [PackedTy "AddTree.Tree" []] IntTy), - funBody = CaseE (VarE "t") - [("AddTree.Leaf", [(v, MetaTv $1)], VarE "v"), - ("AddTree.Node", - [(l, MetaTv $2),(r, MetaTv $3)], - PrimAppE AddP - [AppE "AddTree.sum" [] [VarE "l"], - AppE "AddTree.sum" [] [VarE "r"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing} - - [compiler] Running pass, freshConstructors -Pass output: -================================================================================ -data AddTree.Tree = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree.Tree []) (Packed AddTree.Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree.sum :: forall. ((Packed AddTree.Tree []) -> Int) -AddTree.sum t = - case t of - AddTree_Leaf_4 v::$1 -> - v - AddTree_Node_5 l::$2 r::$3 -> - (AddTree.sum [] l) + (AddTree.sum [] r) - - - [compiler] Running pass, renameModules -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t = - case t of - AddTree_Leaf_4 v::$1 -> - v - AddTree_Node_5 l::$2 r::$3 -> - (AddTree_sum_7 [] l) + (AddTree_sum_7 [] r) - - - [compiler] Running pass, freshen -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::$1 -> - v_9 - AddTree_Node_5 l_10::$2 r_11::$3 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, bindLambdas -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, monomorphize -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, specLambdas -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::Int -> - v_9 - AddTree_Node_5 l_10::(Packed AddTree_Tree_6 []) r_11::(Packed AddTree_Tree_6 []) -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - - - [compiler] Running pass, desugarL0 -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::() -> - v_9 - AddTree_Node_5 l_10::() r_11::() -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21::() -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 () y_22) - AddTree_Node_5 x_23::() x_24::() -> - let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 () y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28::() -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 () y_29) - AddTree_Node_5 x_30::() x_31::() -> - let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 () y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35::() -> - () - AddTree_Node_5 x_37::() x_38::() -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42::() -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47::() x_48::() -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, floatOutCase -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6 []) (Packed AddTree_Tree_6 []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: forall. ((Packed AddTree_Tree_6 []) -> Int) -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9::() -> - v_9 - AddTree_Node_5 l_10::() r_11::() -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21::() -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 () y_22) - AddTree_Node_5 x_23::() x_24::() -> - let y_25 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6 []) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 () y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> (Packed AddTree_Tree_6 [])) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28::() -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 () y_29) - AddTree_Node_5 x_30::() x_31::() -> - let y_32 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6 []) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 () y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35::() -> - () - AddTree_Node_5 x_37::() x_38::() -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: forall. ((Packed AddTree_Tree_6 []) -> ()) -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42::() -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47::() x_48::() -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, toL1 -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, benchMainExp -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -AddTree_sum_7 :: (Packed AddTree_Tree_6) -> Int -AddTree_sum_7 t_8 = - case t_8 of - AddTree_Leaf_4 v_9 -> - v_9 - AddTree_Node_5 l_10 r_11 -> - (AddTree_sum_7 [] l_10) + (AddTree_sum_7 [] r_11) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20 = - case arg_20 of - AddTree_Leaf_4 x_21 -> - let y_22 :: Int = x_21 in - (AddTree_Leaf_4 y_22) - AddTree_Node_5 x_23 x_24 -> - let y_25 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23) in - let y_26 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24) in - (AddTree_Node_5 y_25 y_26) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27 = - case arg_27 of - AddTree_Leaf_4 x_28 -> - let y_29 :: Int = x_28 in - (AddTree_Leaf_4 y_29) - AddTree_Node_5 x_30 x_31 -> - let y_32 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30) in - let y_33 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31) in - (AddTree_Node_5 y_32 y_33) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34 = - case arg_34 of - AddTree_Leaf_4 x_35 -> - () - AddTree_Node_5 x_37 x_38 -> - let y_39 :: () = (_traverse_AddTree_Tree_6 [] x_37) in - let y_40 :: () = (_traverse_AddTree_Tree_6 [] x_38) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41 = - case arg_41 of - AddTree_Leaf_4 x_42 -> - let wildcard_44 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46 :: () = printsym(" ") in - let y_43 :: () = printint(x_42) in - let wildcard_45 :: () = printsym(")") in - () - AddTree_Node_5 x_47 x_48 -> - let wildcard_51 :: () = printsym("(AddTree_Node_5") in - let wildcard_54 :: () = printsym(" ") in - let y_49 :: () = (_print_AddTree_Tree_6 [] x_47) in - let wildcard_53 :: () = printsym(" ") in - let y_50 :: () = (_print_AddTree_Tree_6 [] x_48) in - let wildcard_52 :: () = printsym(")") in - () - - - [compiler] Running pass, simplify -Removed unused functions: [Var "AddTree_sum_7"] -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59 = - case arg_20_59 of - AddTree_Leaf_4 x_21_60 -> - let y_22_61 :: Int = x_21_60 in - (AddTree_Leaf_4 y_22_61) - AddTree_Node_5 x_23_62 x_24_63 -> - let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in - let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in - (AddTree_Node_5 y_25_64 y_26_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = - case arg_27_66 of - AddTree_Leaf_4 x_28_67 -> - let y_29_68 :: Int = x_28_67 in - (AddTree_Leaf_4 y_29_68) - AddTree_Node_5 x_30_69 x_31_70 -> - let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in - let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in - (AddTree_Node_5 y_32_71 y_33_72) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73 = - case arg_34_73 of - AddTree_Leaf_4 x_35_74 -> - () - AddTree_Node_5 x_37_75 x_38_76 -> - let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in - let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79 = - case arg_41_79 of - AddTree_Leaf_4 x_42_80 -> - let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82 :: () = printsym(" ") in - let y_43_83 :: () = printint(x_42_80) in - let wildcard_45_84 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85 x_48_86 -> - let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88 :: () = printsym(" ") in - let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in - let wildcard_53_90 :: () = printsym(" ") in - let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in - let wildcard_52_92 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59 = - case arg_20_59 of - AddTree_Leaf_4 x_21_60 -> - let y_22_61 :: Int = x_21_60 in - (AddTree_Leaf_4 y_22_61) - AddTree_Node_5 x_23_62 x_24_63 -> - let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in - let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in - (AddTree_Node_5 y_25_64 y_26_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = - case arg_27_66 of - AddTree_Leaf_4 x_28_67 -> - let y_29_68 :: Int = x_28_67 in - (AddTree_Leaf_4 y_29_68) - AddTree_Node_5 x_30_69 x_31_70 -> - let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in - let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in - (AddTree_Node_5 y_32_71 y_33_72) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73 = - case arg_34_73 of - AddTree_Leaf_4 x_35_74 -> - () - AddTree_Node_5 x_37_75 x_38_76 -> - let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in - let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79 = - case arg_41_79 of - AddTree_Leaf_4 x_42_80 -> - let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82 :: () = printsym(" ") in - let y_43_83 :: () = printint(x_42_80) in - let wildcard_45_84 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85 x_48_86 -> - let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88 :: () = printsym(" ") in - let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in - let wildcard_53_90 :: () = printsym(" ") in - let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in - let wildcard_52_92 :: () = printsym(")") in - () - - - [compiler] Running pass, flatten -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59 = - case arg_20_59 of - AddTree_Leaf_4 x_21_60 -> - let y_22_61 :: Int = x_21_60 in - (AddTree_Leaf_4 y_22_61) - AddTree_Node_5 x_23_62 x_24_63 -> - let y_25_64 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62) in - let y_26_65 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63) in - (AddTree_Node_5 y_25_64 y_26_65) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66 = - case arg_27_66 of - AddTree_Leaf_4 x_28_67 -> - let y_29_68 :: Int = x_28_67 in - (AddTree_Leaf_4 y_29_68) - AddTree_Node_5 x_30_69 x_31_70 -> - let y_32_71 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69) in - let y_33_72 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70) in - (AddTree_Node_5 y_32_71 y_33_72) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73 = - case arg_34_73 of - AddTree_Leaf_4 x_35_74 -> - () - AddTree_Node_5 x_37_75 x_38_76 -> - let y_39_77 :: () = (_traverse_AddTree_Tree_6 [] x_37_75) in - let y_40_78 :: () = (_traverse_AddTree_Tree_6 [] x_38_76) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79 = - case arg_41_79 of - AddTree_Leaf_4 x_42_80 -> - let wildcard_44_81 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82 :: () = printsym(" ") in - let y_43_83 :: () = printint(x_42_80) in - let wildcard_45_84 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85 x_48_86 -> - let wildcard_51_87 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88 :: () = printsym(" ") in - let y_49_89 :: () = (_print_AddTree_Tree_6 [] x_47_85) in - let wildcard_53_90 :: () = printsym(" ") in - let y_50_91 :: () = (_print_AddTree_Tree_6 [] x_48_86) in - let wildcard_52_92 :: () = printsym(")") in - () - - - [compiler] Running pass, simplify -Removed unused functions: [] -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - let y_22_61_95 :: Int = x_21_60_94 in - (AddTree_Leaf_4 y_22_61_95) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - let y_29_68_102 :: Int = x_28_67_101 in - (AddTree_Leaf_4 y_29_68_102) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, inlineTriv -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 (Packed AddTree_Tree_6) (Packed AddTree_Tree_6) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: (Packed AddTree_Tree_6) = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> (Packed AddTree_Tree_6) -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: (Packed AddTree_Tree_6) = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: (Packed AddTree_Tree_6) -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, directL3 -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, unariser -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.flatten -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data AddTree_Tree_6 = AddTree_Leaf_4 Int | - AddTree_Node_5 Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_AddTree_Tree_6 :: Cursor -> Cursor -_copy_AddTree_Tree_6 arg_20_59_93 = - case arg_20_59_93 of - AddTree_Leaf_4 x_21_60_94 -> - (AddTree_Leaf_4 x_21_60_94) - AddTree_Node_5 x_23_62_96 x_24_63_97 -> - let y_25_64_98 :: Cursor = (_copy_AddTree_Tree_6 [] x_23_62_96) in - let y_26_65_99 :: Cursor = (_copy_AddTree_Tree_6 [] x_24_63_97) in - (AddTree_Node_5 y_25_64_98 y_26_65_99) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_AddTree_Tree_6 :: Cursor -> Cursor -_copy_without_ptrs_AddTree_Tree_6 arg_27_66_100 = - case arg_27_66_100 of - AddTree_Leaf_4 x_28_67_101 -> - (AddTree_Leaf_4 x_28_67_101) - AddTree_Node_5 x_30_69_103 x_31_70_104 -> - let y_32_71_105 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_30_69_103) in - let y_33_72_106 :: Cursor = (_copy_without_ptrs_AddTree_Tree_6 [] x_31_70_104) in - (AddTree_Node_5 y_32_71_105 y_33_72_106) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_AddTree_Tree_6 :: Cursor -> () -_traverse_AddTree_Tree_6 arg_34_73_107 = - case arg_34_73_107 of - AddTree_Leaf_4 x_35_74_108 -> - () - AddTree_Node_5 x_37_75_109 x_38_76_110 -> - let y_39_77_111 :: () = (_traverse_AddTree_Tree_6 [] x_37_75_109) in - let y_40_78_112 :: () = (_traverse_AddTree_Tree_6 [] x_38_76_110) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_AddTree_Tree_6 :: Cursor -> () -_print_AddTree_Tree_6 arg_41_79_113 = - case arg_41_79_113 of - AddTree_Leaf_4 x_42_80_114 -> - let wildcard_44_81_115 :: () = printsym("(AddTree_Leaf_4") in - let wildcard_46_82_116 :: () = printsym(" ") in - let y_43_83_117 :: () = printint(x_42_80_114) in - let wildcard_45_84_118 :: () = printsym(")") in - () - AddTree_Node_5 x_47_85_119 x_48_86_120 -> - let wildcard_51_87_121 :: () = printsym("(AddTree_Node_5") in - let wildcard_54_88_122 :: () = printsym(" ") in - let y_49_89_123 :: () = (_print_AddTree_Tree_6 [] x_47_85_119) in - let wildcard_53_90_124 :: () = printsym(" ") in - let y_50_91_125 :: () = (_print_AddTree_Tree_6 [] x_48_86_120) in - let wildcard_52_92_126 :: () = printsym(")") in - () - - - [compiler] Running pass, lower -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_6", - [("AddTree_Leaf_4", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("AddTree_Node_5", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), - (129, "(AddTree_Leaf_4"),(130, " ")], - fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", - funArgs = [(arg_20_59_93, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), - (tail_132, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_20_59_93"], - bod = Switch "switch_135" - (VarTriv "tag_131") - (IntAlts [(0, - LetUnpackT {binds = [(x_21_60_94, - IntTy)], - ptr = "tail_132", - bod = LetAllocT {lhs = "tailift_133", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_21_60_94")], - bod = RetValsT [VarTriv "tailift_133"]}}), - (1, - LetUnpackT {binds = [(x_23_62_96, - CursorTy), - (x_24_63_97, - CursorTy)], - ptr = "tail_132", - bod = LetCallT {async = False, - binds = [(y_25_64_98, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_23_62_96"], - bod = LetCallT {async = False, - binds = [(y_26_65_99, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_24_63_97"], - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_25_64_98"), - (CursorTy, - VarTriv "y_26_65_99")], - bod = RetValsT [VarTriv "tailift_134"]}}}})]) - (Just ErrT "Unknown tag in: tag_131")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", - funArgs = [(arg_27_66_100, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), - (tail_137, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_27_66_100"], - bod = Switch "switch_140" - (VarTriv "tag_136") - (IntAlts [(0, - LetUnpackT {binds = [(x_28_67_101, - IntTy)], - ptr = "tail_137", - bod = LetAllocT {lhs = "tailift_138", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_28_67_101")], - bod = RetValsT [VarTriv "tailift_138"]}}), - (1, - LetUnpackT {binds = [(x_30_69_103, - CursorTy), - (x_31_70_104, - CursorTy)], - ptr = "tail_137", - bod = LetCallT {async = False, - binds = [(y_32_71_105, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_30_69_103"], - bod = LetCallT {async = False, - binds = [(y_33_72_106, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_31_70_104"], - bod = LetAllocT {lhs = "tailift_139", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_32_71_105"), - (CursorTy, - VarTriv "y_33_72_106")], - bod = RetValsT [VarTriv "tailift_139"]}}}})]) - (Just ErrT "Unknown tag in: tag_136")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_6", - funArgs = [(arg_34_73_107, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), - (tail_142, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_34_73_107"], - bod = Switch "switch_143" - (VarTriv "tag_141") - (IntAlts [(0, - LetUnpackT {binds = [(x_35_74_108, - IntTy)], - ptr = "tail_142", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_37_75_109, - CursorTy), - (x_38_76_110, - CursorTy)], - ptr = "tail_142", - bod = LetCallT {async = False, - binds = [(y_39_77_111, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_37_75_109"], - bod = LetCallT {async = False, - binds = [(y_40_78_112, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_38_76_110"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_141")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_6", - funArgs = [(arg_41_79_113, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), - (tail_145, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_41_79_113"], - bod = Switch "switch_146" - (VarTriv "tag_144") - (IntAlts [(0, - LetUnpackT {binds = [(x_42_80_114, - IntTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_44_81_115, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 129], - bod = LetPrimCallT {binds = [(wildcard_46_82_116, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetPrimCallT {binds = [(y_43_83_117, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_42_80_114"], - bod = LetPrimCallT {binds = [(wildcard_45_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_47_85_119, - CursorTy), - (x_48_86_120, - CursorTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_51_87_121, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 128], - bod = LetPrimCallT {binds = [(wildcard_54_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_49_89_123, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_47_85_119"], - bod = LetPrimCallT {binds = [(wildcard_53_90_124, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_50_91_125, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_48_86_120"], - bod = LetPrimCallT {binds = [(wildcard_52_92_126, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_144")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Running pass, lateInlineTriv -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_6", - [("AddTree_Leaf_4", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("AddTree_Node_5", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), - (129, "(AddTree_Leaf_4"),(130, " ")], - fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", - funArgs = [(arg_20_59_93, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), - (tail_132, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_20_59_93"], - bod = Switch "switch_135" - (VarTriv "tag_131") - (IntAlts [(0, - LetUnpackT {binds = [(x_21_60_94, - IntTy)], - ptr = "tail_132", - bod = LetAllocT {lhs = "tailift_133", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_21_60_94")], - bod = RetValsT [VarTriv "tailift_133"]}}), - (1, - LetUnpackT {binds = [(x_23_62_96, - CursorTy), - (x_24_63_97, - CursorTy)], - ptr = "tail_132", - bod = LetCallT {async = False, - binds = [(y_25_64_98, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_23_62_96"], - bod = LetCallT {async = False, - binds = [(y_26_65_99, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_24_63_97"], - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_25_64_98"), - (CursorTy, - VarTriv "y_26_65_99")], - bod = RetValsT [VarTriv "tailift_134"]}}}})]) - (Just ErrT "Unknown tag in: tag_131")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", - funArgs = [(arg_27_66_100, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), - (tail_137, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_27_66_100"], - bod = Switch "switch_140" - (VarTriv "tag_136") - (IntAlts [(0, - LetUnpackT {binds = [(x_28_67_101, - IntTy)], - ptr = "tail_137", - bod = LetAllocT {lhs = "tailift_138", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_28_67_101")], - bod = RetValsT [VarTriv "tailift_138"]}}), - (1, - LetUnpackT {binds = [(x_30_69_103, - CursorTy), - (x_31_70_104, - CursorTy)], - ptr = "tail_137", - bod = LetCallT {async = False, - binds = [(y_32_71_105, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_30_69_103"], - bod = LetCallT {async = False, - binds = [(y_33_72_106, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_31_70_104"], - bod = LetAllocT {lhs = "tailift_139", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_32_71_105"), - (CursorTy, - VarTriv "y_33_72_106")], - bod = RetValsT [VarTriv "tailift_139"]}}}})]) - (Just ErrT "Unknown tag in: tag_136")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_6", - funArgs = [(arg_34_73_107, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), - (tail_142, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_34_73_107"], - bod = Switch "switch_143" - (VarTriv "tag_141") - (IntAlts [(0, - LetUnpackT {binds = [(x_35_74_108, - IntTy)], - ptr = "tail_142", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_37_75_109, - CursorTy), - (x_38_76_110, - CursorTy)], - ptr = "tail_142", - bod = LetCallT {async = False, - binds = [(y_39_77_111, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_37_75_109"], - bod = LetCallT {async = False, - binds = [(y_40_78_112, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_38_76_110"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_141")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_6", - funArgs = [(arg_41_79_113, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), - (tail_145, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_41_79_113"], - bod = Switch "switch_146" - (VarTriv "tag_144") - (IntAlts [(0, - LetUnpackT {binds = [(x_42_80_114, - IntTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_44_81_115, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 129], - bod = LetPrimCallT {binds = [(wildcard_46_82_116, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetPrimCallT {binds = [(y_43_83_117, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_42_80_114"], - bod = LetPrimCallT {binds = [(wildcard_45_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_47_85_119, - CursorTy), - (x_48_86_120, - CursorTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_51_87_121, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 128], - bod = LetPrimCallT {binds = [(wildcard_54_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_49_89_123, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_47_85_119"], - bod = LetPrimCallT {binds = [(wildcard_53_90_124, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_50_91_125, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_48_86_120"], - bod = LetPrimCallT {binds = [(wildcard_52_92_126, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_144")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Running pass, rearrangeFree -Pass output: -================================================================================ -Prog {infoTable = [("AddTree_Tree_6", - [("AddTree_Leaf_4", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("AddTree_Node_5", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(127, ")"),(128, "(AddTree_Node_5"), - (129, "(AddTree_Leaf_4"),(130, " ")], - fundefs = [FunDecl {funName = "_copy_AddTree_Tree_6", - funArgs = [(arg_20_59_93, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_131, TagTyPacked), - (tail_132, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_20_59_93"], - bod = Switch "switch_135" - (VarTriv "tag_131") - (IntAlts [(0, - LetUnpackT {binds = [(x_21_60_94, - IntTy)], - ptr = "tail_132", - bod = LetAllocT {lhs = "tailift_133", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_21_60_94")], - bod = RetValsT [VarTriv "tailift_133"]}}), - (1, - LetUnpackT {binds = [(x_23_62_96, - CursorTy), - (x_24_63_97, - CursorTy)], - ptr = "tail_132", - bod = LetCallT {async = False, - binds = [(y_25_64_98, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_23_62_96"], - bod = LetCallT {async = False, - binds = [(y_26_65_99, - CursorTy)], - rator = "_copy_AddTree_Tree_6", - rands = [VarTriv "x_24_63_97"], - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_25_64_98"), - (CursorTy, - VarTriv "y_26_65_99")], - bod = RetValsT [VarTriv "tailift_134"]}}}})]) - (Just ErrT "Unknown tag in: tag_131")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_AddTree_Tree_6", - funArgs = [(arg_27_66_100, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_136, TagTyPacked), - (tail_137, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_27_66_100"], - bod = Switch "switch_140" - (VarTriv "tag_136") - (IntAlts [(0, - LetUnpackT {binds = [(x_28_67_101, - IntTy)], - ptr = "tail_137", - bod = LetAllocT {lhs = "tailift_138", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_28_67_101")], - bod = RetValsT [VarTriv "tailift_138"]}}), - (1, - LetUnpackT {binds = [(x_30_69_103, - CursorTy), - (x_31_70_104, - CursorTy)], - ptr = "tail_137", - bod = LetCallT {async = False, - binds = [(y_32_71_105, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_30_69_103"], - bod = LetCallT {async = False, - binds = [(y_33_72_106, - CursorTy)], - rator = "_copy_without_ptrs_AddTree_Tree_6", - rands = [VarTriv "x_31_70_104"], - bod = LetAllocT {lhs = "tailift_139", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_32_71_105"), - (CursorTy, - VarTriv "y_33_72_106")], - bod = RetValsT [VarTriv "tailift_139"]}}}})]) - (Just ErrT "Unknown tag in: tag_136")}, - isPure = True}, - FunDecl {funName = "_traverse_AddTree_Tree_6", - funArgs = [(arg_34_73_107, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_141, TagTyPacked), - (tail_142, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_34_73_107"], - bod = Switch "switch_143" - (VarTriv "tag_141") - (IntAlts [(0, - LetUnpackT {binds = [(x_35_74_108, - IntTy)], - ptr = "tail_142", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_37_75_109, - CursorTy), - (x_38_76_110, - CursorTy)], - ptr = "tail_142", - bod = LetCallT {async = False, - binds = [(y_39_77_111, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_37_75_109"], - bod = LetCallT {async = False, - binds = [(y_40_78_112, - ProdTy [])], - rator = "_traverse_AddTree_Tree_6", - rands = [VarTriv "x_38_76_110"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_141")}, - isPure = True}, - FunDecl {funName = "_print_AddTree_Tree_6", - funArgs = [(arg_41_79_113, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_144, TagTyPacked), - (tail_145, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_41_79_113"], - bod = Switch "switch_146" - (VarTriv "tag_144") - (IntAlts [(0, - LetUnpackT {binds = [(x_42_80_114, - IntTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_44_81_115, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 129], - bod = LetPrimCallT {binds = [(wildcard_46_82_116, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetPrimCallT {binds = [(y_43_83_117, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_42_80_114"], - bod = LetPrimCallT {binds = [(wildcard_45_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_47_85_119, - CursorTy), - (x_48_86_120, - CursorTy)], - ptr = "tail_145", - bod = LetPrimCallT {binds = [(wildcard_51_87_121, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 128], - bod = LetPrimCallT {binds = [(wildcard_54_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_49_89_123, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_47_85_119"], - bod = LetPrimCallT {binds = [(wildcard_53_90_124, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 130], - bod = LetCallT {async = False, - binds = [(y_50_91_125, - ProdTy [])], - rator = "_print_AddTree_Tree_6", - rands = [VarTriv "x_48_86_120"], - bod = LetPrimCallT {binds = [(wildcard_52_92_126, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 127], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_144")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Final C codegen: 9069 characters. -================================================================================ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef struct GibIntProd_struct { - GibInt field0; - } GibIntProd; -typedef struct GibIntGibIntProd_struct { - GibInt field0; - GibInt field1; - } GibIntGibIntProd; -typedef struct GibIntGibCursorGibCursorProd_struct { - GibInt field0; - GibCursor field1; - GibCursor field2; - } GibIntGibCursorGibCursorProd; -typedef struct GibPackedTagGibCursorProd_struct { - GibPackedTag field0; - GibCursor field1; - } GibPackedTagGibCursorProd; -typedef struct GibCursorProd_struct { - GibCursor field0; - } GibCursorProd; -typedef struct GibCursorGibCursorProd_struct { - GibCursor field0; - GibCursor field1; - } GibCursorGibCursorProd; -GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93); -GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100); -unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107); -unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113); -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - AddTree_Tree_6_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(8); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[1]; - - error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 0, 8, 0, 1, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_6_T, 0); - exit(1); - } - error = gib_info_table_insert_packed_dcon(AddTree_Tree_6_T, 1, 0, 2, 0, 0, - field_tys, 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, AddTree_Tree_6_T, 1); - exit(1); - } - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ - gib_add_symbol(127, ")"); - gib_add_symbol(128, "(AddTree_Node_5"); - gib_add_symbol(129, "(AddTree_Leaf_4"); - gib_add_symbol(130, " "); -} -GibCursor _copy_AddTree_Tree_6(GibCursor arg_20_59_93) -{ - GibPackedTag tag_131 = *(GibPackedTag *) arg_20_59_93; - GibCursor tail_132 = arg_20_59_93 + sizeof(GibInt); - - - switch_135: - ; - switch (tag_131) { - - case 0: - { - GibInt x_21_60_94 = ((GibIntProd *) tail_132)->field0; - GibPtr tailift_133 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_133)->field0 = 0; - ((GibIntGibIntProd *) tailift_133)->field1 = x_21_60_94; - return tailift_133; - break; - } - - case 1: - { - GibCursor x_23_62_96 = - ((GibCursorGibCursorProd *) tail_132)->field0; - GibCursor x_24_63_97 = - ((GibCursorGibCursorProd *) tail_132)->field1; - GibCursor y_25_64_98 = _copy_AddTree_Tree_6(x_23_62_96); - GibCursor y_26_65_99 = _copy_AddTree_Tree_6(x_24_63_97); - GibPtr tailift_134 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_134)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_134)->field1 = y_25_64_98; - ((GibIntGibCursorGibCursorProd *) tailift_134)->field2 = y_26_65_99; - return tailift_134; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_131"); - exit(1); - } - } -} -GibCursor _copy_without_ptrs_AddTree_Tree_6(GibCursor arg_27_66_100) -{ - GibPackedTag tag_136 = *(GibPackedTag *) arg_27_66_100; - GibCursor tail_137 = arg_27_66_100 + sizeof(GibInt); - - - switch_140: - ; - switch (tag_136) { - - case 0: - { - GibInt x_28_67_101 = ((GibIntProd *) tail_137)->field0; - GibPtr tailift_138 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_138)->field0 = 0; - ((GibIntGibIntProd *) tailift_138)->field1 = x_28_67_101; - return tailift_138; - break; - } - - case 1: - { - GibCursor x_30_69_103 = - ((GibCursorGibCursorProd *) tail_137)->field0; - GibCursor x_31_70_104 = - ((GibCursorGibCursorProd *) tail_137)->field1; - GibCursor y_32_71_105 = - _copy_without_ptrs_AddTree_Tree_6(x_30_69_103); - GibCursor y_33_72_106 = - _copy_without_ptrs_AddTree_Tree_6(x_31_70_104); - GibPtr tailift_139 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_139)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_139)->field1 = - y_32_71_105; - ((GibIntGibCursorGibCursorProd *) tailift_139)->field2 = - y_33_72_106; - return tailift_139; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_136"); - exit(1); - } - } -} -unsigned char _traverse_AddTree_Tree_6(GibCursor arg_34_73_107) -{ - GibPackedTag tag_141 = *(GibPackedTag *) arg_34_73_107; - GibCursor tail_142 = arg_34_73_107 + sizeof(GibInt); - - - switch_143: - ; - switch (tag_141) { - - case 0: - { - GibInt x_35_74_108 = ((GibIntProd *) tail_142)->field0; - - return 0; - break; - } - - case 1: - { - GibCursor x_37_75_109 = - ((GibCursorGibCursorProd *) tail_142)->field0; - GibCursor x_38_76_110 = - ((GibCursorGibCursorProd *) tail_142)->field1; - unsigned char y_39_77_111 = _traverse_AddTree_Tree_6(x_37_75_109); - unsigned char y_40_78_112 = _traverse_AddTree_Tree_6(x_38_76_110); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_141"); - exit(1); - } - } -} -unsigned char _print_AddTree_Tree_6(GibCursor arg_41_79_113) -{ - GibPackedTag tag_144 = *(GibPackedTag *) arg_41_79_113; - GibCursor tail_145 = arg_41_79_113 + sizeof(GibInt); - - - switch_146: - ; - switch (tag_144) { - - case 0: - { - GibInt x_42_80_114 = ((GibIntProd *) tail_145)->field0; - unsigned char wildcard_44_81_115 = gib_print_symbol(129); - unsigned char wildcard_46_82_116 = gib_print_symbol(130); - unsigned char y_43_83_117 = printf("%ld", x_42_80_114); - unsigned char wildcard_45_84_118 = gib_print_symbol(127); - - return 0; - break; - } - - case 1: - { - GibCursor x_47_85_119 = - ((GibCursorGibCursorProd *) tail_145)->field0; - GibCursor x_48_86_120 = - ((GibCursorGibCursorProd *) tail_145)->field1; - unsigned char wildcard_51_87_121 = gib_print_symbol(128); - unsigned char wildcard_54_88_122 = gib_print_symbol(130); - unsigned char y_49_89_123 = _print_AddTree_Tree_6(x_47_85_119); - unsigned char wildcard_53_90_124 = gib_print_symbol(130); - unsigned char y_50_91_125 = _print_AddTree_Tree_6(x_48_86_120); - unsigned char wildcard_52_92_126 = gib_print_symbol(127); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_144"); - exit(1); - } - } -} -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - int exit_1 = gib_exit(); - - return exit_1; -} - -Compiling RTS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -make -f /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 - -codegen: C RTS could not be compiled: -make: /home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile: No such file or directory -make: *** No rule to make target '/home/timmy/git/gibbon/gibbon-compiler/gibbon-rts/Makefile'. Stop. - -Code: 2 diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index c95e7760a..676b24234 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -191,9 +191,10 @@ resolveModInExp exp defenv funenv constrenv = return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do + let ty' = resolveModInTy ty defenv e1' <- resolveModInExp e1 defenv funenv constrenv e2' <- resolveModInExp e2 defenv funenv constrenv - return $ LetE (v, [], ty, e1') e2' + return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do e1' <- resolveModInExp e1 defenv funenv constrenv diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 98ccde891..34472f7bd 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -118,8 +118,7 @@ resolveModInExp exp defenv funenv = VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) AppE v locs ls -> do - let (mod, fun) = parseOutMod v - let v' = resolveNameInEnv mod fun funenv + let v' = parseAndResolve v funenv ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls return $ AppE v' locs ls' @@ -128,9 +127,10 @@ resolveModInExp exp defenv funenv = return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do + let ty' = resolveModInTy ty defenv e1' <- resolveModInExp e1 defenv funenv e2' <- resolveModInExp e2 defenv funenv - return $ LetE (v, [], ty, e1') e2' + return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do e1' <- resolveModInExp e1 defenv funenv From fc54de825a4135de272c612fbc3ea40a68d4857a Mon Sep 17 00:00:00 2001 From: timmy Date: Sun, 10 Dec 2023 21:09:24 -0500 Subject: [PATCH 40/68] some oddness --- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 1 + gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 66c9aaa22..ca6369e7b 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -323,6 +323,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports (defs'', funs''''') imported_progs' return $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + dbgPrintLn 2 $ "===" pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 676b24234..1f7671a93 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -40,7 +40,8 @@ fillImports (Prog defs funs main) localMod imports imported_progs = Just spec -> if (elem name spec) then acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] else acc Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] - Nothing -> error $ "could not find module or alias: " ++ (show modName) + --Nothing -> error $ "could not find module or alias: " ++ (show modName) ++ " for name " ++ (show v) ++ " in " ++ (show importMeta) + Nothing -> acc Nothing -> error "how did we get here?" let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs From fbeca9522c7c8f97f56a54aab9cfc4967c9a8739 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 11 Jan 2024 07:13:08 -0500 Subject: [PATCH 41/68] more bug fixing --- gibbon-compiler/examples/imports/failing.md | 61 +++++++++++++++++++ gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 17 +++--- .../src/Gibbon/Passes/ModuleFillImports.hs | 34 ++++++++--- .../src/Gibbon/Passes/ModuleRename.hs | 20 ++++-- 4 files changed, 110 insertions(+), 22 deletions(-) create mode 100644 gibbon-compiler/examples/imports/failing.md diff --git a/gibbon-compiler/examples/imports/failing.md b/gibbon-compiler/examples/imports/failing.md new file mode 100644 index 000000000..cf4309c80 --- /dev/null +++ b/gibbon-compiler/examples/imports/failing.md @@ -0,0 +1,61 @@ +# Poly +### `/poly/Poly1.hs` + +Problem seems to be with the type names, numbers and Nothing, Cons, Nil, Right all match + +``` +< '#(10 #t 11 #f 2 4 (Poly1_Nothing_77_v_323) (Poly1_Right_76_v_342 20) (Poly1_Right_76_v_334 1) 12 #f 0 3 (Poly1_Cons_74_v_329 1 (Poly1_Cons_74_v_329 2 (Poly1_Nil_73_v_329))) (Poly1_Cons_74_v_329 1 (Poly1_Cons_74_v_329 2 (Poly1_Nil_73_v_329))) (Poly1_Right_76_v_334 1) (Poly1_Cons_74_v_329 11 (Poly1_Cons_74_v_329 12 (Poly1_Nil_73_v_329)))) +--- +> '#(10 #t 11 #f 2 4 (Nothing_v_295 ) (Right_v_315 20) (Right_v_306 1) 12 #f 0 3 (Cons_v_301 1(Cons_v_301 2(Nil_v_301 ))) (Cons_v_301 1(Cons_v_301 2(Nil_v_301 ))) (Right_v_306 1) (Cons_v_301 11(Cons_v_301 12(Nil_v_301 )))) +\ No newline at end of file +``` + +# Eval l/r +### `eval_l.hs` + +### `eval_r.hs` + +these are failing to properly import a module in interp mode this seems to stem from the fact the the imported file does not have a module declaration,,, so internally it renames with "Main" but the true Main module expects "Eval" b/c that's the name in the import statement. + +solving this by having the Main module tell each imported module how to name themselves ... this I think could get convoluted b/c a module decalred internally as A could be imported as B ... perhaps a subjective design decision but this seems to work + +# ArrowTy +### `layout1ContentSearch.hs` +``` +Couldn't match type 'ArrowTy [VectorTy (MetaTv $839)] + IntTy' with 'IntTy' + Expected type: IntTy + Actual type: ArrowTy [VectorTy (MetaTv $839)] IntTy + In the expression: + VarE "Gibbon_Vector_length_132" in Var "GenerateLayout1_mkBlogs_layout1_107" +``` + +This all seems to come from a similair pattern but it looks like the bug doesn't have anything to do with the error. The issue is scope: `Gibbon_Vector_length_132` is some global name but there is a `length` that is one of the function arguements. The rename pass matches length to the global function, causing the error. My solution was to force the global name to be qualified within the scope where `length` exists. So the global `Gibbon.Vector.length` can be accessed if qualified, but simple reference to `length` will use the function arguement `length` + +### `layout1ContentSearchRunPipeline.hs` + +### `layout1FilterBlogs.hs` + +### `layout1TagSearch.hs` + +### `layout2ContentSearch.hs` + +### `layout2FilterBlogs.hs` + +### `layout2TagSearch.hs` + +### `layout3ContentSearch.hs` + +### `layout3FilterBlogs.hs` + +### `layout3TagSearch.hs` + +### `layout4ContentSearch.hs` + +### `layout4FilterBlogs.hs` + +### `layout4TagSearch.hs` + +### `layout5ContentSearch.hs` + +### `layout5FilterBlogs.hs` \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index ca6369e7b..4cbb3da7d 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -68,7 +68,7 @@ it expects A.B.D to be at A/B/A/B/D.hs. parseFile :: Config -> FilePath -> IO (PassM Prog0) parseFile cfg path = do pstate0_ref <- newIORef emptyParseState - parseFile' cfg pstate0_ref [] path + parseFile' cfg pstate0_ref [] path "Main" data ParseState = ParseState @@ -90,8 +90,8 @@ parseMode = } parseFile' :: - Config -> IORef ParseState -> [String] -> FilePath -> IO (PassM Prog0) -parseFile' cfg pstate_ref import_route path = do + Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM Prog0) +parseFile' cfg pstate_ref import_route path mod_name = do when (gopt Opt_GhcTc (dynflags cfg)) $ typecheckWithGhc cfg path str <- readFile path let cleaned = removeLinearArrows str @@ -100,7 +100,7 @@ parseFile' cfg pstate_ref import_route path = do parseFileContentsWithCommentsAndCPP defaultCpphsOptions parseMode cleaned case parsed of ParseOk (hs, _comments) -> - desugarModule cfg pstate_ref import_route (takeDirectory path) hs + desugarModule cfg pstate_ref import_route (takeDirectory path) hs mod_name ParseFailed loc er -> do error ("haskell-src-exts failed: " ++ er ++ ", at " ++ prettyPrint loc) @@ -222,8 +222,9 @@ desugarModule :: -> [String] -> FilePath -> Module a + -> String -> IO (PassM Prog0) -desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) = do +desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) mod_name = do let type_syns = foldl collectTypeSynonyms M.empty decls -- Since top-level functions and their types can't be declared in -- single top-level declaration we first collect types and then collect @@ -327,7 +328,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) - mod_name = moduleName head_mb + --mod_name = moduleName head_mb import_names = (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ _ _) -> importName) imports) aliases = M.fromList (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ aliased _) -> @@ -439,7 +440,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports in case element of Nothing -> fn Just dcon -> fn {funMeta = funMeta {funOptLayout = Single dcon}} -desugarModule _ _ _ _ m = error $ "desugarModule: " ++ prettyPrint m +desugarModule _ _ _ _ m _ = error $ "desugarModule: " ++ prettyPrint m stdlibModules :: [String] stdlibModules = @@ -488,7 +489,7 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} pure prog Nothing -> do dbgTrace 5 ("Importing " ++ mod_name ++ " from " ++ mod_fp) (pure ()) - prog0 <- parseFile' cfg pstate_ref import_route mod_fp + prog0 <- parseFile' cfg pstate_ref import_route mod_fp mod_name (ParseState imported') <- readIORef pstate_ref let (prog0', _) = defaultRunPassM prog0 let imported'' = M.insert (mod_name, mod_fp) prog0' imported' diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 1f7671a93..836a32d42 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -41,7 +41,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = else acc Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] --Nothing -> error $ "could not find module or alias: " ++ (show modName) ++ " for name " ++ (show v) ++ " in " ++ (show importMeta) - Nothing -> acc + Nothing -> acc ++ [(name, (v, False))] Nothing -> error "how did we get here?" let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs @@ -78,8 +78,8 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- main main' <- case main of Nothing -> return Nothing - Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) - m' <- resolveModInExp m defenv funenv constrenv + Just (m,ty) -> do --error $ "fun env: " ++ (show importedFuns) ++ "\n import meta" ++ (show importMeta) + m' <- (resolveModInExp m defenv funenv constrenv) return $ Just (m',ty) @@ -133,7 +133,8 @@ resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv constrenv = do let nam' = parseAndResolve nam funenv let funty' = resolveModsInTyScheme funty defenv - bod' <- resolveModInExp bod defenv funenv constrenv + let funenv' = foldr appendEnv funenv nargs + bod' <- resolveModInExp bod defenv funenv' constrenv pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme @@ -163,7 +164,7 @@ resolveModInTy ty defenv = ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) - ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) $ resolveModInTy t defenv + ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) (resolveModInTy t defenv) PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys @@ -184,7 +185,7 @@ resolveModInExp exp defenv funenv constrenv = AppE v locs ls -> do let v' = parseAndResolve v funenv - ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls + ls' <- traverse (\e -> resolveModInExp e defenv funenv constrenv) ls return $ AppE v' locs ls' PrimAppE p es -> do @@ -192,9 +193,10 @@ resolveModInExp exp defenv funenv constrenv = return $ PrimAppE p es' LetE (v,_locs,ty, e1) e2 -> do + let funenv' = appendEnv v funenv let ty' = resolveModInTy ty defenv - e1' <- resolveModInExp e1 defenv funenv constrenv - e2' <- resolveModInExp e2 defenv funenv constrenv + e1' <- resolveModInExp e1 defenv funenv' constrenv + e2' <- resolveModInExp e2 defenv funenv' constrenv return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do @@ -281,6 +283,20 @@ resolveModInExp exp defenv funenv constrenv = -- environment interactions +appendEnv :: Var -> VarEnv -> VarEnv +appendEnv v env = + case (M.lookup v env) of + Just m -> case foldr findUnqualified (False, "") m of + (True, n) -> do + let (mod, _) = parseOutMod n + case mod of + Just modname -> do + (M.insert v (M.insert (toVar "") (v, False) (M.insert modname (n, True) m)) env) + Nothing -> do + (M.insert v (M.insert (toVar "") (v, False) m) env) + (False, _) -> (M.insert v (M.insert (toVar "") (v, False) m) env) + Nothing -> (M.insert v (M.singleton (toVar "") (v, False)) env) + buildEnv :: VarEnv -> Var -> (Var, Bool) -> (VarEnv, (Var, Bool)) buildEnv env k v = do let (mod, name) = parseOutMod k @@ -323,5 +339,5 @@ resolveNameInEnv mod name e = findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) findUnqualified (n, q) (acc, out) = if (not q) && (not acc) then (True, n) - else if (not q) && acc then error $ "Ambiguous reference" + else if (not q) && acc then error $ "Ambiguous reference : " ++ (fromVar n) ++ " and " ++ (fromVar out) else (acc, out) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs index 34472f7bd..7a4c92b99 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs @@ -69,7 +69,8 @@ resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = do let nam' = parseAndResolve nam funenv let funty' = resolveModsInTyScheme funty defenv - bod' <- resolveModInExp bod defenv funenv + let funenv' = foldr appendEnv funenv nargs + bod' <- resolveModInExp bod defenv funenv' pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme @@ -128,8 +129,9 @@ resolveModInExp exp defenv funenv = LetE (v,_locs,ty, e1) e2 -> do let ty' = resolveModInTy ty defenv - e1' <- resolveModInExp e1 defenv funenv - e2' <- resolveModInExp e2 defenv funenv + let funenv' = appendEnv v funenv + e1' <- resolveModInExp e1 defenv funenv' + e2' <- resolveModInExp e2 defenv funenv' return $ LetE (v, [], ty', e1') e2' IfE e1 e2 e3 -> do @@ -211,6 +213,12 @@ resolveModInExp exp defenv funenv = -- environment interactions +appendEnv :: Var -> VarEnv -> VarEnv +appendEnv v env = + case (M.lookup v env) of + Just m -> (M.insert v (M.insert (toVar "") v m) env) + Nothing -> (M.insert v (M.singleton (toVar "") v) env) + buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) buildEnv env k v = do let (mod, name) = parseOutMod k @@ -242,8 +250,10 @@ resolveNameInEnv mod name e = Just m -> case (M.lookup m modspace) of Just n -> n Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) - Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find " ++ (fromVar name) + Nothing -> case (M.lookup (toVar "") modspace) of + Just n -> n + Nothing -> if(M.size modspace == 1) then head $ M.elems modspace + else error $ "can't find/ambiguous reference " ++ (fromVar name) Nothing -> case mod of Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) Nothing -> name From c3232d46a9562638c36451a83004ab02b212e508 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 11 Jan 2024 08:43:44 -0500 Subject: [PATCH 42/68] add fixed linear ext handling --- .../src/Gibbon/Passes/ModuleFillImports.hs | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs index 836a32d42..ae9db7746 100644 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs @@ -41,7 +41,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = else acc Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] --Nothing -> error $ "could not find module or alias: " ++ (show modName) ++ " for name " ++ (show v) ++ " in " ++ (show importMeta) - Nothing -> acc ++ [(name, (v, False))] + Nothing -> acc ++ [(v, (v, False))] Nothing -> error "how did we get here?" let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs @@ -78,7 +78,7 @@ fillImports (Prog defs funs main) localMod imports imported_progs = -- main main' <- case main of Nothing -> return Nothing - Just (m,ty) -> do --error $ "fun env: " ++ (show importedFuns) ++ "\n import meta" ++ (show importMeta) + Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) m' <- (resolveModInExp m defenv funenv constrenv) return $ Just (m',ty) @@ -131,11 +131,11 @@ resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM (FunDef Exp0) resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv constrenv = do - let nam' = parseAndResolve nam funenv - let funty' = resolveModsInTyScheme funty defenv - let funenv' = foldr appendEnv funenv nargs - bod' <- resolveModInExp bod defenv funenv' constrenv - pure $ FunDef nam' nargs funty' bod' meta + let nam' = parseAndResolve nam funenv + let funty' = resolveModsInTyScheme funty defenv + let funenv' = foldr appendEnv funenv nargs + bod' <- resolveModInExp bod defenv funenv' constrenv + pure $ FunDef nam' nargs funty' bod' meta resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme resolveModsInTyScheme (ForAll tvs ty) defenv = do @@ -276,8 +276,22 @@ resolveModInExp exp defenv funenv constrenv = L p e -> do e' <- resolveModInExp e defenv funenv constrenv return $ Ext $ L p e' - LinearExt a -> do - return $ Ext $ LinearExt a + LinearExt a -> case a of + ReverseAppE e1 e2 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + return $ Ext $ LinearExt (ReverseAppE e1' e2') + LseqE e1 e2 -> do + e1' <- resolveModInExp e1 defenv funenv constrenv + e2' <- resolveModInExp e2 defenv funenv constrenv + return $ Ext $ LinearExt (ReverseAppE e1' e2') + AliasE e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ Ext $ LinearExt (AliasE e') + ToLinearE e -> do + e' <- resolveModInExp e defenv funenv constrenv + return $ Ext $ LinearExt (ToLinearE e') + @@ -320,6 +334,7 @@ parseOutMod v = do case (L.elemIndices '.' str) of [] -> (Nothing, v) x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) + --x -> (Just (toVar (L.drop ((L.last x)+1) str)), (toVar (L.take (L.last x) str))) resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var resolveNameInEnv mod name e = From 8ce0e24f40aec266ed6a003a8b570b62d10d0e95 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 11 Jan 2024 09:54:56 -0500 Subject: [PATCH 43/68] let _default contructors pass through --- gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs index febd2899e..15d169e94 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs @@ -155,4 +155,4 @@ resolveNameInEnv name e = do case (M.lookup name e) of --Just freshName -> (toVar ((fromVar freshName) ++ "*")) Just freshName -> freshName - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in constructor env: " ++ (show e) \ No newline at end of file + Nothing -> name --error $ "can't find " ++ (fromVar name) ++ " in constructor env: " ++ (show e) \ No newline at end of file From f20862f11891bb9a7382c8c83f215a0143b110a7 Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 30 Jan 2024 22:25:34 -0500 Subject: [PATCH 44/68] notes from artem --- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 201 ++++++++++-------- 1 file changed, 107 insertions(+), 94 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 4cbb3da7d..b31ab1e37 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -89,6 +89,7 @@ parseMode = (extensions defaultParseMode) } +-- TIMMY - top level comment parseFile' :: Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM Prog0) parseFile' cfg pstate_ref import_route path mod_name = do @@ -215,6 +216,18 @@ getImportMeta imports = do -- ======================================================== +-- ======================================================== +-- what we want: +-- accumulate a list of compiler models +-- create a bundle of modules that get merged later +-- insert a pass after desugar that takes [Prog0] +-- have a pass that turns [Prog0] -> Prog0 +-- imagine in the future the whole pipeline works on the bundle + +-- parser -> represent code as faithfully as possible (avoid modifiying the program) +-- later passes -> operate on more abstract representations of the program +-- ======================================================== + desugarModule :: (Show a, Pretty a) => Config @@ -230,102 +243,100 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports -- single top-level declaration we first collect types and then collect -- definitions. funtys = foldr (collectTopTy type_syns) M.empty decls - dbgPrintLn 2 "================================================================================" - dbgPrintLn 2 $ "desugaring module: " ++ mod_name - dbgPrintLn 2 $ "- imports: " ++ (show import_names) - dbgPrintLn 2 $ "- aliases: " ++ (show aliases) - dbgPrintLn 2 $ "- imports: " ++ (show (getImportMeta imports)) + -- get rid of dbgprints + --dbgPrintLn 2 "================================================================================" + --dbgPrintLn 2 $ "desugaring module: " ++ mod_name + --dbgPrintLn 2 $ "- imports: " ++ (show import_names) + --dbgPrintLn 2 $ "- aliases: " ++ (show aliases) + --dbgPrintLn 2 $ "- imports: " ++ (show (getImportMeta imports)) imported_progs :: [PassM Prog0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports - let prog = do - toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls - let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = - foldr classify init_acc toplevels - userOrderings' = M.fromList $ coalese_constraints userOrderings - defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) - funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here - --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here - funs'' = - foldr - (\v acc -> - M.update - (\fn@(FunDef {funMeta}) -> - Just (fn {funMeta = funMeta {funInline = Inline}})) - v - acc) - funs' - inlines - funs''' = - foldr - (\v acc -> - M.update - (\fn -> Just (addLayoutMetaData fn optimizeDcons)) - v - acc) - funs'' - (P.map fst (S.toList optimizeDcons)) - funs'''' = - foldr - (\k acc -> - M.update - (\fn@(FunDef {funName, funMeta}) -> - Just - (fn - { funMeta = - funMeta - { userConstraintsDataCon = - M.lookup funName userOrderings' - } - })) - k - acc) - funs''' - (M.keys userOrderings') - imported_progs' <- mapM id imported_progs - Prog defs'' funs''''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' - let (defs0, funs0) = - foldr - (\Prog {ddefs, fundefs} (defs1, funs1) -> - let ddef_names1 = M.keysSet defs1 - ddef_names2 = M.keysSet ddefs - fn_names1 = M.keysSet funs1 - fn_names2 = M.keysSet fundefs - em1 = S.intersection ddef_names1 ddef_names2 - em2 = S.intersection fn_names1 fn_names2 - conflicts1 = - foldr - (\d acc -> - if (ddefs M.! d) /= (defs1 M.! d) - then d : acc - else acc) - [] - em1 - conflicts2 = - foldr - (\f acc -> - if (fundefs M.! f) /= (funs1 M.! f) - then dbgTraceIt - (sdoc ((fundefs M.! f), (funs1 M.! f))) - (f : acc) - else acc) - [] - em2 - in case (conflicts1, conflicts2) of - ([], []) -> - (M.union ddefs defs1, M.union fundefs funs1) - (_x:_xs, _) -> - error $ - "Conflicting definitions of " ++ - show conflicts1 ++ " found in " ++ mod_name - (_, _x:_xs) -> - error $ - "Conflicting definitions of " ++ - show (S.toList em2) ++ " found in " ++ mod_name) - (defs'', funs''''') - imported_progs' - return $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) - dbgPrintLn 2 $ "===" - pure prog + toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls + let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = + foldr classify init_acc toplevels + userOrderings' = M.fromList $ coalese_constraints userOrderings + defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) + funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here + --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here + funs'' = + foldr + (\v acc -> + M.update + (\fn@(FunDef {funMeta}) -> + Just (fn {funMeta = funMeta {funInline = Inline}})) + v + acc) + funs' + inlines + funs''' = + foldr + (\v acc -> + M.update + (\fn -> Just (addLayoutMetaData fn optimizeDcons)) + v + acc) + funs'' + (P.map fst (S.toList optimizeDcons)) + funs'''' = + foldr + (\k acc -> + M.update + (\fn@(FunDef {funName, funMeta}) -> + Just + (fn + { funMeta = + funMeta + { userConstraintsDataCon = + M.lookup funName userOrderings' + } + })) + k + acc) + funs''' + (M.keys userOrderings') + imported_progs' <- mapM id imported_progs + Prog defs'' funs''''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' + let (defs0, funs0) = + foldr + (\Prog {ddefs, fundefs} (defs1, funs1) -> + let ddef_names1 = M.keysSet defs1 + ddef_names2 = M.keysSet ddefs + fn_names1 = M.keysSet funs1 + fn_names2 = M.keysSet fundefs + em1 = S.intersection ddef_names1 ddef_names2 + em2 = S.intersection fn_names1 fn_names2 + conflicts1 = + foldr + (\d acc -> + if (ddefs M.! d) /= (defs1 M.! d) + then d : acc + else acc) + [] + em1 + conflicts2 = + foldr + (\f acc -> + if (fundefs M.! f) /= (funs1 M.! f) + then dbgTraceIt + (sdoc ((fundefs M.! f), (funs1 M.! f))) + (f : acc) + else acc) + [] + em2 + in case (conflicts1, conflicts2) of + ([], []) -> + (M.union ddefs defs1, M.union fundefs funs1) + (_x:_xs, _) -> + error $ + "Conflicting definitions of " ++ + show conflicts1 ++ " found in " ++ mod_name + (_, _x:_xs) -> + error $ + "Conflicting definitions of " ++ + show (S.toList em2) ++ " found in " ++ mod_name) + (defs'', funs''''') + imported_progs' + pure $ pure $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) --mod_name = moduleName head_mb @@ -453,6 +464,7 @@ stdlibModules = , "Gibbon.ByteString" ] +-- TIMMY - top level comment describing what this does processImport :: Config -> IORef ParseState @@ -489,6 +501,7 @@ processImport cfg pstate_ref import_route dir decl@ImportDecl {..} pure prog Nothing -> do dbgTrace 5 ("Importing " ++ mod_name ++ " from " ++ mod_fp) (pure ()) + -- parse import file prog0 <- parseFile' cfg pstate_ref import_route mod_fp mod_name (ParseState imported') <- readIORef pstate_ref let (prog0', _) = defaultRunPassM prog0 From ecc51cdeef7bf1585d00f26f64197f98c5d4048c Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 31 Jan 2024 02:54:33 -0500 Subject: [PATCH 45/68] built bundler & added bundle flow to the parser and compiler --- gibbon-compiler/src/Gibbon/Bundler.hs | 54 +++++++++++++++++++ gibbon-compiler/src/Gibbon/Compiler.hs | 16 ++++-- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 43 +++++++++------ gibbon-compiler/src/Gibbon/L0/Syntax.hs | 6 +++ gibbon-compiler/src/Gibbon/Language/Syntax.hs | 12 +++++ 5 files changed, 110 insertions(+), 21 deletions(-) create mode 100644 gibbon-compiler/src/Gibbon/Bundler.hs diff --git a/gibbon-compiler/src/Gibbon/Bundler.hs b/gibbon-compiler/src/Gibbon/Bundler.hs new file mode 100644 index 000000000..52b023bcc --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Bundler.hs @@ -0,0 +1,54 @@ + +module Bundler (bundleModules) where +import qualified Data.Foldable as F +import qualified Data.Set as S +import Gibbon.L0.Syntax as L0 +import Gibbon.Common +import Data.Map as M +import Data.List as L +import Language.Haskell.Exts (ImportDecl) + + + +-- main bundler, takes a list of modules and the main module +bundleModules :: ProgBundle0 a -> PassM Prog0 +bundleModules bundle = do + let (ProgBundle modules main) = bundle + let (ProgModule main_name (Prog main_defs main_funs main_exp) main_imports) = main + let (defs, funs) = F.foldr _bundleModule (main_defs, main_funs) modules + return $ Prog defs funs main_exp + +-- main bundle fold +-- builds the full program by folding definitons and functions into the main +_bundleModule :: ProgModule0 a -> (DDefs0, FunDefs0) -> (DDefs0, FunDefs0) +_bundleModule (ProgModule mod_name (Prog {ddefs, fundefs}) _) (defs1, funs1) = + -- conflict checking,,, extract definition and function names + let ddef_names1 = M.keysSet defs1 + ddef_names2 = M.keysSet ddefs + fn_names1 = M.keysSet funs1 + fn_names2 = M.keysSet fundefs + em1 = S.intersection ddef_names1 ddef_names2 + em2 = S.intersection fn_names1 fn_names2 + conflicts1 = F.foldr (\d acc -> + if (ddefs M.! d) /= (defs1 M.! d) + then d : acc + else acc) + [] em1 + conflicts2 = F.foldr (\f acc -> + if (fundefs M.! f) /= (funs1 M.! f) + then dbgTraceIt + (sdoc ((fundefs M.! f), (funs1 M.! f))) + (f : acc) + else acc) + [] em2 + in case (conflicts1, conflicts2) of + ([], []) -> + (M.union ddefs defs1, M.union fundefs funs1) + (_x:_xs, _) -> + error $ + "Conflicting definitions of " ++ + show conflicts1 ++ " found in " ++ mod_name + (_, _x:_xs) -> + error $ + "Conflicting definitions of " ++ + show (S.toList em2) ++ " found in " ++ mod_name diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index efc79c83d..915fdd3b7 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -4,6 +4,8 @@ {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} +{-# HLINT ignore "Redundant return" #-} -- | The compiler pipeline, assembled from several passes. @@ -53,6 +55,7 @@ import Gibbon.L1.Interp() import Gibbon.L2.Interp ( Store, emptyStore ) -- import Gibbon.TargetInterp (Val (..), execProg) +import Gibbon.Bundler (bundleModules) -- Compiler passes import qualified Gibbon.L0.Typecheck as L0 import qualified Gibbon.L0.Specialize2 as L0 @@ -641,8 +644,8 @@ addRedirectionCon p@Prog{ddefs} = do return $ p { ddefs = ddefs' } -- | The main compiler pipeline -passes :: (Show v) => Config -> L0.Prog0 -> StateT (CompileState v) IO L4.Prog -passes config@Config{dynflags} l0 = do +passes :: (Show v) => Config -> L0.ProgBundle0 a -> StateT (CompileState v) IO L4.Prog +passes config@Config{dynflags} l0_bundle = do let isPacked = gopt Opt_Packed dynflags biginf = gopt Opt_BigInfiniteRegions dynflags gibbon1 = gopt Opt_Gibbon1 dynflags @@ -653,8 +656,13 @@ passes config@Config{dynflags} l0 = do opt_layout_global = gopt Opt_Layout_Global dynflags use_solver = gopt Opt_Layout_Use_Solver dynflags tcProg3 = L3.tcProg isPacked - l0 <- go "freshConstructors" freshConstructors l0 - l0 <- go "renameModules" moduleRename l0 + + --l0_unbundled <- go "freshConstructors" freshConstructors l0_unbundled + --l0_unbundled <- go "renameModules" moduleRename l0_unbundled + + -- bundle modules + l0 <- go "bundle modules" bundleModules l0_bundle + l0 <- go "freshen" freshNames l0 l0 <- goE0 "typecheck" L0.tcProg l0 l0 <- goE0 "bindLambdas" L0.bindLambdas l0 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index b31ab1e37..cf7bc7853 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -65,7 +65,7 @@ it expects A.B.D to be at A/B/A/B/D.hs. [1] https://downloads.haskell.org/ghc/8.6.4/docs/html/users_guide/separate_compilation.html?#the-search-path -} -parseFile :: Config -> FilePath -> IO (PassM Prog0) +parseFile :: Config -> FilePath -> IO (PassM (ProgBundle0 a)) parseFile cfg path = do pstate0_ref <- newIORef emptyParseState parseFile' cfg pstate0_ref [] path "Main" @@ -91,7 +91,7 @@ parseMode = -- TIMMY - top level comment parseFile' :: - Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM Prog0) + Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM (ProgBundle0 a)) parseFile' cfg pstate_ref import_route path mod_name = do when (gopt Opt_GhcTc (dynflags cfg)) $ typecheckWithGhc cfg path str <- readFile path @@ -228,15 +228,20 @@ getImportMeta imports = do -- later passes -> operate on more abstract representations of the program -- ======================================================== +------------------------------------------------------------------------------- +-- recursively desugars modules and their imports +-- stacks into a ProgBundle: a bundle of modules and their main module +-- each module contains information about it's name, functions & definitions, and import metadata +------------------------------------------------------------------------------- + desugarModule :: - (Show a, Pretty a) - => Config + Config -> IORef ParseState -> [String] -> FilePath - -> Module a + -> Module SrcSpanInfo -> String - -> IO (PassM Prog0) + -> IO (PassM (ProgBundle0 SrcSpanInfo)) desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) mod_name = do let type_syns = foldl collectTypeSynonyms M.empty decls -- Since top-level functions and their types can't be declared in @@ -249,16 +254,16 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports --dbgPrintLn 2 $ "- imports: " ++ (show import_names) --dbgPrintLn 2 $ "- aliases: " ++ (show aliases) --dbgPrintLn 2 $ "- imports: " ++ (show (getImportMeta imports)) - imported_progs :: [PassM Prog0] <- + imported_progs :: [PassM (ProgBundle0 a)] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) - funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here + --defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) + --funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here - funs'' = + funs' = foldr (\v acc -> M.update @@ -266,18 +271,18 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports Just (fn {funMeta = funMeta {funInline = Inline}})) v acc) - funs' + funs inlines - funs''' = + funs'' = foldr (\v acc -> M.update (\fn -> Just (addLayoutMetaData fn optimizeDcons)) v acc) - funs'' + funs' (P.map fst (S.toList optimizeDcons)) - funs'''' = + funs''' = foldr (\k acc -> M.update @@ -292,9 +297,12 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports })) k acc) - funs''' + funs'' (M.keys userOrderings') imported_progs' <- mapM id imported_progs + let bundle = foldr (\(ProgBundle imported_bundle imported_mainmodule) acc -> acc ++ imported_bundle ++ [imported_mainmodule]) [] imported_progs' + pure $ pure $ ProgBundle bundle (ProgModule mod_name (Prog defs funs''' main) imports) + {- Prog defs'' funs''''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' let (defs0, funs0) = foldr @@ -336,7 +344,8 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports show (S.toList em2) ++ " found in " ++ mod_name) (defs'', funs''''') imported_progs' - pure $ pure $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + -} + --pure $ pure $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) --mod_name = moduleName head_mb @@ -471,7 +480,7 @@ processImport :: -> [String] -> FilePath -> ImportDecl a - -> IO (PassM Prog0) + -> IO (PassM (ProgBundle0 a)) processImport cfg pstate_ref import_route dir decl@ImportDecl {..} -- When compiling with Gibbon, we should *NOT* inline things defined in Gibbon.Prim. | mod_name == "Gibbon.Prim" = pure (pure (Prog M.empty M.empty Nothing)) diff --git a/gibbon-compiler/src/Gibbon/L0/Syntax.hs b/gibbon-compiler/src/Gibbon/L0/Syntax.hs index f67d203f2..32b51c723 100644 --- a/gibbon-compiler/src/Gibbon/L0/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/L0/Syntax.hs @@ -25,6 +25,8 @@ import Text.PrettyPrint.HughesPJ as PP import Gibbon.Common as C import Gibbon.Language hiding (UrTy (..)) +import Language.Haskell.Exts (ImportDecl) + -------------------------------------------------------------------------------- @@ -40,6 +42,10 @@ type FunDefs0 = FunDefs Exp0 type Prog0 = Prog Exp0 +------------------------------------------------------------------------------- + +data ProgModule0 a = ProgModule String Prog0 [ImportDecl a] +data ProgBundle0 a = ProgBundle [ProgModule0 a] (ProgModule0 a) -------------------------------------------------------------------------------- diff --git a/gibbon-compiler/src/Gibbon/Language/Syntax.hs b/gibbon-compiler/src/Gibbon/Language/Syntax.hs index 4948c916c..e69fc908d 100644 --- a/gibbon-compiler/src/Gibbon/Language/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/Language/Syntax.hs @@ -127,6 +127,7 @@ import System.IO.Unsafe (unsafePerformIO) import Text.PrettyPrint.GenericPretty import Gibbon.Common +import Language.Haskell.Exts (ImportDecl) -------------------------------------------------------------------------------- @@ -392,6 +393,17 @@ data Prog ex = , mainExp :: Maybe (ex, (TyOf ex)) } +------------------------------------------------------------------------------- +-- Module Bundles +-- Before modules get bundled into a single program, they're stored as +-- a tuple of the discrte Prog and it's import declarations +------------------------------------------------------------------------------- + + +data ProgModule ex a = ProgModule (Prog ex) (ImportDecl a) +data ProgBundle ex a = ProgBundle [ProgModule ex a] (ProgModule ex a) + +------------------------------------------------------------------------------- -- Since 'FunDef' is defined using a type family, we cannot use the deriving clause. -- Ryan Scott recommended using singletons-like alternative outlined here: From 2e2e322ab89cdfb288af2983ee7ea1d50823fe63 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 14 Feb 2024 11:13:36 -0500 Subject: [PATCH 46/68] passes some tests --- gibbon-compiler/gibbon.cabal | 2 + gibbon-compiler/src/Gibbon/Bundler.hs | 6 +- gibbon-compiler/src/Gibbon/Compiler.hs | 56 ++- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 130 ++++--- gibbon-compiler/src/Gibbon/L0/Syntax.hs | 5 +- gibbon-compiler/src/Gibbon/L0/Typecheck.hs | 11 + gibbon-compiler/src/Gibbon/Language/Syntax.hs | 51 ++- .../src/Gibbon/Passes/FreshBundle.hs | 356 ++++++++++++++++++ gibbon-compiler/src/Gibbon/Pretty.hs | 23 ++ 9 files changed, 551 insertions(+), 89 deletions(-) create mode 100644 gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index 361ddc44b..6cd1ee07e 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -28,6 +28,7 @@ flag LLVM_ENABLED library exposed-modules: Gibbon.Common Gibbon.Compiler + Gibbon.Bundler Gibbon.DynFlags Gibbon.Pretty Gibbon.SExpFrontend @@ -59,6 +60,7 @@ library Gibbon.NewL2.FromOldL2 -- compiler passes, roughly in the order they're run + Gibbon.Passes.FreshBundle Gibbon.Passes.FreshConstructors Gibbon.Passes.ModuleRename Gibbon.Passes.ModuleFillImports diff --git a/gibbon-compiler/src/Gibbon/Bundler.hs b/gibbon-compiler/src/Gibbon/Bundler.hs index 52b023bcc..7d014a5c9 100644 --- a/gibbon-compiler/src/Gibbon/Bundler.hs +++ b/gibbon-compiler/src/Gibbon/Bundler.hs @@ -1,5 +1,5 @@ -module Bundler (bundleModules) where +module Gibbon.Bundler (bundleModules) where import qualified Data.Foldable as F import qualified Data.Set as S import Gibbon.L0.Syntax as L0 @@ -11,7 +11,7 @@ import Language.Haskell.Exts (ImportDecl) -- main bundler, takes a list of modules and the main module -bundleModules :: ProgBundle0 a -> PassM Prog0 +bundleModules :: ProgBundle0 -> PassM Prog0 bundleModules bundle = do let (ProgBundle modules main) = bundle let (ProgModule main_name (Prog main_defs main_funs main_exp) main_imports) = main @@ -20,7 +20,7 @@ bundleModules bundle = do -- main bundle fold -- builds the full program by folding definitons and functions into the main -_bundleModule :: ProgModule0 a -> (DDefs0, FunDefs0) -> (DDefs0, FunDefs0) +_bundleModule :: ProgModule0 -> (DDefs0, FunDefs0) -> (DDefs0, FunDefs0) _bundleModule (ProgModule mod_name (Prog {ddefs, fundefs}) _) (defs1, funs1) = -- conflict checking,,, extract definition and function names let ddef_names1 = M.keysSet defs1 diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 915fdd3b7..4b2b9e5d2 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -6,6 +6,7 @@ {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} {-# HLINT ignore "Redundant return" #-} +{-# HLINT ignore "Redundant pure" #-} -- | The compiler pipeline, assembled from several passes. @@ -62,6 +63,7 @@ import qualified Gibbon.L0.Specialize2 as L0 import qualified Gibbon.L1.Typecheck as L1 import qualified Gibbon.L2.Typecheck as L2 import qualified Gibbon.L3.Typecheck as L3 +import Gibbon.Passes.FreshBundle (freshBundleNames) import Gibbon.Passes.FreshConstructors (freshConstructors) import Gibbon.Passes.ModuleRename (moduleRename) import Gibbon.Passes.Freshen (freshNames) @@ -231,33 +233,52 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do dir <- getCurrentDirectory let fp1 = dir fp0 -- Parse the input file - ((l0, cnt0), fp) <- parseInput config input fp1 + ((l0_bundle, cnt0), fp) <- parseInput config input fp1 let config' = config { srcFile = Just fp } + -- put module resolution up here? so we don't have to mess with type check + + -- make "whole program mode" and option (disable module resolution) + let initTypeChecked :: L0.Prog0 initTypeChecked = -- We typecheck first to turn the appropriate VarE's into FunRefE's. + + + -- why frshing is useful + -- when linking modules,,, creating unique identifiers + -- nested declarations, + -- compiler move internally bound names to top level in order to flatten programs,, thus they need to be unique + + -- run an exerpiment and see if really need fresh :) + -- do we need two freshens (one here and one at the start of the passes) + + -- ought to seperate dependency tree & bundling + -- figure out the dependency tree, then parse all the file individually fst $ runPassM defaultConfig cnt0 - (freshNames l0 >>= - (\fresh -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender fresh) (L0.tcProg fresh))) + (freshBundleNames l0_bundle >>= + (\fresh -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender fresh) (L0.tcProg (fst $ runPassM defaultConfig 0 (bundleModules fresh))))) + + -- cut out interp and place it after bundling case mode of Interp1 -> do - dbgTrace passChatterLvl ("\nParsed:\n"++sepline++ "\n" ++ sdoc l0) (pure ()) + dbgTrace passChatterLvl ("\nParsed:\n"++sepline++ "\n" ++ sdoc l0_bundle) (pure ()) dbgTrace passChatterLvl ("\nTypechecked:\n"++sepline++ "\n" ++ pprender initTypeChecked) (pure ()) runConf <- getRunConfig [] + --l0 <- bundleModules initTypeChecked (_s1,val,_stdout) <- gInterpProg () runConf initTypeChecked print val - - ToParse -> dbgPrintLn 0 $ pprender l0 + ToParse -> dbgPrintLn 0 $ pprender l0_bundle _ -> do dbgPrintLn passChatterLvl $ " [compiler] pipeline starting, parsed program: "++ if dbgLvl >= passChatterLvl+1 - then "\n"++sepline ++ "\n" ++ sdoc l0 - else show (length (sdoc l0)) ++ " characters." + then "\n"++sepline ++ "\n" ++ sdoc l0_bundle + else show (length (sdoc l0_bundle)) ++ " characters." + -- (Stage 1) Run the program through the interpreter initResult <- withPrintInterpProg initTypeChecked @@ -266,7 +287,7 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do let outfile = getOutfile backend fp cfile -- run the initial program through the compiler pipeline - let stM = passes config' l0 + let stM = passes config' l0_bundle l4 <- evalStateT stM (CompileState {cnt=cnt0, result=initResult}) case mode of @@ -334,9 +355,10 @@ setDebugEnvVar verbosity = hPutStrLn stderr$ " ! We set DEBUG based on command-line verbose arg: "++show l -parseInput :: Config -> Input -> FilePath -> IO ((L0.Prog0, Int), FilePath) +parseInput :: Config -> Input -> FilePath -> IO ((L0.ProgBundle0, Int), FilePath) parseInput cfg ip fp = do - (l0, f) <- + (l0, f) <- (, fp) <$> HS.parseFile cfg fp + {- case ip of Haskell -> (, fp) <$> HS.parseFile cfg fp SExpr -> (, fp) <$> SExp.parseFile fp @@ -359,9 +381,10 @@ parseInput cfg ip fp = do , show oth , " Please specify compile input format." ] + -} let l0' = do parsed <- l0 -- dbgTraceIt (sdoc parsed) (pure ()) - HS.desugarLinearExts parsed + HS.desugarBundleLinearExts parsed (l0'', cnt) <- pure $ runPassM defaultConfig 0 l0' pure ((l0'', cnt), f) @@ -644,7 +667,7 @@ addRedirectionCon p@Prog{ddefs} = do return $ p { ddefs = ddefs' } -- | The main compiler pipeline -passes :: (Show v) => Config -> L0.ProgBundle0 a -> StateT (CompileState v) IO L4.Prog +passes :: (Show v) => Config -> L0.ProgBundle0 -> StateT (CompileState v) IO L4.Prog passes config@Config{dynflags} l0_bundle = do let isPacked = gopt Opt_Packed dynflags biginf = gopt Opt_BigInfiniteRegions dynflags @@ -660,10 +683,13 @@ passes config@Config{dynflags} l0_bundle = do --l0_unbundled <- go "freshConstructors" freshConstructors l0_unbundled --l0_unbundled <- go "renameModules" moduleRename l0_unbundled + l0_bundle' <- go "freshBundle" freshBundleNames l0_bundle + -- bundle modules - l0 <- go "bundle modules" bundleModules l0_bundle + -- what does cnt do? -> the 0 in the following statement + let l0 = fst $ runPassM defaultConfig 0 (bundleModules l0_bundle') - l0 <- go "freshen" freshNames l0 + --l0 <- go "freshen" freshNames l0 l0 <- goE0 "typecheck" L0.tcProg l0 l0 <- goE0 "bindLambdas" L0.bindLambdas l0 l0 <- goE0 "monomorphize" L0.monomorphize l0 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index cf7bc7853..3a1238752 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -1,11 +1,14 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RecordWildCards #-} +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} +{-# HLINT ignore "Use let" #-} module Gibbon.HaskellFrontend ( parseFile , primMap , multiArgsToOne + , desugarBundleLinearExts , desugarLinearExts ) where @@ -36,6 +39,8 @@ import Data.List as L import Prelude as P import Gibbon.Passes.ModuleFillImports (fillImports) +import qualified Control.Applicative as L +--import BenchRunner (main) -------------------------------------------------------------------------------- @@ -65,19 +70,21 @@ it expects A.B.D to be at A/B/A/B/D.hs. [1] https://downloads.haskell.org/ghc/8.6.4/docs/html/users_guide/separate_compilation.html?#the-search-path -} -parseFile :: Config -> FilePath -> IO (PassM (ProgBundle0 a)) +parseFile :: Config -> FilePath -> IO (PassM ProgBundle0) parseFile cfg path = do pstate0_ref <- newIORef emptyParseState parseFile' cfg pstate0_ref [] path "Main" data ParseState = ParseState - { imported :: M.Map (String, FilePath) Prog0 + { imported :: M.Map (String, FilePath) ProgBundle0 } emptyParseState :: ParseState emptyParseState = ParseState M.empty +-- should be a sperate recursive function that builds the dependency tree, and then another that parses the actual programs + parseMode :: ParseMode parseMode = defaultParseMode @@ -91,7 +98,7 @@ parseMode = -- TIMMY - top level comment parseFile' :: - Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM (ProgBundle0 a)) + Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM ProgBundle0) parseFile' cfg pstate_ref import_route path mod_name = do when (gopt Opt_GhcTc (dynflags cfg)) $ typecheckWithGhc cfg path str <- readFile path @@ -241,7 +248,7 @@ desugarModule :: -> FilePath -> Module SrcSpanInfo -> String - -> IO (PassM (ProgBundle0 SrcSpanInfo)) + -> IO (PassM ProgBundle0) desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) mod_name = do let type_syns = foldl collectTypeSynonyms M.empty decls -- Since top-level functions and their types can't be declared in @@ -251,57 +258,58 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports -- get rid of dbgprints --dbgPrintLn 2 "================================================================================" --dbgPrintLn 2 $ "desugaring module: " ++ mod_name - --dbgPrintLn 2 $ "- imports: " ++ (show import_names) + dbgPrintLn 2 $ "- imports: " ++ (show import_names) --dbgPrintLn 2 $ "- aliases: " ++ (show aliases) --dbgPrintLn 2 $ "- imports: " ++ (show (getImportMeta imports)) - imported_progs :: [PassM (ProgBundle0 a)] <- + imported_progs :: [PassM ProgBundle0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports - toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls - let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = - foldr classify init_acc toplevels - userOrderings' = M.fromList $ coalese_constraints userOrderings - --defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) - --funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here - --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here - funs' = - foldr - (\v acc -> - M.update - (\fn@(FunDef {funMeta}) -> - Just (fn {funMeta = funMeta {funInline = Inline}})) - v - acc) - funs - inlines - funs'' = - foldr - (\v acc -> - M.update - (\fn -> Just (addLayoutMetaData fn optimizeDcons)) - v - acc) - funs' - (P.map fst (S.toList optimizeDcons)) - funs''' = - foldr - (\k acc -> - M.update - (\fn@(FunDef {funName, funMeta}) -> - Just - (fn - { funMeta = - funMeta - { userConstraintsDataCon = - M.lookup funName userOrderings' - } - })) - k - acc) - funs'' - (M.keys userOrderings') - imported_progs' <- mapM id imported_progs - let bundle = foldr (\(ProgBundle imported_bundle imported_mainmodule) acc -> acc ++ imported_bundle ++ [imported_mainmodule]) [] imported_progs' - pure $ pure $ ProgBundle bundle (ProgModule mod_name (Prog defs funs''' main) imports) + let prog = do + imported_progs' <- mapM id imported_progs + toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls + let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels + userOrderings' = M.fromList $ coalese_constraints userOrderings + --defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) + --funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here + --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here + funs' = + foldr + (\v acc -> + M.update + (\fn@(FunDef {funMeta}) -> + Just (fn {funMeta = funMeta {funInline = Inline}})) + v + acc) + funs + inlines + funs'' = + foldr + (\v acc -> + M.update + (\fn -> Just (addLayoutMetaData fn optimizeDcons)) + v + acc) + funs' + (P.map fst (S.toList optimizeDcons)) + funs''' = + foldr + (\k acc -> + M.update + (\fn@(FunDef {funName, funMeta}) -> + Just + (fn + { funMeta = + funMeta + { userConstraintsDataCon = + M.lookup funName userOrderings' + } + })) + k + acc) + funs'' + (M.keys userOrderings') + let bundle = foldr (\(ProgBundle imported_bundle imported_mainmodule) acc -> acc ++ imported_bundle ++ [imported_mainmodule]) [] imported_progs' + pure $ ProgBundle bundle (ProgModule mod_name (Prog defs funs''' main) imports) + pure prog {- Prog defs'' funs''''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' let (defs0, funs0) = @@ -348,7 +356,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports --pure $ pure $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) - --mod_name = moduleName head_mb + --modname = moduleName head_mb import_names = (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ _ _) -> importName) imports) aliases = M.fromList (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ aliased _) -> @@ -480,10 +488,10 @@ processImport :: -> [String] -> FilePath -> ImportDecl a - -> IO (PassM (ProgBundle0 a)) + -> IO (PassM ProgBundle0) processImport cfg pstate_ref import_route dir decl@ImportDecl {..} -- When compiling with Gibbon, we should *NOT* inline things defined in Gibbon.Prim. - | mod_name == "Gibbon.Prim" = pure (pure (Prog M.empty M.empty Nothing)) + | mod_name == "Gibbon.Prim" = pure (pure (ProgBundle L.empty (ProgModule "Gibbon.Prim" (Prog M.empty M.empty Nothing) L.empty) )) | otherwise = do when (mod_name `elem` import_route) $ error $ @@ -2272,8 +2280,14 @@ verifyBenchEAssumptions bench_allowed ex = -------------------------------------------------------------------------------- -desugarLinearExts :: Prog0 -> PassM Prog0 -desugarLinearExts (Prog ddefs fundefs main) = do +desugarBundleLinearExts :: ProgBundle0 -> PassM ProgBundle0 +desugarBundleLinearExts (ProgBundle bundle main) = do + bundle' <- mapM desugarLinearExts bundle + main' <- desugarLinearExts main + pure $ ProgBundle bundle' main' + +desugarLinearExts :: ProgModule0 -> PassM ProgModule0 +desugarLinearExts (ProgModule name (Prog ddefs fundefs main) imports) = do main' <- case main of Nothing -> pure Nothing @@ -2289,7 +2303,7 @@ desugarLinearExts (Prog ddefs fundefs main) = do ty' = goty ty pure $ fn {funBody = bod, funTy = (ForAll tyvars ty')}) fundefs - pure (Prog ddefs fundefs' main') + pure $ ProgModule name (Prog ddefs fundefs' main') imports where goty :: Ty0 -> Ty0 goty ty = diff --git a/gibbon-compiler/src/Gibbon/L0/Syntax.hs b/gibbon-compiler/src/Gibbon/L0/Syntax.hs index 32b51c723..05529ffe9 100644 --- a/gibbon-compiler/src/Gibbon/L0/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/L0/Syntax.hs @@ -25,6 +25,7 @@ import Text.PrettyPrint.HughesPJ as PP import Gibbon.Common as C import Gibbon.Language hiding (UrTy (..)) +import Language.Haskell.Exts.SrcLoc import Language.Haskell.Exts (ImportDecl) @@ -44,8 +45,8 @@ type Prog0 = Prog Exp0 ------------------------------------------------------------------------------- -data ProgModule0 a = ProgModule String Prog0 [ImportDecl a] -data ProgBundle0 a = ProgBundle [ProgModule0 a] (ProgModule0 a) +type ProgModule0 = ProgModule Exp0 +type ProgBundle0 = ProgBundle Exp0 -------------------------------------------------------------------------------- diff --git a/gibbon-compiler/src/Gibbon/L0/Typecheck.hs b/gibbon-compiler/src/Gibbon/L0/Typecheck.hs index 22ddcc8ab..c1e2c5c4e 100644 --- a/gibbon-compiler/src/Gibbon/L0/Typecheck.hs +++ b/gibbon-compiler/src/Gibbon/L0/Typecheck.hs @@ -40,6 +40,17 @@ runTcM (TcM tc) = runExceptT tc err :: Doc -> TcM a err d = throwError ("L0.Typecheck: " $$ nest 4 d) +tcProgBundle :: ProgBundle0 -> PassM ProgBundle0 +tcProgBundle (ProgBundle bundle main) = do + bundle' <- mapM tcProgModule bundle + main' <- tcProgModule main + pure $ ProgBundle bundle' main' + +tcProgModule :: ProgModule0 -> PassM ProgModule0 +tcProgModule (ProgModule modname prog imports) = do + prog' <- tcProg prog + pure $ ProgModule modname prog' imports + tcProg :: Prog0 -> PassM Prog0 tcProg prg@Prog{ddefs,fundefs,mainExp} = do let init_fenv = M.map funTy fundefs diff --git a/gibbon-compiler/src/Gibbon/Language/Syntax.hs b/gibbon-compiler/src/Gibbon/Language/Syntax.hs index e69fc908d..bed7bf63d 100644 --- a/gibbon-compiler/src/Gibbon/Language/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/Language/Syntax.hs @@ -10,6 +10,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE InstanceSigs #-} module Gibbon.Language.Syntax -- * Datatype definitions @@ -47,6 +48,8 @@ module Gibbon.Language.Syntax -- * Programs , Prog(..) + , ProgModule(..) + , ProgBundle(..) , progToEnv , getFunTy @@ -125,9 +128,11 @@ import qualified Data.Set as S import Data.Word (Word8) import System.IO.Unsafe (unsafePerformIO) import Text.PrettyPrint.GenericPretty +import Text.PrettyPrint (text) + import Gibbon.Common -import Language.Haskell.Exts (ImportDecl) +import Language.Haskell.Exts (ImportDecl, SrcSpanInfo) -------------------------------------------------------------------------------- @@ -393,16 +398,6 @@ data Prog ex = , mainExp :: Maybe (ex, (TyOf ex)) } -------------------------------------------------------------------------------- --- Module Bundles --- Before modules get bundled into a single program, they're stored as --- a tuple of the discrte Prog and it's import declarations -------------------------------------------------------------------------------- - - -data ProgModule ex a = ProgModule (Prog ex) (ImportDecl a) -data ProgBundle ex a = ProgBundle [ProgModule ex a] (ProgModule ex a) - ------------------------------------------------------------------------------- -- Since 'FunDef' is defined using a type family, we cannot use the deriving clause. @@ -430,6 +425,40 @@ deriving instance Generic (ArrowTy (TyOf ex))) => NFData (Prog ex) +------------------------------------------------------------------------------- +-- Module Bundles +-- Before modules get bundled into a single program, they're stored as +-- a tuple of the discrte Prog and it's import declarations +------------------------------------------------------------------------------- + + +data ProgModule ex = ProgModule String (Prog ex) [ImportDecl SrcSpanInfo] +data ProgBundle ex = ProgBundle [ProgModule ex] (ProgModule ex) + +deriving instance + (Show (TyOf ex), Show ex, Show (ArrowTy (TyOf ex))) => + Show (ProgModule ex) +deriving instance Generic (ProgModule ex) +instance Out (ImportDecl SrcSpanInfo) where + doc = text . show + docPrec n v = docPrec n (show v) +instance (NFData (TyOf ex), NFData (ArrowTy (TyOf ex)), NFData ex, Generic (ArrowTy (TyOf ex))) => NFData (ProgModule ex) where + rnf (ProgModule name prog imports) = rnf prog + +deriving instance (Out (Prog ex)) => Out (ProgModule ex) +deriving instance + (Show (TyOf ex), Show ex, Show (ArrowTy (TyOf ex))) => + Show (ProgBundle ex) + +deriving instance + (NFData (TyOf ex), NFData (ArrowTy (TyOf ex)), NFData ex, + Generic (ArrowTy (TyOf ex))) => + NFData (ProgBundle ex) + +deriving instance Generic (ProgBundle ex) +deriving instance (Out (ProgModule ex)) => Out (ProgBundle ex) + + -- | Abstract some of the differences of top level program types, by -- having a common way to extract an initial environment. The diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs new file mode 100644 index 000000000..197e21cbe --- /dev/null +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -0,0 +1,356 @@ +{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} +{-# HLINT ignore "Fuse foldr/map" #-} + +module Gibbon.Passes.FreshBundle (freshBundleNames) where +import qualified Data.Map as M +import qualified Data.List as L +import Gibbon.Common +import Gibbon.L0.Syntax +import Language.Haskell.Exts (Name, ImportDecl (ImportDecl), SrcSpanInfo, name, ImportSpec (..), CName) +import Data.Maybe (fromJust) +import Language.Haskell.Exts.Syntax (CName(..)) +import Language.Haskell.Exts (Name(..)) +import Language.Haskell.Exts (ImportSpecList(..)) +import Language.Haskell.Exts (ModuleName(..), Module) +import GHC.Stack (HasCallStack) + +type NameEnv = M.Map Var Var + + +-- try to merge it back into the original branch +-- CI/CD +-- + +-- exported fresh bundle pass +-- freshes names, replaces all references with new, globally unique names + +freshBundleNames :: ProgBundle0 -> PassM ProgBundle0 +freshBundleNames bundle = do + (uniquedefenv, uniquefunenv, uniqueconstenv) <- buildGlobalEnv bundle + let ProgBundle modules main = bundle + modules' <- mapM (\v -> freshModule v bundle uniquedefenv uniquefunenv uniqueconstenv) modules + main' <- freshModule main bundle uniquedefenv uniquefunenv uniqueconstenv + modules'' <- mapM (\v -> freshModuleKeys v uniquedefenv uniquefunenv) modules' + main'' <- freshModuleKeys main' uniquedefenv uniquefunenv + pure $ ProgBundle modules'' main'' + +-- helper functions ----------------------------------------------------------- + +-- rename the function and definition keys to their uniques +freshModuleKeys :: ProgModule0 -> NameEnv -> NameEnv -> PassM ProgModule0 +freshModuleKeys (ProgModule name (Prog defs funs main) imports) uniquedefenv uniquefunenv = do + let funs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquefunenv) funs + let defs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquedefenv) defs + pure $ ProgModule name (Prog defs' funs' main) imports + +findImportedModule :: ImportDecl SrcSpanInfo -> M.Map String ProgModule0 -> ProgModule0 +findImportedModule mod modmap = do + let (ImportDecl _ (ModuleName _ name) _ _ _ _ _ _) = mod + case M.lookup name modmap of + Just found -> found + Nothing -> error $ "Could not find module " ++ name ++ " in imported modules: " ++ (show (M.keys modmap)) + +-- construct module environment from import spec & local functions +freshModule :: ProgModule0 -> ProgBundle0 -> NameEnv -> NameEnv -> NameEnv -> PassM ProgModule0 +freshModule (ProgModule modname (Prog defs funs main) imports) (ProgBundle bundle _) uniquedefenv uniquefunenv uniqueconstrenv = + do + defs' <- traverse (\v -> freshDDef v defenv'' constrenv'') defs + funs' <- traverse (\v -> freshFun v defenv'' funenv'' constrenv'') funs + main' <- case main of + Nothing -> return Nothing + Just (m,ty) -> do m' <- findFreshInExp m defenv'' funenv'' constrenv'' + return $ Just (m',ty) + return $ ProgModule modname (Prog defs' funs' main') imports + where + modname' = toVar (modname ++ ".") + constrs = L.map (\(constrName, _) -> toVar constrName) + (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] (M.elems defs)) + -- add qualified and unqualified names to the env + modmap = M.fromList $ L.zip (L.map (\(ProgModule m _ _) -> m) bundle) bundle + funenv = foldr (\f acc -> M.insert (varAppend modname' f) (findFreshedName (varAppend modname' f) uniquefunenv) acc) M.empty (M.keys funs) + defenv = foldr (\d acc -> M.insert (varAppend modname' d) (findFreshedName (varAppend modname' d) uniquedefenv) acc) M.empty (M.keys defs) + constrenv = foldr(\c acc -> M.insert (varAppend modname' c) (findFreshedName (varAppend modname' c) uniqueconstrenv) acc) M.empty constrs + funenv' = foldr (\f acc -> M.insert f (findFreshedName (varAppend modname' f) uniquefunenv) acc) funenv (M.keys funs) + defenv' = foldr (\d acc -> M.insert d (findFreshedName (varAppend modname' d) uniquedefenv) acc) defenv (M.keys defs) + constrenv' = foldr (\c acc -> M.insert c (findFreshedName (varAppend modname' c) uniqueconstrenv) acc) constrenv constrs + (defenv'', funenv'', constrenv'') = + foldr (\(d, f, c) (dacc, facc, cacc) -> (M.union d dacc, M.union f facc, M.union c cacc)) (defenv', funenv', constrenv') + $ map (\i -> getImportedEnv (findImportedModule i modmap) i uniquedefenv uniquefunenv uniqueconstrenv) imports + +freshDDef :: HasCallStack => DDef Ty0 -> NameEnv -> NameEnv -> PassM (DDef Ty0) +freshDDef DDef{tyName,tyArgs,dataCons} defenv constrenv = do + let tyName' = findFreshedName tyName defenv + let dataCons' = L.map (\(dataCon, vs) -> (fromVar (findFreshedName (toVar dataCon) constrenv), vs)) dataCons + let dataCons'' = L.map (\v -> findFreshInDataCons v defenv) dataCons' + pure $ DDef tyName' tyArgs dataCons'' + +freshFun :: FunDef Exp0 -> NameEnv -> NameEnv -> NameEnv -> PassM (FunDef Exp0) +freshFun (FunDef nam nargs funty bod meta) defenv funenv constrenv = + do + let nam' = findFreshedName nam funenv + let funty' = resolveModsInTyScheme funty defenv + let funenv' = foldr (\v acc -> M.insert v v acc ) funenv nargs + bod' <- findFreshInExp bod defenv funenv' constrenv + pure $ FunDef nam' nargs funty' bod' meta + +resolveModsInTyScheme :: TyScheme -> NameEnv -> TyScheme +resolveModsInTyScheme (ForAll tvs ty) defenv = do + let ty' = findFreshInTy ty defenv + ForAll tvs ty' + +findFreshInTy :: Ty0 -> NameEnv -> Ty0 +findFreshInTy ty defenv = + case ty of + IntTy -> ty + CharTy -> ty + FloatTy -> ty + SymTy0 -> ty + BoolTy -> ty + ArenaTy -> ty + SymSetTy -> ty + SymHashTy -> ty + MetaTv{} -> ty + TyVar tv -> ty + ProdTy tys -> ProdTy $ map (\v -> findFreshInTy v defenv) tys + SymDictTy v ty -> SymDictTy v $ findFreshInTy ty defenv + PDictTy k v -> PDictTy (findFreshInTy k defenv) (findFreshInTy v defenv) + ArrowTy tys t -> ArrowTy (map (\v -> findFreshInTy v defenv) tys) $ findFreshInTy t defenv + + PackedTy tycon tys -> PackedTy (fromVar (findFreshedName (toVar tycon) defenv)) $ map (\v -> findFreshInTy v defenv) tys + + VectorTy el_t -> VectorTy $ findFreshInTy el_t defenv + ListTy el_t -> ListTy $ findFreshInTy el_t defenv + IntHashTy -> ty + +findFreshInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> NameEnv -> (DataCon, [(IsBoxed, Ty0)]) +findFreshInDataCons (con, tys) defenv = + do + let tys' = map (\(boxed, ty) -> (boxed, (findFreshInTy ty defenv))) tys + (con, tys') + +findFreshInExp :: Exp0 -> NameEnv -> NameEnv -> NameEnv -> PassM Exp0 +findFreshInExp exp defenv funenv constrenv = + case exp of + LitE i -> return $ LitE i + CharE c -> return $ CharE c + FloatE i -> return $ FloatE i + LitSymE v -> return $ LitSymE v + --VarE v -> return $ VarE (varAppend (toVar "seen-") v) + VarE v -> return $ VarE (tryToFindFreshedName v funenv) + + AppE v locs ls -> do + let v' = findFreshedName v funenv + ls' <- traverse (\v -> findFreshInExp v defenv funenv constrenv) ls + return $ AppE v' locs ls' + + PrimAppE p es -> do + es' <- traverse (\v -> findFreshInExp v defenv funenv constrenv) es + return $ PrimAppE p es' + + LetE (v,_locs,ty, e1) e2 -> do + let ty' = findFreshInTy ty defenv + let funenv' = M.insert v v funenv + e1' <- findFreshInExp e1 defenv funenv' constrenv + e2' <- findFreshInExp e2 defenv funenv' constrenv + return $ LetE (v, [], ty', e1') e2' + + IfE e1 e2 e3 -> do + e1' <- findFreshInExp e1 defenv funenv constrenv + e2' <- findFreshInExp e2 defenv funenv constrenv + e3' <- findFreshInExp e3 defenv funenv constrenv + return $ IfE e1' e2' e3' + + ProjE i e -> do + e' <- findFreshInExp e defenv funenv constrenv + return $ ProjE i e' + + MkProdE es -> do + es' <- traverse (\v -> findFreshInExp v defenv funenv constrenv) es + return $ MkProdE es' + + CaseE e mp -> do + e' <- findFreshInExp e defenv funenv constrenv + mp' <- mapM (\(c,prs,ae) -> do + let c' = (fromVar (findFreshedName (toVar c) constrenv)) + ae' <- findFreshInExp ae defenv funenv constrenv + return (c', prs, ae')) mp + return $ CaseE e' mp' + + DataConE loc c es -> do + let c' = (fromVar (findFreshedName (toVar c) constrenv)) + es' <- traverse (\v -> findFreshInExp v defenv funenv constrenv) es + return $ DataConE loc c' es' + + TimeIt e t b -> do + e' <- findFreshInExp e defenv funenv constrenv + return $ TimeIt e' t b + WithArenaE v e -> do + e' <- findFreshInExp e defenv funenv constrenv + return $ WithArenaE v e' + SpawnE v locs ls -> do + ls' <- traverse (\v -> findFreshInExp v defenv funenv constrenv) ls + return $ SpawnE v locs ls' + SyncE -> return $ SyncE + MapE (v, d, ve) e -> do + e' <- findFreshInExp e defenv funenv constrenv + ve' <- findFreshInExp ve defenv funenv constrenv + return $ MapE (v, d, ve') e' + FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do + e1' <- findFreshInExp e1 defenv funenv constrenv + e2' <- findFreshInExp e2 defenv funenv constrenv + e3' <- findFreshInExp e3 defenv funenv constrenv + return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' + Ext ext -> case ext of + LambdaE args bod -> do + bod' <- findFreshInExp bod defenv funenv constrenv + return $ Ext $ LambdaE args bod' + PolyAppE a b -> do + return $ Ext $ PolyAppE a b + FunRefE tyapps f -> do + return $ Ext $ FunRefE tyapps f + BenchE fn tyapps args b -> do + args' <- mapM (\arg -> findFreshInExp arg defenv funenv constrenv) args + return $ Ext $ BenchE fn tyapps args' b + ParE0 ls -> do + ls' <- mapM (\l -> findFreshInExp l defenv funenv constrenv) ls + return $ Ext $ ParE0 ls' + PrintPacked ty arg -> do + let ty' = findFreshInTy ty defenv + arg' <- findFreshInExp arg defenv funenv constrenv + return $ Ext $ PrintPacked ty' arg' + CopyPacked ty arg -> do + let ty' = findFreshInTy ty defenv + arg' <- findFreshInExp arg defenv funenv constrenv + return $ Ext $ CopyPacked ty' arg' + TravPacked ty arg -> do + let ty' = findFreshInTy ty defenv + arg' <- findFreshInExp arg defenv funenv constrenv + return $ Ext $ TravPacked ty' arg' + L p e -> do + e' <- findFreshInExp e defenv funenv constrenv + return $ Ext $ L p e' + LinearExt a -> do + return $ Ext $ LinearExt a + +-- parse import header +getImportedEnv :: ProgModule0 -> ImportDecl SrcSpanInfo -> NameEnv -> NameEnv -> NameEnv -> (NameEnv, NameEnv, NameEnv) +getImportedEnv (ProgModule _ (Prog defs funs _) _) imp uniquedefenv uniquefunenv uniqueconstrenv = do + let ImportDecl _ (ModuleName _ impname) qual _ _ _ as specs = imp + let impname' = toVar (impname ++ ".") + let qualname = case as of + Just (ModuleName _ n) -> toVar $ n ++ "." + Nothing -> toVar $ impname ++ "." + let constrs = L.map (\(constrName, _) -> toVar constrName) + (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] (M.elems defs)) + let impenv :: (NameEnv, NameEnv, NameEnv) + impenv = case specs of + Just (ImportSpecList _ _ speclist) -> do + let specednames = foldr (\v acc -> (parseSpec v) ++ acc) [] speclist + let funs' = foldr (\k acc -> case M.lookup (varAppend impname' k) uniquefunenv of + Nothing -> acc + Just found -> do + let acc' = M.insert (varAppend qualname k) found acc + if qual then acc' + else M.insert k found acc' + ) M.empty specednames + let defs' = foldr (\k acc -> case M.lookup (varAppend impname' k) uniquedefenv of + Nothing -> acc + Just found -> do + let acc' = M.insert (varAppend qualname k) found acc + if qual then acc' + else M.insert k found acc' + ) M.empty specednames + let constrs' = foldr (\k acc -> case M.lookup (varAppend impname' k) uniqueconstrenv of + Nothing -> acc + Just found -> do + let acc' = M.insert (varAppend qualname k) found acc + if qual then acc' + else M.insert k found acc' + ) M.empty specednames + (defs', funs', constrs') + Nothing -> do + let funs' = foldr (\k acc -> do + let found = findFreshedName (varAppend impname' k) uniquefunenv + let acc' = M.insert (varAppend qualname k) found acc + if qual then acc' + else M.insert k found acc' + ) M.empty (M.keys funs) + let defs' = foldr (\k acc -> do + let found = findFreshedName (varAppend impname' k) uniquedefenv + let acc' = M.insert (varAppend qualname k) found acc + if qual then acc' + else M.insert k found acc' + ) M.empty (M.keys defs) + let constrs' = foldr (\k acc -> case M.lookup (varAppend impname' k) uniqueconstrenv of + Nothing -> acc + Just found -> do + let acc' = M.insert (varAppend qualname k) found acc + if qual then acc' + else M.insert k found acc' + ) M.empty constrs + (defs', funs', constrs') + impenv + +-- simple helper functions to convert `Name`s and `CNames`s to Vars +name2var :: Name SrcSpanInfo -> Var +name2var name = case name of + Ident l str -> toVar str + Symbol l str -> toVar str +cname2var :: CName SrcSpanInfo -> Var +cname2var name = case name of + VarName l str -> name2var str + ConName l str -> name2var str + +-- parse the import header speclist +parseSpec :: ImportSpec SrcSpanInfo -> [Var] +parseSpec imp = + case imp of + -- imported a variable + IVar l nm -> [name2var nm] + -- a class, datatype, or type + IAbs l nmspc nm -> [name2var nm] + -- a class with all it's methods, or a datatype with all it's constructors + IThingAll l nm -> [name2var nm] + -- a class with some of it's methods, or a datatype with some of it's constructors + IThingWith l nm thgs -> [name2var nm] ++ map cname2var thgs + + +-- construct global registry of uniques +-- returns Map {qualified name} => {globally unique name} +buildGlobalEnv :: ProgBundle0 -> PassM (NameEnv, NameEnv, NameEnv) +buildGlobalEnv (ProgBundle modules main) = do + (ddefenv, fdefenv, constrenv) <- _buildGlobalEnv main -- generate uniques in main module + names <- mapM _buildGlobalEnv modules -- generate uniques in imported modules + pure $ foldr (\(ddefs, fdefs, constrs) (dacc, facc, cacc) -> (M.union ddefs dacc, M.union fdefs facc, M.union constrs cacc)) (ddefenv, fdefenv, constrenv) names -- union + +-- generate map of qualified names to uniques for a module +_buildGlobalEnv :: ProgModule0 -> PassM (NameEnv, NameEnv, NameEnv) +_buildGlobalEnv (ProgModule modname (Prog ddefs fdefs _) _) = + do + freshfdefs <- mapM gensym fdefs' -- generate uniques + freshddefs <- mapM gensym ddefs' + freshconstrs <- mapM gensym constrs' + let fdefenv = M.fromList $ zip fdefs' freshfdefs -- map qualified names to uniques + let ddefenv = M.fromList $ zip ddefs' freshddefs + let constrenv = M.fromList $ zip constrs' freshconstrs + pure (ddefenv, fdefenv, constrenv) + where + modname' = toVar (modname ++ ".") + constrs = L.map (\(constrName, _) -> toVar constrName) + (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] (M.elems ddefs)) + fdefs' = L.map (varAppend modname') (M.keys fdefs) -- create qualified names + ddefs' = L.map (varAppend modname') (M.keys ddefs) + constrs' = L.map (varAppend modname') constrs + + +tryToFindFreshedName :: Var -> NameEnv -> Var +tryToFindFreshedName name e = + do case M.lookup name e of + Just freshname -> freshname + Nothing -> name + +findFreshedName :: HasCallStack => Var -> NameEnv -> Var +findFreshedName name e = + do case M.lookup name e of + Just freshname -> freshname + Nothing -> error $ "could not find name: " ++ (fromVar name) ++ "\n in env: " ++ (show e) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Pretty.hs b/gibbon-compiler/src/Gibbon/Pretty.hs index 761d24a4f..651e9f1ea 100644 --- a/gibbon-compiler/src/Gibbon/Pretty.hs +++ b/gibbon-compiler/src/Gibbon/Pretty.hs @@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE InstanceSigs #-} module Gibbon.Pretty ( Pretty(..), PPStyle(..), HasPretty, render, pprintHsWithEnv, pprender ) where @@ -65,6 +66,28 @@ instance HasPretty ex => Pretty (Prog ex) where PPInternal -> ddefsDoc $+$ funsDoc $+$ meDoc PPHaskell -> ghc_compat_prefix False $+$ ddefsDoc $+$ funsDoc $+$ meDoc $+$ ghc_compat_suffix False +instance HasPretty ex => Pretty (ProgModule ex) where + pprintWithStyle sty (ProgModule name prog imports) = + let (Prog ddefs funs me) = prog + meDoc = case me of + Nothing -> empty + -- Uh, we need versions of hasBenchE for L0, L2 and L3 too : + -- Assume False for now. + Just (e,ty) -> renderMain False (pprintWithStyle sty e) (pprintWithStyle sty ty) + ddefsDoc = vcat $ map (pprintWithStyle sty) $ M.elems ddefs + funsDoc = vcat $ map (pprintWithStyle sty) $ M.elems funs + in case sty of + PPInternal -> ddefsDoc $+$ funsDoc $+$ meDoc + PPHaskell -> ghc_compat_prefix False $+$ ddefsDoc $+$ funsDoc $+$ meDoc $+$ ghc_compat_suffix False + +instance HasPretty ex => Pretty (ProgBundle ex) where + pprintWithStyle sty (ProgBundle bundle main) = + let mainDoc = pprintWithStyle sty main + bundleDoc = vcat $ map (pprintWithStyle sty) $ bundle + in case sty of + PPInternal -> mainDoc $+$ bundleDoc + PPHaskell -> ghc_compat_prefix False $+$ mainDoc $+$ bundleDoc $+$ ghc_compat_suffix False + renderMain :: Bool -> Doc -> Doc -> Doc renderMain has_bench m ty = if has_bench From 0df25110d51e6047590baaa95bd27254421ba18a Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 14 Feb 2024 11:28:49 -0500 Subject: [PATCH 47/68] fixing merge issue --- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 6cb4f0ef6..3a1238752 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -281,7 +281,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports acc) funs inlines - funs''' = + funs'' = foldr (\v acc -> M.update @@ -290,7 +290,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports acc) funs' (P.map fst (S.toList optimizeDcons)) - funs'''' = + funs''' = foldr (\k acc -> M.update From 9824c5198058ecfe71a34973a6fc3914b10eab06 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 14 Feb 2024 12:23:08 -0500 Subject: [PATCH 48/68] removed qualification from unique name (gets rid of the ugly {package}_{name} effect) --- gibbon-compiler/src/Gibbon/Compiler.hs | 32 ++---- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 107 +----------------- .../src/Gibbon/Passes/FreshBundle.hs | 28 ++--- 3 files changed, 30 insertions(+), 137 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 4b2b9e5d2..aaa1d1844 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -222,8 +222,11 @@ data CompileState a = CompileState , result :: Maybe (Value a) -- ^ Result of evaluating output of prior pass, if available. } +------------------------------------------------------------------------------- -- | Compiler entrypoint, given a full configuration and a list of -- files to process, do the thing. +-- +------------------------------------------------------------------------------- compile :: Config -> FilePath -> IO () compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do -- set the env var DEBUG, to verbosity, when > 1 @@ -232,46 +235,33 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do -- Use absolute path dir <- getCurrentDirectory let fp1 = dir fp0 - -- Parse the input file + -- Parse the input file & imports + -- get the bundle of modules ((l0_bundle, cnt0), fp) <- parseInput config input fp1 let config' = config { srcFile = Just fp } - -- put module resolution up here? so we don't have to mess with type check - - -- make "whole program mode" and option (disable module resolution) - + ----------------------------------------------------------------------------- + -- do an early typecheck, before running through the passes or into the interpreter + -- perform the minimum transformations for a whole-progrm type-check (freshBundle, bundle, tc) + ----------------------------------------------------------------------------- let initTypeChecked :: L0.Prog0 initTypeChecked = - -- We typecheck first to turn the appropriate VarE's into FunRefE's. - - - -- why frshing is useful - -- when linking modules,,, creating unique identifiers - -- nested declarations, - -- compiler move internally bound names to top level in order to flatten programs,, thus they need to be unique - - -- run an exerpiment and see if really need fresh :) - -- do we need two freshens (one here and one at the start of the passes) - - -- ought to seperate dependency tree & bundling - -- figure out the dependency tree, then parse all the file individually fst $ runPassM defaultConfig cnt0 (freshBundleNames l0_bundle >>= (\fresh -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender fresh) (L0.tcProg (fst $ runPassM defaultConfig 0 (bundleModules fresh))))) - -- cut out interp and place it after bundling - case mode of + -- run via the interpreter on the whole program Interp1 -> do dbgTrace passChatterLvl ("\nParsed:\n"++sepline++ "\n" ++ sdoc l0_bundle) (pure ()) dbgTrace passChatterLvl ("\nTypechecked:\n"++sepline++ "\n" ++ pprender initTypeChecked) (pure ()) runConf <- getRunConfig [] - --l0 <- bundleModules initTypeChecked (_s1,val,_stdout) <- gInterpProg () runConf initTypeChecked print val ToParse -> dbgPrintLn 0 $ pprender l0_bundle + -- run via the passes _ -> do dbgPrintLn passChatterLvl $ " [compiler] pipeline starting, parsed program: "++ diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 3a1238752..9807b98e6 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -96,7 +96,10 @@ parseMode = (extensions defaultParseMode) } --- TIMMY - top level comment +------------------------------------------------------------------------------- +-- parse a file, call desugar, and return the desugared bundle +-- will recurse down through import headers and fold the bundles together +------------------------------------------------------------------------------- parseFile' :: Config -> IORef ParseState -> [String] -> FilePath -> String -> IO (PassM ProgBundle0) parseFile' cfg pstate_ref import_route path mod_name = do @@ -189,52 +192,6 @@ type TopTyEnv = TyEnv TyScheme type TypeSynEnv = M.Map TyCon Ty0 --- ======================================================== - -getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool, Maybe [Var]) -getImportMeta imports = do - let parseSpecs :: Maybe (H.ImportSpecList a)-> Maybe [Var] - parseSpecs maybeSpec = do - case maybeSpec of - Just (H.ImportSpecList _ _ specList) -> - Just $ map (\spec -> case spec of - H.IVar _ n -> case n of - Ident _ v -> toVar v - Symbol _ v -> toVar v - H.IAbs _ _ n -> case n of - Ident _ v -> toVar v - Symbol _ v -> toVar v - H.IThingAll _ n -> case n of - Ident _ v -> toVar v - Symbol _ v -> toVar v - H.IThingWith _ n _ -> case n of - Ident _ v -> toVar v - Symbol _ v -> toVar v - ) specList - Nothing -> Nothing - M.fromList $ map - (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased spec) -> - case aliased of - Just (H.ModuleName _ importAs) -> - ((toVar importName), ((toVar importAs), qualified, (parseSpecs spec))) - Nothing -> ((toVar importName), ((toVar importName), qualified, (parseSpecs spec))) - ) - imports - --- ======================================================== - --- ======================================================== --- what we want: --- accumulate a list of compiler models --- create a bundle of modules that get merged later --- insert a pass after desugar that takes [Prog0] --- have a pass that turns [Prog0] -> Prog0 --- imagine in the future the whole pipeline works on the bundle - --- parser -> represent code as faithfully as possible (avoid modifiying the program) --- later passes -> operate on more abstract representations of the program --- ======================================================== - ------------------------------------------------------------------------------- -- recursively desugars modules and their imports -- stacks into a ProgBundle: a bundle of modules and their main module @@ -251,16 +208,7 @@ desugarModule :: -> IO (PassM ProgBundle0) desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) mod_name = do let type_syns = foldl collectTypeSynonyms M.empty decls - -- Since top-level functions and their types can't be declared in - -- single top-level declaration we first collect types and then collect - -- definitions. funtys = foldr (collectTopTy type_syns) M.empty decls - -- get rid of dbgprints - --dbgPrintLn 2 "================================================================================" - --dbgPrintLn 2 $ "desugaring module: " ++ mod_name - dbgPrintLn 2 $ "- imports: " ++ (show import_names) - --dbgPrintLn 2 $ "- aliases: " ++ (show aliases) - --dbgPrintLn 2 $ "- imports: " ++ (show (getImportMeta imports)) imported_progs :: [PassM ProgBundle0] <- mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports let prog = do @@ -268,9 +216,6 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = foldr classify init_acc toplevels userOrderings' = M.fromList $ coalese_constraints userOrderings - --defs' = M.mapWithKey (\k (DDef _ tyArgs dataCons) -> DDef k tyArgs (L.map (\(constrName, vs) -> ((mod_name ++ "." ++ constrName), vs)) dataCons) ) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) defs) - --funs' = M.mapWithKey (\k funDef -> funDef {funName = k }) (M.mapKeys (\k -> toVar (mod_name ++ "." ++ (fromVar k))) funs) -- can insert function name here - --funs' = M.map (\funDef -> funDef {funMeta = funMeta {funModule = mod_name}}) funs -- can insert function name here funs' = foldr (\v acc -> @@ -310,50 +255,6 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let bundle = foldr (\(ProgBundle imported_bundle imported_mainmodule) acc -> acc ++ imported_bundle ++ [imported_mainmodule]) [] imported_progs' pure $ ProgBundle bundle (ProgModule mod_name (Prog defs funs''' main) imports) pure prog - {- - Prog defs'' funs''''' main' <- fillImports (Prog defs' funs''' main) (toVar mod_name) imports imported_progs' - let (defs0, funs0) = - foldr - (\Prog {ddefs, fundefs} (defs1, funs1) -> - let ddef_names1 = M.keysSet defs1 - ddef_names2 = M.keysSet ddefs - fn_names1 = M.keysSet funs1 - fn_names2 = M.keysSet fundefs - em1 = S.intersection ddef_names1 ddef_names2 - em2 = S.intersection fn_names1 fn_names2 - conflicts1 = - foldr - (\d acc -> - if (ddefs M.! d) /= (defs1 M.! d) - then d : acc - else acc) - [] - em1 - conflicts2 = - foldr - (\f acc -> - if (fundefs M.! f) /= (funs1 M.! f) - then dbgTraceIt - (sdoc ((fundefs M.! f), (funs1 M.! f))) - (f : acc) - else acc) - [] - em2 - in case (conflicts1, conflicts2) of - ([], []) -> - (M.union ddefs defs1, M.union fundefs funs1) - (_x:_xs, _) -> - error $ - "Conflicting definitions of " ++ - show conflicts1 ++ " found in " ++ mod_name - (_, _x:_xs) -> - error $ - "Conflicting definitions of " ++ - show (S.toList em2) ++ " found in " ++ mod_name) - (defs'', funs''''') - imported_progs' - -} - --pure $ pure $ (Prog defs0 funs0 main') --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) --modname = moduleName head_mb diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs index 197e21cbe..0238330dc 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -16,27 +16,29 @@ import GHC.Stack (HasCallStack) type NameEnv = M.Map Var Var - --- try to merge it back into the original branch --- CI/CD --- - +------------------------------------------------------------------------------- -- exported fresh bundle pass --- freshes names, replaces all references with new, globally unique names +-- replaces all references with new, globally unique names (data types, functions, constructors) +------------------------------------------------------------------------------- freshBundleNames :: ProgBundle0 -> PassM ProgBundle0 freshBundleNames bundle = do + -- build global map of uniques + -- {legal reference} => unique (uniquedefenv, uniquefunenv, uniqueconstenv) <- buildGlobalEnv bundle + let ProgBundle modules main = bundle + -- run through modules, fresh names modules' <- mapM (\v -> freshModule v bundle uniquedefenv uniquefunenv uniqueconstenv) modules main' <- freshModule main bundle uniquedefenv uniquefunenv uniqueconstenv + -- update keys modules'' <- mapM (\v -> freshModuleKeys v uniquedefenv uniquefunenv) modules' main'' <- freshModuleKeys main' uniquedefenv uniquefunenv pure $ ProgBundle modules'' main'' -- helper functions ----------------------------------------------------------- --- rename the function and definition keys to their uniques +-- update the keys freshModuleKeys :: ProgModule0 -> NameEnv -> NameEnv -> PassM ProgModule0 freshModuleKeys (ProgModule name (Prog defs funs main) imports) uniquedefenv uniquefunenv = do let funs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquefunenv) funs @@ -330,17 +332,17 @@ _buildGlobalEnv (ProgModule modname (Prog ddefs fdefs _) _) = freshfdefs <- mapM gensym fdefs' -- generate uniques freshddefs <- mapM gensym ddefs' freshconstrs <- mapM gensym constrs' - let fdefenv = M.fromList $ zip fdefs' freshfdefs -- map qualified names to uniques - let ddefenv = M.fromList $ zip ddefs' freshddefs - let constrenv = M.fromList $ zip constrs' freshconstrs + let fdefenv = M.fromList $ zip (L.map (\v -> varAppend modname' v) fdefs') freshfdefs -- map qualified names to uniques + let ddefenv = M.fromList $ zip (L.map (\v -> varAppend modname' v) ddefs') freshddefs + let constrenv = M.fromList $ zip (L.map (\v -> varAppend modname' v) constrs') freshconstrs pure (ddefenv, fdefenv, constrenv) where modname' = toVar (modname ++ ".") constrs = L.map (\(constrName, _) -> toVar constrName) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] (M.elems ddefs)) - fdefs' = L.map (varAppend modname') (M.keys fdefs) -- create qualified names - ddefs' = L.map (varAppend modname') (M.keys ddefs) - constrs' = L.map (varAppend modname') constrs + fdefs' = M.keys fdefs -- create qualified names + ddefs' = M.keys ddefs + constrs' = constrs tryToFindFreshedName :: Var -> NameEnv -> Var From ba6601565473e8e2b4ad55107079381f13bfbf09 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 14 Feb 2024 20:17:45 -0500 Subject: [PATCH 49/68] fixed .gib extension --- gibbon-compiler/src/Gibbon/Compiler.hs | 48 +++++++++++----------- gibbon-compiler/src/Gibbon/SExpFrontend.hs | 7 ++-- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index aaa1d1844..744076ad4 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -347,31 +347,29 @@ setDebugEnvVar verbosity = parseInput :: Config -> Input -> FilePath -> IO ((L0.ProgBundle0, Int), FilePath) parseInput cfg ip fp = do - (l0, f) <- (, fp) <$> HS.parseFile cfg fp - {- - case ip of - Haskell -> (, fp) <$> HS.parseFile cfg fp - SExpr -> (, fp) <$> SExp.parseFile fp - Unspecified -> - case takeExtension fp of - ".hs" -> (, fp) <$> HS.parseFile cfg fp - ".sexp" -> (, fp) <$> SExp.parseFile fp - ".rkt" -> (, fp) <$> SExp.parseFile fp - ".gib" -> (, fp) <$> SExp.parseFile fp - oth -> do - -- A silly hack just out of sheer laziness vis-a-vis tab completion: - let f1 = fp ++ ".gib" - f2 = fp ++ "gib" - f1' <- doesFileExist f1 - f2' <- doesFileExist f2 - if (f1' && oth == "") || (f2' && oth == ".") - then (,f2) <$> SExp.parseFile f1 - else error $ mconcat - [ "compile: unrecognized file extension: " - , show oth - , " Please specify compile input format." - ] - -} + --(l0, f) <- (, fp) <$> HS.parseFile cfg fp + (l0, f) <- case ip of + Haskell -> (, fp) <$> HS.parseFile cfg fp + SExpr -> (, fp) <$> SExp.parseFile fp + Unspecified -> + case takeExtension fp of + ".hs" -> (, fp) <$> HS.parseFile cfg fp + ".sexp" -> (, fp) <$> SExp.parseFile fp + ".rkt" -> (, fp) <$> SExp.parseFile fp + ".gib" -> (, fp) <$> SExp.parseFile fp + oth -> do + -- A silly hack just out of sheer laziness vis-a-vis tab completion: + let f1 = fp ++ ".gib" + f2 = fp ++ "gib" + f1' <- doesFileExist f1 + f2' <- doesFileExist f2 + if (f1' && oth == "") || (f2' && oth == ".") + then (,f2) <$> SExp.parseFile f1 + else error $ mconcat + [ "compile: unrecognized file extension: " + , show oth + , " Please specify compile input format." + ] let l0' = do parsed <- l0 -- dbgTraceIt (sdoc parsed) (pure ()) HS.desugarBundleLinearExts parsed diff --git a/gibbon-compiler/src/Gibbon/SExpFrontend.hs b/gibbon-compiler/src/Gibbon/SExpFrontend.hs index 679e9b8b4..93dd07ebf 100644 --- a/gibbon-compiler/src/Gibbon/SExpFrontend.hs +++ b/gibbon-compiler/src/Gibbon/SExpFrontend.hs @@ -184,10 +184,11 @@ tagDataCons ddefs = go allCons -- | Convert from raw, unstructured S-Expression into the L1 program datatype we expect. -parseSExp :: [Sexp] -> PassM Prog0 +parseSExp :: [Sexp] -> PassM ProgBundle0 parseSExp ses = do prog@Prog {ddefs} <- go ses [] [] [] Nothing - mapMExprs (tagDataCons ddefs) prog + prog' <- mapMExprs (tagDataCons ddefs) prog + pure $ ProgBundle [] (ProgModule "Main" prog' []) where -- WARNING: top-level constant definitions are INLINED everywhere. @@ -725,7 +726,7 @@ handleRequire baseFile (l:ls) = return $ l:ls' -- ^ Parse a file to an L1 program. Return also the gensym counter. -parseFile :: FilePath -> IO (PassM Prog0) +parseFile :: FilePath -> IO (PassM ProgBundle0) parseFile file = do txt <- fmap bracketHacks $ -- fmap stripHashLang $ From 237b0e5dd91cb828c94e34b34f58fc35f02217ef Mon Sep 17 00:00:00 2001 From: timmy Date: Sat, 17 Feb 2024 10:56:46 -0500 Subject: [PATCH 50/68] fixed verbodity issue --- gibbon-compiler/src/Gibbon/Compiler.hs | 4 +- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 26 +++++-- gibbon-compiler/src/Gibbon/L0/Typecheck.hs | 62 ++++++++-------- .../src/Gibbon/Passes/FreshBundle.hs | 71 ++++++++++--------- 4 files changed, 91 insertions(+), 72 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 744076ad4..198d3d79c 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -248,7 +248,7 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do initTypeChecked = fst $ runPassM defaultConfig cnt0 (freshBundleNames l0_bundle >>= - (\fresh -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender fresh) (L0.tcProg (fst $ runPassM defaultConfig 0 (bundleModules fresh))))) + (\bundled -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender bundled) (L0.tcProg (fst $ runPassM defaultConfig 0 (bundleModules bundled))))) case mode of -- run via the interpreter on the whole program @@ -677,7 +677,7 @@ passes config@Config{dynflags} l0_bundle = do -- what does cnt do? -> the 0 in the following statement let l0 = fst $ runPassM defaultConfig 0 (bundleModules l0_bundle') - --l0 <- go "freshen" freshNames l0 + l0 <- go "freshen" freshNames l0 l0 <- goE0 "typecheck" L0.tcProg l0 l0 <- goE0 "bindLambdas" L0.bindLambdas l0 l0 <- goE0 "monomorphize" L0.monomorphize l0 diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 9807b98e6..47942d544 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -192,6 +192,15 @@ type TopTyEnv = TyEnv TyScheme type TypeSynEnv = M.Map TyCon Ty0 +mergeBundle :: ProgBundle0 -> [ProgModule0] -> [ProgModule0] +mergeBundle (ProgBundle x main) bundle = + foldr (\v acc -> if already_has v then acc else acc ++ [v]) bundle (x ++ [main]) + where + already_imported = L.map (\(ProgModule name _ _) -> name) bundle + already_has :: ProgModule0 -> Bool + already_has (ProgModule name _ _) = L.elem name already_imported + + ------------------------------------------------------------------------------- -- recursively desugars modules and their imports -- stacks into a ProgBundle: a bundle of modules and their main module @@ -210,7 +219,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports let type_syns = foldl collectTypeSynonyms M.empty decls funtys = foldr (collectTopTy type_syns) M.empty decls imported_progs :: [PassM ProgBundle0] <- - mapM (processImport cfg pstate_ref (mod_name : import_route) dir) imports + mapM (processImport cfg pstate_ref (modname : import_route) dir) imports let prog = do imported_progs' <- mapM id imported_progs toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls @@ -252,12 +261,13 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports acc) funs'' (M.keys userOrderings') - let bundle = foldr (\(ProgBundle imported_bundle imported_mainmodule) acc -> acc ++ imported_bundle ++ [imported_mainmodule]) [] imported_progs' - pure $ ProgBundle bundle (ProgModule mod_name (Prog defs funs''' main) imports) + --let bundle = foldr (\(ProgBundle imported_bundle imported_mainmodule) acc -> case of acc ++ imported_bundle ++ [imported_mainmodule]) [] imported_progs' + let bundle = foldr mergeBundle [] imported_progs' + pure $ ProgBundle bundle (ProgModule modname (Prog defs funs''' main) imports) pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) - --modname = moduleName head_mb + modname = moduleName head_mb import_names = (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ _ _) -> importName) imports) aliases = M.fromList (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ aliased _) -> @@ -309,7 +319,7 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports deleteMany [] = id -- Nothing to delete deleteMany (x:xs) = deleteMany xs . deleteOne x -- Delete one, then the rest. moduleName :: Maybe (ModuleHead a) -> String - moduleName Nothing = "Main" + moduleName Nothing = mod_name moduleName (Just (ModuleHead _ mod_name1 _warnings _exports)) = mnameToStr mod_name1 classify thing (defs, vars, funs, inlines, main, optimizeDcons, userOrderings) = @@ -392,7 +402,11 @@ processImport :: -> IO (PassM ProgBundle0) processImport cfg pstate_ref import_route dir decl@ImportDecl {..} -- When compiling with Gibbon, we should *NOT* inline things defined in Gibbon.Prim. - | mod_name == "Gibbon.Prim" = pure (pure (ProgBundle L.empty (ProgModule "Gibbon.Prim" (Prog M.empty M.empty Nothing) L.empty) )) + | mod_name == "Gibbon.Prim" = do + (ParseState imported') <- readIORef pstate_ref + case M.lookup (mod_name, "") imported' of + Just prog -> do pure $ pure prog + Nothing -> pure (pure (ProgBundle L.empty (ProgModule "Gibbon.Prim" (Prog M.empty M.empty Nothing) L.empty) )) | otherwise = do when (mod_name `elem` import_route) $ error $ diff --git a/gibbon-compiler/src/Gibbon/L0/Typecheck.hs b/gibbon-compiler/src/Gibbon/L0/Typecheck.hs index c1e2c5c4e..5ecbecb66 100644 --- a/gibbon-compiler/src/Gibbon/L0/Typecheck.hs +++ b/gibbon-compiler/src/Gibbon/L0/Typecheck.hs @@ -34,24 +34,24 @@ newtype TcM a = TcM (ExceptT Doc PassM a) instance MonadFail TcM where fail = error -runTcM :: TcM a -> PassM (Either Doc a) +runTcM :: TcM a -> PassM (Either Doc a) runTcM (TcM tc) = runExceptT tc -err :: Doc -> TcM a +err :: Doc -> TcM a err d = throwError ("L0.Typecheck: " $$ nest 4 d) -tcProgBundle :: ProgBundle0 -> PassM ProgBundle0 +tcProgBundle :: ProgBundle0 -> PassM ProgBundle0 tcProgBundle (ProgBundle bundle main) = do bundle' <- mapM tcProgModule bundle main' <- tcProgModule main pure $ ProgBundle bundle' main' -tcProgModule :: ProgModule0 -> PassM ProgModule0 +tcProgModule :: ProgModule0 -> PassM ProgModule0 tcProgModule (ProgModule modname prog imports) = do prog' <- tcProg prog pure $ ProgModule modname prog' imports -tcProg :: Prog0 -> PassM Prog0 +tcProg :: Prog0 -> PassM Prog0 tcProg prg@Prog{ddefs,fundefs,mainExp} = do let init_fenv = M.map funTy fundefs fundefs_tc <- mapM (tcFun ddefs init_fenv) fundefs @@ -79,7 +79,7 @@ tcProg prg@Prog{ddefs,fundefs,mainExp} = do pure prg { fundefs = fundefs' , mainExp = mainExp' } -tcFun :: DDefs0 -> Gamma -> FunDef0 -> PassM FunDef0 +tcFun :: DDefs0 -> Gamma -> FunDef0 -> PassM FunDef0 tcFun ddefs fenv fn@FunDef{funArgs,funTy,funBody, funName} = do res <- runTcM $ do let (ForAll tyvars (ArrowTy gvn_arg_tys gvn_retty)) = funTy @@ -94,7 +94,7 @@ tcFun ddefs fenv fn@FunDef{funArgs,funTy,funBody, funName} = do Left er -> error $ render er ++ " in " ++ show funName Right fn1 -> pure fn1 -tcExps :: DDefs0 -> Subst -> Gamma -> Gamma -> [TyVar] +tcExps :: DDefs0 -> Subst -> Gamma -> Gamma -> [TyVar] -> [(Bool, Exp0)] -> TcM (Subst, [Ty0], [Exp0]) tcExps ddefs sbst venv fenv bound_tyvars ls = do (sbsts,tys,exps) <- unzip3 <$> mapM go ls @@ -103,7 +103,7 @@ tcExps ddefs sbst venv fenv bound_tyvars ls = do go (is_main, e) = tcExp ddefs sbst venv fenv bound_tyvars is_main e -- -tcExp :: DDefs0 -> Subst -> Gamma -> Gamma -> [TyVar] +tcExp :: DDefs0 -> Subst -> Gamma -> Gamma -> [TyVar] -> Bool -> Exp0 -> TcM (Subst, Ty0, Exp0) tcExp ddefs sbst venv fenv bound_tyvars is_main ex = (\(a,b,c) -> (a,b,c)) <$> case ex of @@ -150,7 +150,7 @@ tcExp ddefs sbst venv fenv bound_tyvars is_main ex = (\(a,b,c) -> (a,b,c)) <$> PrimAppE pr args -> do (s1, arg_tys, args_tc) <- tcExps ddefs sbst venv fenv bound_tyvars (zip (repeat is_main) args) let arg_tys' = map (zonkTy s1) arg_tys - checkLen :: Int -> TcM () + checkLen :: Int -> TcM () checkLen n = if length args == n then pure () @@ -647,7 +647,7 @@ tcExp ddefs sbst venv fenv bound_tyvars is_main ex = (\(a,b,c) -> (a,b,c)) <$> pure (a', args', c) ) (dataCons ddf) else pure [x] - ) brs :: TcM [(DataCon, [(Var, Ty0)], Exp0)] + ) brs :: TcM [(DataCon, [(Var, Ty0)], Exp0)] let tycons_brs = map (getTyOfDataCon ddefs . fst3) brs' case L.nub tycons_brs of [one] -> if one == tycon @@ -754,7 +754,7 @@ tcExp ddefs sbst venv fenv bound_tyvars is_main ex = (\(a,b,c) -> (a,b,c)) <$> exp_doc = "In the expression: " <+> doc ex -tcCases :: DDefs0 -> Subst -> Gamma -> Gamma -> [TyVar] +tcCases :: DDefs0 -> Subst -> Gamma -> Gamma -> [TyVar] -> DDef0 -> [(DataCon, [(Var, Ty0)], Exp0)] -> Bool -> Exp0 -> TcM (Subst, Ty0, [(DataCon, [(Var, Ty0)], Exp0)]) tcCases ddefs sbst venv fenv bound_tyvars ddf brs is_main ex = do @@ -780,20 +780,20 @@ tcCases ddefs sbst venv fenv bound_tyvars ddf brs is_main ex = do pure (s3, head tys',exps) where -- pairs [1,2,3,4,5] = [(1,2), (2,3) (4,5)] - pairs :: [a] -> [(a,a)] + pairs :: [a] -> [(a,a)] pairs [] = [] pairs [_] = [] pairs (x:y:xs) = (x,y) : pairs (y:xs) -- | Instantiate the topmost for-alls of the argument type with meta -- type variables. -instantiate :: TyScheme -> TcM ([Ty0], Ty0) +instantiate :: TyScheme -> TcM ([Ty0], Ty0) instantiate (ForAll tvs ty) = do tvs' <- mapM (const newMetaTy) tvs let ty' = substTyVar (M.fromList $ zip tvs tvs') ty pure (tvs', ty') -generalize :: Gamma -> Subst -> [TyVar] -> Ty0 -> TcM (Subst, TyScheme) +generalize :: Gamma -> Subst -> [TyVar] -> Ty0 -> TcM (Subst, TyScheme) generalize env s bound_tyvars ty = do new_bndrs <- mapM (\(Meta i) -> do @@ -810,11 +810,11 @@ generalize env s bound_tyvars ty = do env_tvs = metaTvsInTySchemes (M.elems env) res_tvs = metaTvsInTy ty - meta_tvs :: [MetaTv] + meta_tvs :: [MetaTv] meta_tvs = res_tvs L.\\ env_tvs -- -instDataConTy :: DDefs0 -> DataCon -> TcM ([Ty0], [Ty0], Ty0) +instDataConTy :: DDefs0 -> DataCon -> TcM ([Ty0], [Ty0], Ty0) instDataConTy ddefs dcon = do let tycon = getTyOfDataCon ddefs dcon ddf = lookupDDef ddefs tycon @@ -862,7 +862,7 @@ newtype Subst = Subst (M.Map MetaTv Ty0) instance Semigroup Subst where -- (Subst s1) <> (Subst s2) = -- let mp = M.map (zonkTy (Subst s1)) s2 `M.union` s1 in Subst mp - (<>) :: Subst -> Subst -> Subst + (<>) :: Subst -> Subst -> Subst (Subst s1) <> (Subst s2) = let s2' = M.map (zonkTy (Subst s1)) s2 mp = M.unionWith combine s2' s1 @@ -871,7 +871,7 @@ instance Semigroup Subst where -- | Combine substitutions. In case of substitutions with intersecting keys, -- we will take the narrower type of the two. e.g. combine [($1, $2)] [($1, IntTy)] -- should be [($1, IntTy)]. Map.union does a left biased union so it will result in [($1, $2)] -combine :: Ty0 -> Ty0 -> Ty0 +combine :: Ty0 -> Ty0 -> Ty0 combine v1 v2 | v1 == v2 = v1 | otherwise = case (v1, v2) of (MetaTv _, _) -> v2 @@ -882,7 +882,7 @@ combine v1 v2 | v1 == v2 = v1 (PackedTy a1 v1s, PackedTy a2 v2s) -> if a1 == a2 then PackedTy a1 (zipWith combine v1s v2s) else error $ "PackedTy doesn't match "++ sdoc v1 ++ " with " ++ sdoc v2 - _ -> error $ "Failed to combine = " ++ sdoc v1 ++ " with " ++ sdoc v2 + _ -> error $ "Failed to combine = " ++ sdoc (show v1) ++ " with " ++ sdoc (show v2) emptySubst :: Subst @@ -919,11 +919,11 @@ zonkTy s@(Subst mp) ty = zonkTyScheme :: Subst -> TyScheme -> TyScheme zonkTyScheme s (ForAll tvs ty) = ForAll tvs (zonkTy s ty) -zonkTyEnv :: Subst -> Gamma -> Gamma +zonkTyEnv :: Subst -> Gamma -> Gamma zonkTyEnv s env = M.map (zonkTyScheme s) env -- Apply a substitution to an expression i.e substitue all types in it. -zonkExp :: Subst -> Exp0 -> Exp0 +zonkExp :: Subst -> Exp0 -> Exp0 zonkExp s ex = case ex of VarE{} -> ex @@ -1000,7 +1000,7 @@ zonkExp s ex = go = zonkExp s -- Substitute tyvars with types in a ddef. -substTyVarDDef :: DDef0 -> [Ty0] -> TcM DDef0 +substTyVarDDef :: DDef0 -> [Ty0] -> TcM DDef0 substTyVarDDef d@DDef{tyArgs,dataCons} tys = if length tyArgs /= length tys then err $ text "substTyVarDDef: tyArgs don't match the tyapps, in " @@ -1018,7 +1018,7 @@ substTyVarDDef d@DDef{tyArgs,dataCons} tys = , dataCons = dcons' } -- Substitue all tyvars in an expression. -substTyVarExp :: M.Map TyVar Ty0 -> Exp0 -> Exp0 +substTyVarExp :: M.Map TyVar Ty0 -> Exp0 -> Exp0 substTyVarExp s ex = case ex of VarE{} -> ex @@ -1065,7 +1065,7 @@ substTyVarExp s ex = where go = substTyVarExp s -substTyVarPrim :: M.Map TyVar Ty0 -> Prim Ty0 -> Prim Ty0 +substTyVarPrim :: M.Map TyVar Ty0 -> Prim Ty0 -> Prim Ty0 substTyVarPrim mp pr = case pr of VAllocP elty -> VAllocP (substTyVar mp elty) @@ -1096,7 +1096,7 @@ substTyVarPrim mp pr = _ -> pr -tyVarToMetaTyl :: [Ty0] -> TcM (M.Map TyVar Ty0, [Ty0]) +tyVarToMetaTyl :: [Ty0] -> TcM (M.Map TyVar Ty0, [Ty0]) tyVarToMetaTyl tys = foldlM (\(env', acc) ty -> do @@ -1107,7 +1107,7 @@ tyVarToMetaTyl tys = -- | Replace the specified quantified type variables by -- given meta type variables. -tyVarToMetaTy :: Ty0 -> TcM (M.Map TyVar Ty0, Ty0) +tyVarToMetaTy :: Ty0 -> TcM (M.Map TyVar Ty0, Ty0) tyVarToMetaTy = go M.empty where go :: M.Map TyVar Ty0 -> Ty0 -> TcM (M.Map TyVar Ty0, Ty0) @@ -1154,7 +1154,7 @@ tyVarToMetaTy = go M.empty -- Unification -------------------------------------------------------------------------------- -unify :: Exp0 -> Ty0 -> Ty0 -> TcM Subst +unify :: Exp0 -> Ty0 -> Ty0 -> TcM Subst unify ex ty1 ty2 | ty1 == ty2 = --dbgTraceIt (sdoc ty1 ++ "/" ++ sdoc ty2) $ pure emptySubst @@ -1193,7 +1193,7 @@ unify ex ty1 ty2 $$ nest 2 (doc ex) -unifyl :: Exp0 -> [Ty0] -> [Ty0] -> TcM Subst +unifyl :: Exp0 -> [Ty0] -> [Ty0] -> TcM Subst unifyl _ [] [] = pure emptySubst unifyl e (a:as) (b:bs) = do -- N.B. We must apply s1 over the rest of the list before unifying it, i.e. @@ -1208,7 +1208,7 @@ unifyl e as bs = err $ text "Couldn't unify:" <+> doc as <+> text "and" <+> doc $$ text "In the expression: " $$ nest 2 (doc e) -unifyVar :: Exp0 -> MetaTv -> Ty0 -> TcM Subst +unifyVar :: Exp0 -> MetaTv -> Ty0 -> TcM Subst unifyVar ex a t | occursCheck a t = err $ text "Occurs check: cannot construct the inifinite type: " $$ nest 2 (doc a <+> text " ~ " <+> doc t) @@ -1217,14 +1217,14 @@ unifyVar ex a t | otherwise = pure $ Subst (M.singleton a t) -occursCheck :: MetaTv -> Ty0 -> Bool +occursCheck :: MetaTv -> Ty0 -> Bool occursCheck a t = a `elem` metaTvsInTy t -------------------------------------------------------------------------------- -- Other helpers -------------------------------------------------------------------------------- -ensureEqualTy :: Exp0 -> Ty0 -> Ty0 -> TcM () +ensureEqualTy :: Exp0 -> Ty0 -> Ty0 -> TcM () ensureEqualTy ex ty1 ty2 | ty1 == ty2 = pure () | otherwise = err $ text "Couldn't match expected type:" <+> doc ty1 diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs index 0238330dc..5ebc473d0 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -11,10 +11,11 @@ import Data.Maybe (fromJust) import Language.Haskell.Exts.Syntax (CName(..)) import Language.Haskell.Exts (Name(..)) import Language.Haskell.Exts (ImportSpecList(..)) -import Language.Haskell.Exts (ModuleName(..), Module) +import Language.Haskell.Exts (ModuleName(..), Module, eList) import GHC.Stack (HasCallStack) -type NameEnv = M.Map Var Var +type VarEnv = M.Map Var Var +type TyVarEnv t = M.Map TyVar t ------------------------------------------------------------------------------- -- exported fresh bundle pass @@ -39,7 +40,7 @@ freshBundleNames bundle = do -- helper functions ----------------------------------------------------------- -- update the keys -freshModuleKeys :: ProgModule0 -> NameEnv -> NameEnv -> PassM ProgModule0 +freshModuleKeys :: ProgModule0 -> VarEnv -> VarEnv -> PassM ProgModule0 freshModuleKeys (ProgModule name (Prog defs funs main) imports) uniquedefenv uniquefunenv = do let funs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquefunenv) funs let defs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquedefenv) defs @@ -53,7 +54,7 @@ findImportedModule mod modmap = do Nothing -> error $ "Could not find module " ++ name ++ " in imported modules: " ++ (show (M.keys modmap)) -- construct module environment from import spec & local functions -freshModule :: ProgModule0 -> ProgBundle0 -> NameEnv -> NameEnv -> NameEnv -> PassM ProgModule0 +freshModule :: ProgModule0 -> ProgBundle0 -> VarEnv -> VarEnv -> VarEnv -> PassM ProgModule0 freshModule (ProgModule modname (Prog defs funs main) imports) (ProgBundle bundle _) uniquedefenv uniquefunenv uniqueconstrenv = do defs' <- traverse (\v -> freshDDef v defenv'' constrenv'') defs @@ -78,30 +79,30 @@ freshModule (ProgModule modname (Prog defs funs main) imports) (ProgBundle bundl (defenv'', funenv'', constrenv'') = foldr (\(d, f, c) (dacc, facc, cacc) -> (M.union d dacc, M.union f facc, M.union c cacc)) (defenv', funenv', constrenv') $ map (\i -> getImportedEnv (findImportedModule i modmap) i uniquedefenv uniquefunenv uniqueconstrenv) imports - -freshDDef :: HasCallStack => DDef Ty0 -> NameEnv -> NameEnv -> PassM (DDef Ty0) + + +freshDDef :: HasCallStack => DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) freshDDef DDef{tyName,tyArgs,dataCons} defenv constrenv = do - let tyName' = findFreshedName tyName defenv let dataCons' = L.map (\(dataCon, vs) -> (fromVar (findFreshedName (toVar dataCon) constrenv), vs)) dataCons let dataCons'' = L.map (\v -> findFreshInDataCons v defenv) dataCons' + let tyName' = findFreshedName tyName defenv pure $ DDef tyName' tyArgs dataCons'' -freshFun :: FunDef Exp0 -> NameEnv -> NameEnv -> NameEnv -> PassM (FunDef Exp0) +freshFun :: FunDef Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM (FunDef Exp0) freshFun (FunDef nam nargs funty bod meta) defenv funenv constrenv = do let nam' = findFreshedName nam funenv - let funty' = resolveModsInTyScheme funty defenv + funty' <- findFreshInTyScheme funty defenv let funenv' = foldr (\v acc -> M.insert v v acc ) funenv nargs bod' <- findFreshInExp bod defenv funenv' constrenv pure $ FunDef nam' nargs funty' bod' meta -resolveModsInTyScheme :: TyScheme -> NameEnv -> TyScheme -resolveModsInTyScheme (ForAll tvs ty) defenv = do - let ty' = findFreshInTy ty defenv - ForAll tvs ty' +findFreshInTyScheme :: TyScheme -> VarEnv -> PassM TyScheme +findFreshInTyScheme (ForAll tvs ty) defenv = do + pure $ ForAll tvs $ findFreshInTy ty defenv -findFreshInTy :: Ty0 -> NameEnv -> Ty0 -findFreshInTy ty defenv = +findFreshInTy :: Ty0 -> VarEnv -> Ty0 +findFreshInTy ty defenv = case ty of IntTy -> ty CharTy -> ty @@ -113,24 +114,28 @@ findFreshInTy ty defenv = SymHashTy -> ty MetaTv{} -> ty TyVar tv -> ty - ProdTy tys -> ProdTy $ map (\v -> findFreshInTy v defenv) tys - SymDictTy v ty -> SymDictTy v $ findFreshInTy ty defenv - PDictTy k v -> PDictTy (findFreshInTy k defenv) (findFreshInTy v defenv) - ArrowTy tys t -> ArrowTy (map (\v -> findFreshInTy v defenv) tys) $ findFreshInTy t defenv - - PackedTy tycon tys -> PackedTy (fromVar (findFreshedName (toVar tycon) defenv)) $ map (\v -> findFreshInTy v defenv) tys - + ProdTy tys -> ProdTy $ L.map (\v -> findFreshInTy v defenv) tys + SymDictTy v t -> SymDictTy v $ findFreshInTy t defenv + PDictTy k v -> do + let k' = findFreshInTy k defenv + let v' = findFreshInTy v defenv + PDictTy k' v' + ArrowTy tys t -> do + let tys' = L.map (\v -> findFreshInTy v defenv) tys + let t' = findFreshInTy t defenv + ArrowTy tys' t' + PackedTy tycon tys -> PackedTy (fromVar (findFreshedName (toVar tycon) defenv)) $ L.map (\v -> findFreshInTy v defenv) tys VectorTy el_t -> VectorTy $ findFreshInTy el_t defenv ListTy el_t -> ListTy $ findFreshInTy el_t defenv IntHashTy -> ty -findFreshInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> NameEnv -> (DataCon, [(IsBoxed, Ty0)]) +findFreshInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) findFreshInDataCons (con, tys) defenv = do let tys' = map (\(boxed, ty) -> (boxed, (findFreshInTy ty defenv))) tys (con, tys') -findFreshInExp :: Exp0 -> NameEnv -> NameEnv -> NameEnv -> PassM Exp0 +findFreshInExp :: Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM Exp0 findFreshInExp exp defenv funenv constrenv = case exp of LitE i -> return $ LitE i @@ -235,7 +240,7 @@ findFreshInExp exp defenv funenv constrenv = return $ Ext $ LinearExt a -- parse import header -getImportedEnv :: ProgModule0 -> ImportDecl SrcSpanInfo -> NameEnv -> NameEnv -> NameEnv -> (NameEnv, NameEnv, NameEnv) +getImportedEnv :: ProgModule0 -> ImportDecl SrcSpanInfo -> VarEnv -> VarEnv -> VarEnv -> (VarEnv, VarEnv, VarEnv) getImportedEnv (ProgModule _ (Prog defs funs _) _) imp uniquedefenv uniquefunenv uniqueconstrenv = do let ImportDecl _ (ModuleName _ impname) qual _ _ _ as specs = imp let impname' = toVar (impname ++ ".") @@ -244,7 +249,7 @@ getImportedEnv (ProgModule _ (Prog defs funs _) _) imp uniquedefenv uniquefunenv Nothing -> toVar $ impname ++ "." let constrs = L.map (\(constrName, _) -> toVar constrName) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] (M.elems defs)) - let impenv :: (NameEnv, NameEnv, NameEnv) + let impenv :: (VarEnv, VarEnv, VarEnv) impenv = case specs of Just (ImportSpecList _ _ speclist) -> do let specednames = foldr (\v acc -> (parseSpec v) ++ acc) [] speclist @@ -319,14 +324,14 @@ parseSpec imp = -- construct global registry of uniques -- returns Map {qualified name} => {globally unique name} -buildGlobalEnv :: ProgBundle0 -> PassM (NameEnv, NameEnv, NameEnv) +buildGlobalEnv :: ProgBundle0 -> PassM (VarEnv, VarEnv, VarEnv) buildGlobalEnv (ProgBundle modules main) = do (ddefenv, fdefenv, constrenv) <- _buildGlobalEnv main -- generate uniques in main module names <- mapM _buildGlobalEnv modules -- generate uniques in imported modules pure $ foldr (\(ddefs, fdefs, constrs) (dacc, facc, cacc) -> (M.union ddefs dacc, M.union fdefs facc, M.union constrs cacc)) (ddefenv, fdefenv, constrenv) names -- union -- generate map of qualified names to uniques for a module -_buildGlobalEnv :: ProgModule0 -> PassM (NameEnv, NameEnv, NameEnv) +_buildGlobalEnv :: ProgModule0 -> PassM (VarEnv, VarEnv, VarEnv) _buildGlobalEnv (ProgModule modname (Prog ddefs fdefs _) _) = do freshfdefs <- mapM gensym fdefs' -- generate uniques @@ -345,14 +350,14 @@ _buildGlobalEnv (ProgModule modname (Prog ddefs fdefs _) _) = constrs' = constrs -tryToFindFreshedName :: Var -> NameEnv -> Var +tryToFindFreshedName :: Var -> VarEnv -> Var tryToFindFreshedName name e = do case M.lookup name e of Just freshname -> freshname Nothing -> name -findFreshedName :: HasCallStack => Var -> NameEnv -> Var -findFreshedName name e = - do case M.lookup name e of +findFreshedName :: HasCallStack => Var -> VarEnv -> Var +findFreshedName name e = + case M.lookup name e of Just freshname -> freshname - Nothing -> error $ "could not find name: " ++ (fromVar name) ++ "\n in env: " ++ (show e) \ No newline at end of file + Nothing -> error $ "could not find name: " ++ (fromVar name) ++ "\n in env: " ++ (show e) From e10b20648253841f3d9e1fbcf9761c06669f8bae Mon Sep 17 00:00:00 2001 From: timmy Date: Sat, 17 Feb 2024 12:06:45 -0500 Subject: [PATCH 51/68] adding the fix to the interpreter --- gibbon-compiler/src/Gibbon/Compiler.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 198d3d79c..4002eebc3 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -248,7 +248,14 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do initTypeChecked = fst $ runPassM defaultConfig cnt0 (freshBundleNames l0_bundle >>= - (\bundled -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender bundled) (L0.tcProg (fst $ runPassM defaultConfig 0 (bundleModules bundled))))) + (\bundled -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender bundled) + (L0.tcProg (fst $ runPassM defaultConfig 0 + (freshNames (fst $ runPassM defaultConfig 0 + (bundleModules bundled) + )) + )) + ) + ) case mode of -- run via the interpreter on the whole program From 9662f044221a466a84e319419968d00371a18387 Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 16:12:30 -0500 Subject: [PATCH 52/68] PR cleanup --- gibbon-compiler/src/Gibbon/Common.hs | 2 +- gibbon-compiler/src/Gibbon/Compiler.hs | 8 +- .../src/Gibbon/Passes/FreshBundle.hs | 10 +- .../src/Gibbon/Passes/FreshConstructors.hs | 158 -------- .../src/Gibbon/Passes/ModuleFillImports.hs | 358 ------------------ .../src/Gibbon/Passes/ModuleRename.hs | 260 ------------- 6 files changed, 9 insertions(+), 787 deletions(-) delete mode 100644 gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs delete mode 100644 gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs delete mode 100644 gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs diff --git a/gibbon-compiler/src/Gibbon/Common.hs b/gibbon-compiler/src/Gibbon/Common.hs index c4dab877e..1b24bbb56 100644 --- a/gibbon-compiler/src/Gibbon/Common.hs +++ b/gibbon-compiler/src/Gibbon/Common.hs @@ -148,7 +148,7 @@ newUniq = state (\x -> (x, x+1)) -- | Generate a unique symbol by attaching a numeric suffix. gensym :: MonadState Int m => Var -> m Var -gensym v = state (\n -> (cleanFunName v `varAppend` "_" `varAppend` toVar (show n), n + 1)) +gensym v = state (\n -> (cleanFunName v `varAppend` "_/v" `varAppend` toVar (show n), n + 1)) gensym_tag :: MonadState Int m => Var -> String -> m Var gensym_tag v str = state (\n -> (cleanFunName v `varAppend` toVar (show n ++ str) , n + 1)) diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 4002eebc3..9b992927b 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -64,8 +64,6 @@ import qualified Gibbon.L1.Typecheck as L1 import qualified Gibbon.L2.Typecheck as L2 import qualified Gibbon.L3.Typecheck as L3 import Gibbon.Passes.FreshBundle (freshBundleNames) -import Gibbon.Passes.FreshConstructors (freshConstructors) -import Gibbon.Passes.ModuleRename (moduleRename) import Gibbon.Passes.Freshen (freshNames) import Gibbon.Passes.Flatten (flattenL1, flattenL2, flattenL3) import Gibbon.Passes.InlineTriv (inlineTriv) @@ -242,7 +240,7 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do ----------------------------------------------------------------------------- -- do an early typecheck, before running through the passes or into the interpreter - -- perform the minimum transformations for a whole-progrm type-check (freshBundle, bundle, tc) + -- perform the minimum transformations for a whole-progrm type-check (freshBundle, bundle, fresh, tc) ----------------------------------------------------------------------------- let initTypeChecked :: L0.Prog0 initTypeChecked = @@ -675,9 +673,7 @@ passes config@Config{dynflags} l0_bundle = do use_solver = gopt Opt_Layout_Use_Solver dynflags tcProg3 = L3.tcProg isPacked - --l0_unbundled <- go "freshConstructors" freshConstructors l0_unbundled - --l0_unbundled <- go "renameModules" moduleRename l0_unbundled - + -- generate unique names functions and data types l0_bundle' <- go "freshBundle" freshBundleNames l0_bundle -- bundle modules diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs index 5ebc473d0..a4c75ffc2 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -46,6 +46,7 @@ freshModuleKeys (ProgModule name (Prog defs funs main) imports) uniquedefenv uni let defs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquedefenv) defs pure $ ProgModule name (Prog defs' funs' main) imports +-- find the imported module based off an import declarations findImportedModule :: ImportDecl SrcSpanInfo -> M.Map String ProgModule0 -> ProgModule0 findImportedModule mod modmap = do let (ImportDecl _ (ModuleName _ name) _ _ _ _ _ _) = mod @@ -53,7 +54,7 @@ findImportedModule mod modmap = do Just found -> found Nothing -> error $ "Could not find module " ++ name ++ " in imported modules: " ++ (show (M.keys modmap)) --- construct module environment from import spec & local functions +-- transform names to their unique counterparts freshModule :: ProgModule0 -> ProgBundle0 -> VarEnv -> VarEnv -> VarEnv -> PassM ProgModule0 freshModule (ProgModule modname (Prog defs funs main) imports) (ProgBundle bundle _) uniquedefenv uniquefunenv uniqueconstrenv = do @@ -80,7 +81,6 @@ freshModule (ProgModule modname (Prog defs funs main) imports) (ProgBundle bundl foldr (\(d, f, c) (dacc, facc, cacc) -> (M.union d dacc, M.union f facc, M.union c cacc)) (defenv', funenv', constrenv') $ map (\i -> getImportedEnv (findImportedModule i modmap) i uniquedefenv uniquefunenv uniqueconstrenv) imports - freshDDef :: HasCallStack => DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) freshDDef DDef{tyName,tyArgs,dataCons} defenv constrenv = do let dataCons' = L.map (\(dataCon, vs) -> (fromVar (findFreshedName (toVar dataCon) constrenv), vs)) dataCons @@ -239,7 +239,7 @@ findFreshInExp exp defenv funenv constrenv = LinearExt a -> do return $ Ext $ LinearExt a --- parse import header +-- parse import header and map legal references to unique names getImportedEnv :: ProgModule0 -> ImportDecl SrcSpanInfo -> VarEnv -> VarEnv -> VarEnv -> (VarEnv, VarEnv, VarEnv) getImportedEnv (ProgModule _ (Prog defs funs _) _) imp uniquedefenv uniquefunenv uniqueconstrenv = do let ImportDecl _ (ModuleName _ impname) qual _ _ _ as specs = imp @@ -349,13 +349,15 @@ _buildGlobalEnv (ProgModule modname (Prog ddefs fdefs _) _) = ddefs' = M.keys ddefs constrs' = constrs - +-- helper functions +-- try to find the name, but don't cry if you can't,,, used for VarEs tryToFindFreshedName :: Var -> VarEnv -> Var tryToFindFreshedName name e = do case M.lookup name e of Just freshname -> freshname Nothing -> name +-- map a legal reference to a unique name findFreshedName :: HasCallStack => Var -> VarEnv -> Var findFreshedName name e = case M.lookup name e of diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs b/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs deleted file mode 100644 index 15d169e94..000000000 --- a/gibbon-compiler/src/Gibbon/Passes/FreshConstructors.hs +++ /dev/null @@ -1,158 +0,0 @@ -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE FlexibleContexts #-} - -module Gibbon.Passes.FreshConstructors (freshConstructors) where - -import qualified Data.List as L -import qualified Data.Map as M - -import Gibbon.Common -import Gibbon.L0.Syntax - -type VarEnv = M.Map Var Var - -freshConstructors :: Prog0 -> PassM Prog0 -freshConstructors (Prog defs funs main) = do - let constrs :: [Var] = (L.map (\(constrName, _) -> - (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> - acc ++ dataCons - ) [] (M.elems defs)) - ) - freshNames <- (mapM (\v -> gensym v) constrs) - let constrenv :: VarEnv = M.fromList $ zip constrs freshNames - - main' <- case main of - Nothing -> return Nothing - Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) - m' <- freshConstrsInExp m constrenv - return $ Just (m',ty) - defs' <- traverse (\v -> freshConstrsInDef v constrenv) defs - funs' <- traverse (\v -> freshConstrsInFun v constrenv) funs - - return $ Prog defs' funs' main' - -freshConstrsInDef :: DDef Ty0 -> VarEnv -> PassM (DDef Ty0) -freshConstrsInDef (DDef tyName tyArgs dataCons) constrenv = - do - let dataCons' = map (\(dataCon, vs) -> - case (M.lookup (toVar dataCon) constrenv) of - Just dataCon' -> ((fromVar dataCon'), vs) - Nothing -> error $ "shouldn't get here" - ) dataCons - pure $ DDef tyName tyArgs dataCons' - --- - -freshConstrsInFun :: FunDef Exp0 -> VarEnv -> PassM (FunDef Exp0) -freshConstrsInFun (FunDef nam nargs funty bod meta) constrenv = - do - bod' <- freshConstrsInExp bod constrenv - pure $ FunDef nam nargs funty bod' meta - -freshConstrsInExp :: Exp0 -> VarEnv -> PassM Exp0 -freshConstrsInExp exp constrenv = - case exp of - LitE i -> return $ LitE i - CharE c -> return $ CharE c - FloatE i -> return $ FloatE i - LitSymE v -> return $ LitSymE v - --VarE v -> return $ VarE (varAppend (toVar "seen-") v) - VarE v -> return $ VarE v - - AppE v locs ls -> do - ls' <- traverse (\v -> freshConstrsInExp v constrenv) ls - return $ AppE v locs ls' - - PrimAppE p es -> do - es' <- traverse (\v -> freshConstrsInExp v constrenv) es - return $ PrimAppE p es' - - LetE (v,_locs,ty, e1) e2 -> do - e1' <- freshConstrsInExp e1 constrenv - e2' <- freshConstrsInExp e2 constrenv - return $ LetE (v, [], ty, e1') e2' - - IfE e1 e2 e3 -> do - e1' <- freshConstrsInExp e1 constrenv - e2' <- freshConstrsInExp e2 constrenv - e3' <- freshConstrsInExp e3 constrenv - return $ IfE e1' e2' e3' - - ProjE i e -> do - e' <- freshConstrsInExp e constrenv - return $ ProjE i e' - - MkProdE es -> do - es' <- traverse (\v -> freshConstrsInExp v constrenv) es - return $ MkProdE es' - - CaseE e mp -> do - e' <- freshConstrsInExp e constrenv - mp' <- mapM (\(c,prs,ae) -> do - let c' = (fromVar (resolveNameInEnv (toVar c) constrenv)) - ae' <- freshConstrsInExp ae constrenv - return (c', prs, ae')) mp - return $ CaseE e' mp' - - DataConE loc c es -> do - let c' = (fromVar (resolveNameInEnv (toVar c) constrenv)) - es' <- traverse (\v -> freshConstrsInExp v constrenv) es - return $ DataConE loc c' es' - - TimeIt e t b -> do - e' <- freshConstrsInExp e constrenv - return $ TimeIt e' t b - WithArenaE v e -> do - e' <- freshConstrsInExp e constrenv - return $ WithArenaE v e' - SpawnE v locs ls -> do - ls' <- traverse (\v -> freshConstrsInExp v constrenv) ls - return $ SpawnE v locs ls' - SyncE -> return $ SyncE - - MapE (v, d, ve) e -> do - e' <- freshConstrsInExp e constrenv - ve' <- freshConstrsInExp ve constrenv - return $ MapE (v, d, ve') e' - FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do - e1' <- freshConstrsInExp e1 constrenv - e2' <- freshConstrsInExp e2 constrenv - e3' <- freshConstrsInExp e3 constrenv - return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> case ext of - LambdaE args bod -> do - bod' <- freshConstrsInExp bod constrenv - return $ Ext $ LambdaE args bod' - PolyAppE a b -> do - return $ Ext $ PolyAppE a b - FunRefE tyapps f -> do - return $ Ext $ FunRefE tyapps f - BenchE fn tyapps args b -> do - args' <- mapM (\arg -> freshConstrsInExp arg constrenv) args - return $ Ext $ BenchE fn tyapps args' b - ParE0 ls -> do - ls' <- mapM (\l -> freshConstrsInExp l constrenv) ls - return $ Ext $ ParE0 ls' - PrintPacked ty arg -> do - arg' <- freshConstrsInExp arg constrenv - return $ Ext $ PrintPacked ty arg' - CopyPacked ty arg -> do - arg' <- freshConstrsInExp arg constrenv - return $ Ext $ CopyPacked ty arg' - TravPacked ty arg -> do - arg' <- freshConstrsInExp arg constrenv - return $ Ext $ TravPacked ty arg' - L p e -> do - e' <- freshConstrsInExp e constrenv - return $ Ext $ L p e' - LinearExt a -> do - return $ Ext $ LinearExt a - --- - -resolveNameInEnv :: Var -> VarEnv -> Var -resolveNameInEnv name e = - do case (M.lookup name e) of - --Just freshName -> (toVar ((fromVar freshName) ++ "*")) - Just freshName -> freshName - Nothing -> name --error $ "can't find " ++ (fromVar name) ++ " in constructor env: " ++ (show e) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs deleted file mode 100644 index ae9db7746..000000000 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleFillImports.hs +++ /dev/null @@ -1,358 +0,0 @@ -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE FlexibleContexts #-} - --- | Unique names. - -module Gibbon.Passes.ModuleFillImports (fillImports) where - -import Control.Exception -import Data.Foldable ( foldrM ) -import Prelude hiding (exp) -import qualified Data.List as L -import qualified Data.Map as M - -import Gibbon.Common -import Gibbon.L0.Syntax -import qualified Gibbon.L1.Syntax as L1 - -import qualified Language.Haskell.Exts.Syntax as H - --------------------------------------------------------------------------------- - -type VarEnv = M.Map Var (M.Map Var (Var, Bool)) -type TyVarEnv t = M.Map TyVar t - -fillImports :: Prog0 -> Var -> [H.ImportDecl a] -> [Prog0]-> PassM Prog0 -fillImports (Prog defs funs main) localMod imports imported_progs = - do - - -- resolve aliases in imported functions - let importMeta = getImportMeta imports - let initImportedNames :: [(Var, (Var, Bool))] = [] - let applyImportMeta :: Var -> [(Var, (Var, Bool))] -> [(Var, (Var, Bool))] - applyImportMeta v acc = do - let (mod, name) = parseOutMod v - case mod of - Just modName -> - case (M.lookup modName importMeta) of - Just (alias, qual, specs) -> - case specs of - Just spec -> if (elem name spec) then acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] - else acc - Nothing -> acc ++ [(toVar ((fromVar alias) ++ "." ++ (fromVar name)), (v, qual))] - --Nothing -> error $ "could not find module or alias: " ++ (show modName) ++ " for name " ++ (show v) ++ " in " ++ (show importMeta) - Nothing -> acc ++ [(v, (v, False))] - Nothing -> error "how did we get here?" - - let importedConstrs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (L.map (\(constrName, _) -> (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> acc ++ dataCons) [] idefs)))) initImportedNames imported_progs - let localConstrs = (L.map (\(constrName, _) -> - (toVar constrName)) (foldr (\(DDef _ _ dataCons) acc -> - acc ++ dataCons - ) [] (M.elems defs)) - ) - let importedDefs = foldr (\(Prog idefs _ _) acc -> acc ++ (foldr applyImportMeta [] (M.keys idefs))) initImportedNames imported_progs - let importedFuns = foldr (\(Prog _ ifuns _) acc -> acc ++ (foldr applyImportMeta [] (M.keys ifuns))) initImportedNames imported_progs - - let initEnv :: VarEnv = M.empty - -- build constructor env - - let constrNameMap = M.fromList $ importedConstrs ++ (zip localConstrs (map (\v -> (v, False)) localConstrs)) - let (constrenv, _) = M.mapAccumWithKey buildEnv initEnv constrNameMap - - -- build def env - let defNameMap = M.fromList $ importedDefs ++ (zip (M.keys defs) (map (\v -> (v, False)) (M.keys defs))) - let (defenv, _) = M.mapAccumWithKey buildEnv initEnv defNameMap - let transformDefKey :: Var -> Var - transformDefKey k = do - let (mod, name) = parseOutMod k - resolveNameInEnv mod name defenv - - -- build fun env - let funNameMap = M.fromList $ importedFuns ++ (zip (M.keys funs) (map (\v -> (v, False)) (M.keys funs)) ) - let (funenv, _) = M.mapAccumWithKey buildEnv initEnv funNameMap - let transformFunKey :: Var -> Var - transformFunKey k = do - let (mod, name) = parseOutMod k - resolveNameInEnv mod name funenv - - -- main - main' <- case main of - Nothing -> return Nothing - Just (m,ty) -> do --error $ "fun env: " ++ (show funenv) - m' <- (resolveModInExp m defenv funenv constrenv) - return $ Just (m',ty) - - - defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs - funs' <- traverse (\v -> resolveModsInFuns v defenv funenv constrenv) funs - - let defs'' = M.mapKeys transformDefKey defs' - let funs'' = M.mapKeys transformFunKey funs' - - return $ Prog defs'' funs'' main' - -getImportMeta :: [H.ImportDecl a] -> M.Map Var (Var, Bool, Maybe [Var]) -getImportMeta imports = do - let parseSpecs :: Maybe (H.ImportSpecList a)-> Maybe [Var] - parseSpecs maybeSpec = do - case maybeSpec of - Just (H.ImportSpecList _ _ specList) -> - Just $ map (\spec -> case spec of - H.IVar _ n -> case n of - H.Ident _ v -> toVar v - H.Symbol _ v -> toVar v - H.IAbs _ _ n -> case n of - H.Ident _ v -> toVar v - H.Symbol _ v -> toVar v - H.IThingAll _ n -> case n of - H.Ident _ v -> toVar v - H.Symbol _ v -> toVar v - H.IThingWith _ n _ -> case n of - H.Ident _ v -> toVar v - H.Symbol _ v -> toVar v - ) specList - Nothing -> Nothing - M.fromList $ map - (\(H.ImportDecl _ (H.ModuleName _ importName) qualified _ _ _ aliased spec) -> - case aliased of - Just (H.ModuleName _ importAs) -> - ((toVar importName), ((toVar importAs), qualified, (parseSpecs spec))) - Nothing -> ((toVar importName), ((toVar importName), qualified, (parseSpecs spec))) - ) - imports - -resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) -resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = - do - let (mod, name) = parseOutMod tyName - let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons - pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' - -resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv constrenv = - do - let nam' = parseAndResolve nam funenv - let funty' = resolveModsInTyScheme funty defenv - let funenv' = foldr appendEnv funenv nargs - bod' <- resolveModInExp bod defenv funenv' constrenv - pure $ FunDef nam' nargs funty' bod' meta - -resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme -resolveModsInTyScheme (ForAll tvs ty) defenv = do - let ty' = resolveModInTy ty defenv - ForAll tvs ty' - -resolveModsInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) -resolveModsInDataCons (con, tys) defenv funenv = - do - let tys' = map (\(boxed, ty) -> (boxed, (resolveModInTy ty defenv))) tys - (con, tys') - -resolveModInTy :: Ty0 -> VarEnv -> Ty0 -resolveModInTy ty defenv = - case ty of - IntTy -> ty - CharTy -> ty - FloatTy -> ty - SymTy0 -> ty - BoolTy -> ty - ArenaTy -> ty - SymSetTy -> ty - SymHashTy -> ty - MetaTv{} -> ty - TyVar tv -> ty - ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys - SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv - PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) - ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) (resolveModInTy t defenv) - - PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys - - VectorTy el_t -> VectorTy $ resolveModInTy el_t defenv - ListTy el_t -> ListTy $ resolveModInTy el_t defenv - IntHashTy -> ty - -resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM Exp0 -resolveModInExp exp defenv funenv constrenv = - case exp of - LitE i -> return $ LitE i - CharE c -> return $ CharE c - FloatE i -> return $ FloatE i - LitSymE v -> return $ LitSymE v - --VarE v -> return $ VarE (varAppend (toVar "seen-") v) - --VarE v -> return $ VarE v - VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) - - AppE v locs ls -> do - let v' = parseAndResolve v funenv - ls' <- traverse (\e -> resolveModInExp e defenv funenv constrenv) ls - return $ AppE v' locs ls' - - PrimAppE p es -> do - es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es - return $ PrimAppE p es' - - LetE (v,_locs,ty, e1) e2 -> do - let funenv' = appendEnv v funenv - let ty' = resolveModInTy ty defenv - e1' <- resolveModInExp e1 defenv funenv' constrenv - e2' <- resolveModInExp e2 defenv funenv' constrenv - return $ LetE (v, [], ty', e1') e2' - - IfE e1 e2 e3 -> do - e1' <- resolveModInExp e1 defenv funenv constrenv - e2' <- resolveModInExp e2 defenv funenv constrenv - e3' <- resolveModInExp e3 defenv funenv constrenv - return $ IfE e1' e2' e3' - - ProjE i e -> do - e' <- resolveModInExp e defenv funenv constrenv - return $ ProjE i e' - - MkProdE es -> do - es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es - return $ MkProdE es' - - CaseE e mp -> do - e' <- resolveModInExp e defenv funenv constrenv - mp' <- mapM (\(c,prs,ae) -> do - let c' = (fromVar (parseAndResolve (toVar c) constrenv)) - ae' <- resolveModInExp ae defenv funenv constrenv - return (c', prs, ae')) mp - return $ CaseE e' mp' - - DataConE loc c es -> do - let c' = fromVar (parseAndResolve (toVar c) constrenv) - es' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) es - return $ DataConE loc c' es' - - TimeIt e t b -> do - e' <- resolveModInExp e defenv funenv constrenv - return $ TimeIt e' t b - WithArenaE v e -> do - e' <- resolveModInExp e defenv funenv constrenv - return $ WithArenaE v e' - SpawnE v locs ls -> do - ls' <- traverse (\v -> resolveModInExp v defenv funenv constrenv) ls - return $ SpawnE v locs ls' - SyncE -> return $ SyncE - - MapE (v, d, ve) e -> do - e' <- resolveModInExp e defenv funenv constrenv - ve' <- resolveModInExp ve defenv funenv constrenv - return $ MapE (v, d, ve') e' - FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do - e1' <- resolveModInExp e1 defenv funenv constrenv - e2' <- resolveModInExp e2 defenv funenv constrenv - e3' <- resolveModInExp e3 defenv funenv constrenv - return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - --Ext ext -> return $ Ext ext - Ext ext -> case ext of - LambdaE args bod -> do - bod' <- resolveModInExp bod defenv funenv constrenv - return $ Ext $ LambdaE args bod' - PolyAppE a b -> do - return $ Ext $ PolyAppE a b - FunRefE tyapps f -> do - return $ Ext $ FunRefE tyapps f - BenchE fn tyapps args b -> do - args' <- mapM (\arg -> resolveModInExp arg defenv funenv constrenv) args - return $ Ext $ BenchE fn tyapps args' b - ParE0 ls -> do - ls' <- mapM (\l -> resolveModInExp l defenv funenv constrenv) ls - return $ Ext $ ParE0 ls' - PrintPacked ty arg -> do - let ty' = resolveModInTy ty defenv - arg' <- resolveModInExp arg defenv funenv constrenv - return $ Ext $ PrintPacked ty' arg' - CopyPacked ty arg -> do - let ty' = resolveModInTy ty defenv - arg' <- resolveModInExp arg defenv funenv constrenv - return $ Ext $ CopyPacked ty' arg' - TravPacked ty arg -> do - let ty' = resolveModInTy ty defenv - arg' <- resolveModInExp arg defenv funenv constrenv - return $ Ext $ TravPacked ty' arg' - L p e -> do - e' <- resolveModInExp e defenv funenv constrenv - return $ Ext $ L p e' - LinearExt a -> case a of - ReverseAppE e1 e2 -> do - e1' <- resolveModInExp e1 defenv funenv constrenv - e2' <- resolveModInExp e2 defenv funenv constrenv - return $ Ext $ LinearExt (ReverseAppE e1' e2') - LseqE e1 e2 -> do - e1' <- resolveModInExp e1 defenv funenv constrenv - e2' <- resolveModInExp e2 defenv funenv constrenv - return $ Ext $ LinearExt (ReverseAppE e1' e2') - AliasE e -> do - e' <- resolveModInExp e defenv funenv constrenv - return $ Ext $ LinearExt (AliasE e') - ToLinearE e -> do - e' <- resolveModInExp e defenv funenv constrenv - return $ Ext $ LinearExt (ToLinearE e') - - - - --- environment interactions - -appendEnv :: Var -> VarEnv -> VarEnv -appendEnv v env = - case (M.lookup v env) of - Just m -> case foldr findUnqualified (False, "") m of - (True, n) -> do - let (mod, _) = parseOutMod n - case mod of - Just modname -> do - (M.insert v (M.insert (toVar "") (v, False) (M.insert modname (n, True) m)) env) - Nothing -> do - (M.insert v (M.insert (toVar "") (v, False) m) env) - (False, _) -> (M.insert v (M.insert (toVar "") (v, False) m) env) - Nothing -> (M.insert v (M.singleton (toVar "") (v, False)) env) - -buildEnv :: VarEnv -> Var -> (Var, Bool) -> (VarEnv, (Var, Bool)) -buildEnv env k v = do - let (mod, name) = parseOutMod k - let mod' = case mod of - Just m -> m - Nothing -> (toVar "") - case (M.lookup name env) of - Just m -> - if (M.member mod' m) then error $ "duplicate function call in module" ++ (fromVar mod') - else ((M.insert name (M.insert mod' v m) env), v) - Nothing -> ((M.insert name (M.singleton mod' v) env), v) - -parseAndResolve :: Var -> VarEnv -> Var -parseAndResolve v env = do - let (mod, name) = parseOutMod v - resolveNameInEnv mod name env - -parseOutMod :: Var -> (Maybe Var, Var) -parseOutMod v = do - let str = (fromVar v) - case (L.elemIndices '.' str) of - [] -> (Nothing, v) - x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) - --x -> (Just (toVar (L.drop ((L.last x)+1) str)), (toVar (L.take (L.last x) str))) - -resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var -resolveNameInEnv mod name e = - do case (M.lookup name e) of - Just modspace -> case mod of - Just m -> case (M.lookup m modspace) of - Just (n, _) -> n - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) ++ " in env: " ++ (show e) - Nothing -> case (foldr findUnqualified (False, "") modspace) of - (True, n) -> n - (False, _) -> error $ "can't find unquilified reference to " ++ (fromVar name) - Nothing -> case mod of - Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) - Nothing -> name - --Nothing -> error $ "can't find " ++ (fromVar name) ++ " in env: " ++ (show e) - -findUnqualified :: (Var, Bool) -> (Bool, Var) -> (Bool, Var) -findUnqualified (n, q) (acc, out) = - if (not q) && (not acc) then (True, n) - else if (not q) && acc then error $ "Ambiguous reference : " ++ (fromVar n) ++ " and " ++ (fromVar out) - else (acc, out) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs b/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs deleted file mode 100644 index 7a4c92b99..000000000 --- a/gibbon-compiler/src/Gibbon/Passes/ModuleRename.hs +++ /dev/null @@ -1,260 +0,0 @@ -{-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE FlexibleContexts #-} - --- | Unique names. - -module Gibbon.Passes.ModuleRename (moduleRename) where - -import Control.Exception -import Data.Foldable ( foldrM ) -import Prelude hiding (exp) -import qualified Data.List as L -import qualified Data.Map as M - -import Gibbon.Common -import Gibbon.L0.Syntax -import qualified Gibbon.L1.Syntax as L1 - --------------------------------------------------------------------------------- - -type VarEnv = M.Map Var (M.Map Var Var) -type TyVarEnv t = M.Map TyVar t - -moduleRename :: Prog0 -> PassM Prog0 -moduleRename (Prog defs funs main) = - do - -- defs - renamedDefs <- mapM (\k -> (gensym k)) (M.keys defs) - let defNameMap = M.fromList $ zip (M.keys defs) renamedDefs - let initDefEnv :: VarEnv = M.empty - let (defenv, _) = M.mapAccumWithKey buildEnv initDefEnv defNameMap - let transformDefKey :: Var -> Var - transformDefKey k = do - let (mod, name) = parseOutMod k - resolveNameInEnv mod name defenv - - -- funs - renamedFuns <- mapM (\k -> (gensym k)) (M.keys funs) - let funNameMap = M.fromList $ zip (M.keys funs) renamedFuns - let initFunEnv :: VarEnv = M.empty - let (funenv, _) = M.mapAccumWithKey buildEnv initFunEnv funNameMap - let transformFunKey :: Var -> Var - transformFunKey k = do - let (mod, name) = parseOutMod k - resolveNameInEnv mod name funenv - - -- main - main' <- case main of - Nothing -> return Nothing - Just (m,ty) -> do m' <- resolveModInExp m defenv funenv - return $ Just (m',ty) - - defs' <- traverse (\v -> resolveModsInDefs v defenv funenv) defs - funs' <- traverse (\v -> resolveModsInFuns v defenv funenv) funs - - let defs'' = M.mapKeys transformDefKey defs' - let funs'' = M.mapKeys transformFunKey funs' - - return $ Prog defs'' funs'' main' - -resolveModsInDefs :: DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) -resolveModsInDefs (DDef tyName tyArgs dataCons) defenv funenv = - do - let (mod, name) = parseOutMod tyName - let dataCons' = map (\v -> resolveModsInDataCons v defenv funenv) dataCons - pure $ DDef (resolveNameInEnv mod name defenv) tyArgs dataCons' - -resolveModsInFuns :: FunDef Exp0 -> VarEnv -> VarEnv -> PassM (FunDef Exp0) -resolveModsInFuns (FunDef nam nargs funty bod meta) defenv funenv = - do - let nam' = parseAndResolve nam funenv - let funty' = resolveModsInTyScheme funty defenv - let funenv' = foldr appendEnv funenv nargs - bod' <- resolveModInExp bod defenv funenv' - pure $ FunDef nam' nargs funty' bod' meta - -resolveModsInTyScheme :: TyScheme -> VarEnv -> TyScheme -resolveModsInTyScheme (ForAll tvs ty) defenv = do - let ty' = resolveModInTy ty defenv - ForAll tvs ty' - -resolveModsInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) -resolveModsInDataCons (con, tys) defenv funenv = - do - let tys' = map (\(boxed, ty) -> (boxed, (resolveModInTy ty defenv))) tys - (con, tys') - -resolveModInTy :: Ty0 -> VarEnv -> Ty0 -resolveModInTy ty defenv = - case ty of - IntTy -> ty - CharTy -> ty - FloatTy -> ty - SymTy0 -> ty - BoolTy -> ty - ArenaTy -> ty - SymSetTy -> ty - SymHashTy -> ty - MetaTv{} -> ty - TyVar tv -> ty - ProdTy tys -> ProdTy $ map (\v -> resolveModInTy v defenv) tys - SymDictTy v ty -> SymDictTy v $ resolveModInTy ty defenv - PDictTy k v -> PDictTy (resolveModInTy k defenv) (resolveModInTy v defenv) - ArrowTy tys t -> ArrowTy (map (\v -> resolveModInTy v defenv) tys) $ resolveModInTy t defenv - - PackedTy tycon tys -> PackedTy (fromVar (parseAndResolve (toVar tycon) defenv)) $ map (\v -> resolveModInTy v defenv) tys - - VectorTy el_t -> VectorTy $ resolveModInTy el_t defenv - ListTy el_t -> ListTy $ resolveModInTy el_t defenv - IntHashTy -> ty - -resolveModInExp :: Exp0 -> VarEnv -> VarEnv -> PassM Exp0 -resolveModInExp exp defenv funenv = - case exp of - LitE i -> return $ LitE i - CharE c -> return $ CharE c - FloatE i -> return $ FloatE i - LitSymE v -> return $ LitSymE v - --VarE v -> return $ VarE (varAppend (toVar "seen-") v) - VarE v -> return $ VarE (parseAndResolve (parseAndResolve v funenv) defenv) - - AppE v locs ls -> do - let v' = parseAndResolve v funenv - ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls - return $ AppE v' locs ls' - - PrimAppE p es -> do - es' <- traverse (\v -> resolveModInExp v defenv funenv) es - return $ PrimAppE p es' - - LetE (v,_locs,ty, e1) e2 -> do - let ty' = resolveModInTy ty defenv - let funenv' = appendEnv v funenv - e1' <- resolveModInExp e1 defenv funenv' - e2' <- resolveModInExp e2 defenv funenv' - return $ LetE (v, [], ty', e1') e2' - - IfE e1 e2 e3 -> do - e1' <- resolveModInExp e1 defenv funenv - e2' <- resolveModInExp e2 defenv funenv - e3' <- resolveModInExp e3 defenv funenv - return $ IfE e1' e2' e3' - - ProjE i e -> do - e' <- resolveModInExp e defenv funenv - return $ ProjE i e' - - MkProdE es -> do - es' <- traverse (\v -> resolveModInExp v defenv funenv) es - return $ MkProdE es' - - CaseE e mp -> do - e' <- resolveModInExp e defenv funenv - mp' <- mapM (\(c,prs,ae) -> do - ae' <- resolveModInExp ae defenv funenv - return (c, prs, ae')) mp - return $ CaseE e' mp' - - DataConE loc c es -> do - es' <- traverse (\v -> resolveModInExp v defenv funenv) es - return $ DataConE loc c es' - - TimeIt e t b -> do - e' <- resolveModInExp e defenv funenv - return $ TimeIt e' t b - WithArenaE v e -> do - e' <- resolveModInExp e defenv funenv - return $ WithArenaE v e' - SpawnE v locs ls -> do - ls' <- traverse (\v -> resolveModInExp v defenv funenv) ls - return $ SpawnE v locs ls' - SyncE -> return $ SyncE - MapE (v, d, ve) e -> do - e' <- resolveModInExp e defenv funenv - ve' <- resolveModInExp ve defenv funenv - return $ MapE (v, d, ve') e' - FoldE (v1, d1, e1) (v2, d2, e2) e3 -> do - e1' <- resolveModInExp e1 defenv funenv - e2' <- resolveModInExp e2 defenv funenv - e3' <- resolveModInExp e3 defenv funenv - return $ FoldE (v1, d1, e1') (v2, d2, e2') e3' - Ext ext -> case ext of - LambdaE args bod -> do - bod' <- resolveModInExp bod defenv funenv - return $ Ext $ LambdaE args bod' - PolyAppE a b -> do - return $ Ext $ PolyAppE a b - FunRefE tyapps f -> do - return $ Ext $ FunRefE tyapps f - BenchE fn tyapps args b -> do - args' <- mapM (\arg -> resolveModInExp arg defenv funenv) args - return $ Ext $ BenchE fn tyapps args' b - ParE0 ls -> do - ls' <- mapM (\l -> resolveModInExp l defenv funenv) ls - return $ Ext $ ParE0 ls' - PrintPacked ty arg -> do - let ty' = resolveModInTy ty defenv - arg' <- resolveModInExp arg defenv funenv - return $ Ext $ PrintPacked ty' arg' - CopyPacked ty arg -> do - let ty' = resolveModInTy ty defenv - arg' <- resolveModInExp arg defenv funenv - return $ Ext $ CopyPacked ty' arg' - TravPacked ty arg -> do - let ty' = resolveModInTy ty defenv - arg' <- resolveModInExp arg defenv funenv - return $ Ext $ TravPacked ty' arg' - L p e -> do - e' <- resolveModInExp e defenv funenv - return $ Ext $ L p e' - LinearExt a -> do - return $ Ext $ LinearExt a - - --- environment interactions - -appendEnv :: Var -> VarEnv -> VarEnv -appendEnv v env = - case (M.lookup v env) of - Just m -> (M.insert v (M.insert (toVar "") v m) env) - Nothing -> (M.insert v (M.singleton (toVar "") v) env) - -buildEnv :: VarEnv -> Var -> Var -> (VarEnv, Var) -buildEnv env k v = do - let (mod, name) = parseOutMod k - let mod' = case mod of - Just m -> m - Nothing -> (toVar "") - case (M.lookup name env) of - Just m -> - if (M.member mod' m) then error $ "duplicate function call in mod" ++ (fromVar mod') - else ((M.insert name (M.insert mod' v m) env), v) - Nothing -> ((M.insert name (M.singleton mod' v) env), v) - -parseAndResolve :: Var -> VarEnv -> Var -parseAndResolve v env = do - let (mod, name) = parseOutMod v - resolveNameInEnv mod name env - -parseOutMod :: Var -> (Maybe Var, Var) -parseOutMod v = do - let str = (fromVar v) - case (L.elemIndices '.' str) of - [] -> (Nothing, v) - x -> (Just (toVar (L.take (L.last x) str)), (toVar (L.drop ((L.last x)+1) str))) - -resolveNameInEnv :: Maybe Var -> Var -> VarEnv -> Var -resolveNameInEnv mod name e = - do case (M.lookup name e) of - Just modspace -> case mod of - Just m -> case (M.lookup m modspace) of - Just n -> n - Nothing -> error $ "can't find " ++ (fromVar name) ++ " in module " ++ (fromVar m) - Nothing -> case (M.lookup (toVar "") modspace) of - Just n -> n - Nothing -> if(M.size modspace == 1) then head $ M.elems modspace - else error $ "can't find/ambiguous reference " ++ (fromVar name) - Nothing -> case mod of - Just m -> (toVar ((fromVar m) ++ "." ++ (fromVar name))) - Nothing -> name - --Nothing -> error $ "can't find " ++ (fromVar name) \ No newline at end of file From f66afdc7955457f5fd9aa772c098a8496987f631 Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 17:10:07 -0500 Subject: [PATCH 53/68] cleaning up build file --- gibbon-compiler/gibbon.cabal | 3 --- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 1 - 2 files changed, 4 deletions(-) diff --git a/gibbon-compiler/gibbon.cabal b/gibbon-compiler/gibbon.cabal index 6cd1ee07e..1cd281a32 100644 --- a/gibbon-compiler/gibbon.cabal +++ b/gibbon-compiler/gibbon.cabal @@ -61,9 +61,6 @@ library -- compiler passes, roughly in the order they're run Gibbon.Passes.FreshBundle - Gibbon.Passes.FreshConstructors - Gibbon.Passes.ModuleRename - Gibbon.Passes.ModuleFillImports Gibbon.Passes.Freshen Gibbon.Passes.Flatten Gibbon.Passes.InlineTriv diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 47942d544..ea687d5e5 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -38,7 +38,6 @@ import Gibbon.L0.Syntax as L0 import Data.List as L import Prelude as P -import Gibbon.Passes.ModuleFillImports (fillImports) import qualified Control.Applicative as L --import BenchRunner (main) From 41d3b8282baddc1f8c40d0f4bdc2f29cbb49cb8e Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 17:41:49 -0500 Subject: [PATCH 54/68] reverting common.hs --- gibbon-compiler/src/Gibbon/Common.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gibbon-compiler/src/Gibbon/Common.hs b/gibbon-compiler/src/Gibbon/Common.hs index 1b24bbb56..895b1fa50 100644 --- a/gibbon-compiler/src/Gibbon/Common.hs +++ b/gibbon-compiler/src/Gibbon/Common.hs @@ -148,7 +148,7 @@ newUniq = state (\x -> (x, x+1)) -- | Generate a unique symbol by attaching a numeric suffix. gensym :: MonadState Int m => Var -> m Var -gensym v = state (\n -> (cleanFunName v `varAppend` "_/v" `varAppend` toVar (show n), n + 1)) +gensym v = state (\n -> (cleanFunName v `varAppend` toVar (show n), n + 1)) gensym_tag :: MonadState Int m => Var -> String -> m Var gensym_tag v str = state (\n -> (cleanFunName v `varAppend` toVar (show n ++ str) , n + 1)) From 1349a7c4a917ed0045001584a7abd4048126e575 Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 21:00:32 -0500 Subject: [PATCH 55/68] some more test fixes --- .../layout1ContentSearchRunPipeline.ans | 2 +- .../layout1ContentSearchRunPipeline.hs | 2 +- gibbon-compiler/examples/poly/Poly1.ans | 2 +- gibbon-compiler/src/Gibbon/Compiler.hs | 17 +++++++++++++---- .../src/Gibbon/Passes/FreshBundle.hs | 3 +-- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans index b62065a49..c181aec1f 100644 --- a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans +++ b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans @@ -1 +1 @@ -(Layout1 ->i (Header Vector) ->i (ID 8) ->i (Author Vector) ->i (Date Vector) (Content (Plain (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 (Emph (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->r ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 (Emph (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Nil_v_1063)))))))))))) (Layout1 ->i (Header Vector) ->i (ID 9) ->i (Author Vector) ->i (Date Vector) (Content (Plain (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 (Emph (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Cons_v_1062 ->i (Str Vector) (Nil_v_1062))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Cons_v_1063 Vector (Nil_v_1063)))))))))))) (End)))'#() +(Layout1159 (Header172 Vector) (ID171 8) (Author170 Vector) (Date169 Vector) (Content168 (Plain173 (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Emph176 (Cons93_v1220 (Str175 Vector) (Nil92_v1220))) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Nil92_v1220))))))))))))))))))))))))))))))))))))))))))))))))))))) (TagList167 (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Nil92_v1221)))))))))))) (Layout1159 (Header172 Vector) (ID171 9) (Author170 Vector) (Date169 Vector) (Content168 (Plain173 (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Nil92_v1220))))))))))))))))))))))))))))))))))))))))))))))))))))) (TagList167 (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Nil92_v1221)))))))))))) (End158))) \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs index a01d21fb5..9cb461af9 100644 --- a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs +++ b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs @@ -18,4 +18,4 @@ gibbon_main = keyword :: Vector Char keyword = "a" newblgs = emphKeywordInContent keyword blogs - in printPacked newblgs + in newblgs diff --git a/gibbon-compiler/examples/poly/Poly1.ans b/gibbon-compiler/examples/poly/Poly1.ans index b33d84444..49fb2c177 100644 --- a/gibbon-compiler/examples/poly/Poly1.ans +++ b/gibbon-compiler/examples/poly/Poly1.ans @@ -1 +1 @@ -'#(10 #t 11 #f 2 4 (Nothing_v_295 ) (Right_v_315 20) (Right_v_306 1) 12 #f 0 3 (Cons_v_301 1(Cons_v_301 2(Nil_v_301 ))) (Cons_v_301 1(Cons_v_301 2(Nil_v_301 ))) (Right_v_306 1) (Cons_v_301 11(Cons_v_301 12(Nil_v_301 )))) \ No newline at end of file +'#(10 #t 11 #f 2 4 (Nothing99_v323) (Right98_v342 20) (Right98_v334 1) 12 #f 0 3 (Cons96_v329 1 (Cons96_v329 2 (Nil95_v329))) (Cons96_v329 1 (Cons96_v329 2 (Nil95_v329))) (Right98_v334 1) (Cons96_v329 11 (Cons96_v329 12 (Nil95_v329)))) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Compiler.hs b/gibbon-compiler/src/Gibbon/Compiler.hs index 9b992927b..074454c1c 100644 --- a/gibbon-compiler/src/Gibbon/Compiler.hs +++ b/gibbon-compiler/src/Gibbon/Compiler.hs @@ -241,19 +241,28 @@ compile config@Config{mode,input,verbosity,backend,cfile} fp0 = do ----------------------------------------------------------------------------- -- do an early typecheck, before running through the passes or into the interpreter -- perform the minimum transformations for a whole-progrm type-check (freshBundle, bundle, fresh, tc) + ----------------------------------------------------------------------------- - let initTypeChecked :: L0.Prog0 - initTypeChecked = + let initTypeChecked' :: PassM L0.Prog0 + initTypeChecked' = do + bundle <- freshBundleNames l0_bundle + bundle' <- bundleModules bundle + bundle'' <- freshNames bundle' + bundle''' <- L0.tcProg bundle'' + pure bundle''' + let initTypeChecked = fst $ runPassM config 0 initTypeChecked' + {- fst $ runPassM defaultConfig cnt0 (freshBundleNames l0_bundle >>= - (\bundled -> dbgTrace 5 ("\nFreshen:\n"++sepline++ "\n" ++pprender bundled) - (L0.tcProg (fst $ runPassM defaultConfig 0 + (\bundled -> dbgTrace 5 ("\nFreshen:\n" ++ sepline ++ "\n" ++ pprender bundled) + (L0.tcProg (fst $ runPassM defaultConfig 1 (freshNames (fst $ runPassM defaultConfig 0 (bundleModules bundled) )) )) ) ) + -} case mode of -- run via the interpreter on the whole program diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs index a4c75ffc2..4600fb89d 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -15,7 +15,6 @@ import Language.Haskell.Exts (ModuleName(..), Module, eList) import GHC.Stack (HasCallStack) type VarEnv = M.Map Var Var -type TyVarEnv t = M.Map TyVar t ------------------------------------------------------------------------------- -- exported fresh bundle pass @@ -132,7 +131,7 @@ findFreshInTy ty defenv = findFreshInDataCons :: (DataCon, [(IsBoxed, Ty0)]) -> VarEnv -> (DataCon, [(IsBoxed, Ty0)]) findFreshInDataCons (con, tys) defenv = do - let tys' = map (\(boxed, ty) -> (boxed, (findFreshInTy ty defenv))) tys + let tys' = L.map (\(boxed, ty) -> (boxed, (findFreshInTy ty defenv))) tys (con, tys') findFreshInExp :: Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM Exp0 From 86c50d605001f8403bf72797674a06165c107edb Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 21:39:59 -0500 Subject: [PATCH 56/68] some more test changes --- .../examples/layout_bench/layout1ContentSearchRunPipeline.ans | 2 +- .../examples/layout_bench/layout1ContentSearchRunPipeline.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans index c181aec1f..22fa3c6f5 100644 --- a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans +++ b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.ans @@ -1 +1 @@ -(Layout1159 (Header172 Vector) (ID171 8) (Author170 Vector) (Date169 Vector) (Content168 (Plain173 (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Emph176 (Cons93_v1220 (Str175 Vector) (Nil92_v1220))) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Nil92_v1220))))))))))))))))))))))))))))))))))))))))))))))))))))) (TagList167 (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Nil92_v1221)))))))))))) (Layout1159 (Header172 Vector) (ID171 9) (Author170 Vector) (Date169 Vector) (Content168 (Plain173 (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Cons93_v1220 (Str175 Vector) (Nil92_v1220))))))))))))))))))))))))))))))))))))))))))))))))))))) (TagList167 (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Cons93_v1221 Vector (Nil92_v1221)))))))))))) (End158))) \ No newline at end of file +(Layout1160 ->i (Header173 Vector) ->i (ID172 8) ->i (Author171 Vector) ->i (Date170 Vector) (Content169 (Plain174 (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 (Emph177 (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->r ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 (Emph177 (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList168 (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Nil93_v1222)))))))))))) (Layout1160 ->i (Header173 Vector) ->i (ID172 9) ->i (Author171 Vector) ->i (Date170 Vector) (Content169 (Plain174 (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 (Emph177 (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Cons94_v1221 ->i (Str176 Vector) (Nil93_v1221))))))))))))))))))))))))))))))))))))))))))))))))))))) ->i (TagList168 (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Cons94_v1222 Vector (Nil93_v1222)))))))))))) (End159)))'#() \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs index 9cb461af9..a01d21fb5 100644 --- a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs +++ b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs @@ -18,4 +18,4 @@ gibbon_main = keyword :: Vector Char keyword = "a" newblgs = emphKeywordInContent keyword blogs - in newblgs + in printPacked newblgs From 6062341046ac1f65b3188bcd21a25f4bde477bcc Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 22:36:11 -0500 Subject: [PATCH 57/68] alternatives for showing internal type names --- gibbon-compiler/examples/layout_bench/ir.log | 4150 +++++++++++++ .../layout1ContentSearchRunPipeline.hs | 3 +- .../examples/layout_bench/manyFuncsGlobal.ans | 2 +- .../examples/layout_bench/manyFuncsLocal.ans | 2 +- .../examples/layout_bench/manyFuncsLocal2.ans | 1 + gibbon-compiler/examples/test_153.ans | 2 +- gibbon-compiler/examples/test_166.ans | 2 +- gibbon-compiler/ir.log | 5338 +++++++++++++++++ gibbon-compiler/src/Gibbon/Common.hs | 5 +- gibbon-compiler/src/Gibbon/L1/Interp.hs | 3 + 10 files changed, 9501 insertions(+), 7 deletions(-) create mode 100644 gibbon-compiler/examples/layout_bench/ir.log create mode 100644 gibbon-compiler/examples/layout_bench/manyFuncsLocal2.ans create mode 100644 gibbon-compiler/ir.log diff --git a/gibbon-compiler/examples/layout_bench/ir.log b/gibbon-compiler/examples/layout_bench/ir.log new file mode 100644 index 000000000..d044071d4 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/ir.log @@ -0,0 +1,4150 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 + +Parsed: +================================================================================ +ProgBundle [ProgModule "GenerateLayout1" + (Prog + {ddefs = [], + fundefs = [(mkBlogs_layout1, + FunDef {funName = "mkBlogs_layout1", + funArgs = [length], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "Blog" [])), + funBody = IfE (PrimAppE LtEqP + [VarE "length",LitE 0]) + (DataConE (MetaTv $1) "End" []) + (LetE (header, + [], + MetaTv $16, + DataConE (MetaTv $15) + "Header" + [AppE "getRandomString" + [] + [LitE 5]]) + (LetE (id, + [], + MetaTv $14, + DataConE (MetaTv $13) + "ID" + [PrimAppE SubP + [LitE 10, + PrimAppE ModP + [VarE "length", + LitE 10]]]) + (LetE (author, + [], + MetaTv $12, + DataConE (MetaTv $11) + "Author" + [AppE "getRandomString" + [] + [LitE 5]]) + (LetE (date, + [], + MetaTv $10, + DataConE (MetaTv $9) + "Date" + [AppE "getRandomString" + [] + [LitE 5]]) + (LetE (content, + [], + MetaTv $8, + DataConE (MetaTv $6) + "Content" + [DataConE (MetaTv $7) + "Plain" + [AppE "mkRandomInlineList" + [] + [LitE 50]]]) + (LetE (tags, + [], + MetaTv $5, + DataConE (MetaTv $4) + "TagList" + [AppE "mkSomeTags" + [] + [LitE 10]]) + (LetE (rst, + [], + MetaTv $3, + AppE "mkBlogs_layout1" + [] + [PrimAppE SubP + [VarE "length", + LitE 1]]) + (DataConE (MetaTv $2) + "Layout1" + [VarE "header", + VarE "id", + VarE "author", + VarE "date", + VarE "content", + VarE "tags", + VarE "rst"])))))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 1 3 14, srcInfoPoints = [SrcSpan ".hs" 3 1 3 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 8 3 14, srcInfoPoints = []}) "Basics", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Gibbon.Vector" + (Prog + {ddefs = [], + fundefs = [(generate, + FunDef {funName = "generate", + funArgs = [n,f], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + ArrowTy [IntTy] + (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (n', + [], + MetaTv $91, + AppE "maxInt" [] [VarE "n",LitE 0]) + (LetE (vec, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $90)) + [VarE "n'"]) + (LetE (vec1, + [], + MetaTv $89, + AppE "generate_loop" + [] + [VarE "vec", + LitE 0,VarE "n'", + VarE "f"]) + (VarE "vec1"))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length, + FunDef {funName = "length", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + IntTy), + funBody = PrimAppE (VLengthP (MetaTv $3)) + [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (select, + FunDef {funName = "select", + funArgs = [v1,v2,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a), + IntTy] + (TyVar u:a)), + funBody = LetE (len, + [], + MetaTv $102, + PrimAppE (VLengthP (MetaTv $101)) + [VarE "v1"]) + (IfE (PrimAppE LtP + [VarE "i", + VarE "len"]) + (PrimAppE (VNthP (MetaTv $99)) + [VarE "v1",VarE "i"]) + (PrimAppE (VNthP (MetaTv $100)) + [VarE "v2", + PrimAppE SubP + [VarE "i", + VarE "len"]])), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth, + FunDef {funName = "nth", + funArgs = [vec,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy] + (TyVar u:a)), + funBody = PrimAppE (VNthP (MetaTv $15)) + [VarE "vec",VarE "i"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (singleton, + FunDef {funName = "singleton", + funArgs = [x], + funTy = ForAll [u:a] + (ArrowTy [TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = LetE (vec, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $55)) + [LitE 1]) + (LetE (vec2, + [], + MetaTv $54, + PrimAppE (InplaceVUpdateP (MetaTv $53)) + [VarE "vec",LitE 0, + VarE "x"]) + (VarE "vec2")), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (append, + FunDef {funName = "append", + funArgs = [v1,v2], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "generate" + [] + [PrimAppE AddP + [PrimAppE (VLengthP (MetaTv $105)) + [VarE "v1"], + PrimAppE (VLengthP (MetaTv $106)) + [VarE "v2"]], + Ext (LambdaE [(i, MetaTv $107)] + (AppE "select" + [] + [VarE "v1", + VarE "v2", + VarE "i"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (head, + FunDef {funName = "head", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (TyVar u:a)), + funBody = AppE "nth" [] [VarE "vec",LitE 0], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printVec, + FunDef {funName = "printVec", + funArgs = [f,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a] + (ProdTy []), + VectorTy (TyVar u:a)] + (ProdTy [])), + funBody = LetE (wildcard_178, + [], + MetaTv $179, + PrimAppE PrintSym [LitSymE "["]) + (LetE (wildcard_176, + [], + MetaTv $177, + AppE "printVec_loop" + [] + [LitE 0, + PrimAppE (VLengthP (MetaTv $175)) + [VarE "vec"], + VarE "vec",VarE "f"]) + (LetE (wildcard_173, + [], + MetaTv $174, + PrimAppE PrintSym + [LitSymE "]"]) + (MkProdE []))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (alloc, + FunDef {funName = "alloc", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VAllocP (MetaTv $1)) + [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (filter, + FunDef {funName = "filter", + funArgs = [f,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a] + BoolTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (idxs, + [], + VectorTy IntTy, + AppE "generate" + [] + [PrimAppE (VLengthP (MetaTv $231)) + [VarE "vec"], + Ext (LambdaE [(i, + MetaTv $232)] + (IfE (AppE "f" + [] + [AppE "nth" + [] + [VarE "vec", + VarE "i"]]) + (VarE "i") + (PrimAppE SubP + [LitE 0, + LitE 1])))]) + (LetE (num_ones, + [], + MetaTv $230, + AppE "foldl" + [] + [Ext (LambdaE [(acc, + IntTy), + (x, + IntTy)] + (IfE (PrimAppE EqIntP + [VarE "x", + PrimAppE SubP + [LitE 0, + LitE 1]]) + (VarE "acc") + (PrimAppE AddP + [VarE "acc", + LitE 1]))), + LitE 0,VarE "idxs"]) + (LetE (to, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $227)) + [VarE "num_ones"]) + (LetE (len_idxs, + [], + MetaTv $226, + PrimAppE (VLengthP (MetaTv $225)) + [VarE "idxs"]) + (AppE "filter_loop" + [] + [VarE "idxs", + LitE 0, + LitE 0, + VarE "len_idxs", + VarE "vec", + VarE "to"])))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (filter_loop, + FunDef {funName = "filter_loop", + funArgs = [idxs,write_at,start,end,from,to], + funTy = ForAll [u:a] + (ArrowTy [VectorTy IntTy,IntTy, + IntTy,IntTy, + VectorTy (TyVar u:a), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = IfE (PrimAppE EqIntP + [VarE "start",VarE "end"]) + (VarE "to") + (LetE (idx, + [], + MetaTv $222, + AppE "nth" + [] + [VarE "idxs", + VarE "start"]) + (IfE (PrimAppE EqIntP + [VarE "idx", + PrimAppE SubP + [LitE 0, + LitE 1]]) + (AppE "filter_loop" + [] + [VarE "idxs", + VarE "write_at", + PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end", + VarE "from", + VarE "to"]) + (LetE (elt, + [], + MetaTv $221, + AppE "nth" + [] + [VarE "from", + VarE "idx"]) + (LetE (to1, + [], + MetaTv $220, + PrimAppE (InplaceVUpdateP (MetaTv $219)) + [VarE "to", + VarE "write_at", + VarE "elt"]) + (AppE "filter_loop" + [] + [VarE "idxs", + PrimAppE AddP + [VarE "write_at", + LitE 1], + PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end", + VarE "from", + VarE "to1"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lcons, + FunDef {funName = "lcons", + funArgs = [x,vec], + funTy = ForAll [u:a] + (ArrowTy [TyVar u:a, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (y, [], MetaTv $212, VarE "vec") + (AppE "cons" + [] + [VarE "x",VarE "y"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (cons, + FunDef {funName = "cons", + funArgs = [x,vec], + funTy = ForAll [u:a] + (ArrowTy [TyVar u:a, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (len, + [], + MetaTv $209, + PrimAppE (VLengthP (MetaTv $208)) + [VarE "vec"]) + (LetE (vec2, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $207)) + [PrimAppE AddP + [VarE "len", + LitE 1]]) + (LetE (vec3, + [], + MetaTv $206, + AppE "generate_loop" + [] + [VarE "vec2", + LitE 1, + PrimAppE AddP + [VarE "len", + LitE 1], + Ext (LambdaE [(i, + MetaTv $205)] + (AppE "nth" + [] + [VarE "vec", + PrimAppE SubP + [VarE "i", + LitE 1]]))]) + (LetE (vec4, + [], + MetaTv $204, + PrimAppE (InplaceVUpdateP (MetaTv $203)) + [VarE "vec3", + LitE 0, + VarE "x"]) + (VarE "vec4")))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lsnoc, + FunDef {funName = "lsnoc", + funArgs = [vec,x], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = LetE (y, [], MetaTv $200, VarE "vec") + (AppE "snoc" + [] + [VarE "y",VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (snoc, + FunDef {funName = "snoc", + funArgs = [vec,x], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = LetE (len, + [], + MetaTv $197, + PrimAppE (VLengthP (MetaTv $196)) + [VarE "vec"]) + (LetE (vec2, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $195)) + [PrimAppE AddP + [VarE "len", + LitE 1]]) + (LetE (vec3, + [], + MetaTv $194, + AppE "generate_loop" + [] + [VarE "vec2", + LitE 0, + VarE "len", + Ext (LambdaE [(i, + MetaTv $193)] + (AppE "nth" + [] + [VarE "vec", + VarE "i"]))]) + (LetE (vec4, + [], + MetaTv $192, + PrimAppE (InplaceVUpdateP (MetaTv $191)) + [VarE "vec3", + VarE "len", + VarE "x"]) + (VarE "vec4")))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printVec_loop, + FunDef {funName = "printVec_loop", + funArgs = [idx,end,vec,f], + funTy = ForAll [u:a] + (ArrowTy [IntTy,IntTy, + VectorTy (TyVar u:a), + ArrowTy [TyVar u:a] + (ProdTy [])] + (ProdTy [])), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (MkProdE []) + (LetE (wildcard_187, + [], + MetaTv $188, + AppE "f" + [] + [PrimAppE (VNthP (MetaTv $186)) + [VarE "vec", + VarE "idx"]]) + (LetE (wildcard_184, + [], + MetaTv $185, + PrimAppE PrintSym + [LitSymE ","]) + (AppE "printVec_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end", + VarE "vec", + VarE "f"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lifoldl, + FunDef {funName = "lifoldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b,IntTy, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = LetE (x, [], MetaTv $170, VarE "vec") + (AppE "ifoldl" + [] + [VarE "f",VarE "acc", + VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (ifoldl_loop, + FunDef {funName = "ifoldl_loop", + funArgs = [idx,end,f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [IntTy,IntTy, + ArrowTy [TyVar u:b,IntTy, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "acc") + (LetE (acc1, + [], + MetaTv $166, + AppE "f" + [] + [VarE "acc",VarE "idx", + PrimAppE (VNthP (MetaTv $165)) + [VarE "vec", + VarE "idx"]]) + (AppE "ifoldl_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end",VarE "f", + VarE "acc1", + VarE "vec"])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (ifoldl, + FunDef {funName = "ifoldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b,IntTy, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = AppE "ifoldl_loop" + [] + [LitE 0, + PrimAppE (VLengthP (MetaTv $159)) + [VarE "vec"], + VarE "f",VarE "acc",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lscanl, + FunDef {funName = "lscanl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = LetE (x, [], MetaTv $155, VarE "vec") + (AppE "scanl" + [] + [VarE "f",VarE "acc", + VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (scanl_loop, + FunDef {funName = "scanl_loop", + funArgs = [idx,end,f,acc,vec,result], + funTy = ForAll [u:a,u:b] + (ArrowTy [IntTy,IntTy, + ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a), + VectorTy (TyVar u:b)] + (VectorTy (TyVar u:b))), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "result") + (LetE (acc1, + [], + MetaTv $151, + AppE "f" + [] + [VarE "acc", + PrimAppE (VNthP (MetaTv $150)) + [VarE "vec", + VarE "idx"]]) + (LetE (result', + [], + MetaTv $149, + PrimAppE (InplaceVUpdateP (MetaTv $148)) + [VarE "result", + VarE "idx", + VarE "acc1"]) + (AppE "scanl_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end", + VarE "f", + VarE "acc1", + VarE "vec", + VarE "result'"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (scanl, + FunDef {funName = "scanl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = LetE (len, + [], + MetaTv $141, + PrimAppE (VLengthP (MetaTv $140)) + [VarE "vec"]) + (LetE (result, + [], + VectorTy (TyVar u:b), + PrimAppE (VAllocP (MetaTv $139)) + [VarE "len"]) + (AppE "scanl_loop" + [] + [LitE 0,VarE "len", + VarE "f",VarE "acc", + VarE "vec", + VarE "result"])), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lfoldl, + FunDef {funName = "lfoldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = LetE (x, [], MetaTv $135, VarE "vec") + (AppE "foldl" + [] + [VarE "f",VarE "acc", + VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (foldl_loop, + FunDef {funName = "foldl_loop", + funArgs = [idx,end,f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [IntTy,IntTy, + ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "acc") + (LetE (acc1, + [], + MetaTv $131, + AppE "f" + [] + [VarE "acc", + PrimAppE (VNthP (MetaTv $130)) + [VarE "vec", + VarE "idx"]]) + (AppE "foldl_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end",VarE "f", + VarE "acc1", + VarE "vec"])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (foldl, + FunDef {funName = "foldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = AppE "foldl_loop" + [] + [LitE 0, + PrimAppE (VLengthP (MetaTv $124)) + [VarE "vec"], + VarE "f",VarE "acc",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (update, + FunDef {funName = "update", + funArgs = [vec,i,x], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy,TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = AppE "generate" + [] + [AppE "length" [] [VarE "vec"], + Ext (LambdaE [(j, MetaTv $120)] + (IfE (PrimAppE EqIntP + [VarE "i", + VarE "j"]) + (VarE "x") + (PrimAppE (VNthP (MetaTv $119)) + [VarE "vec", + VarE "j"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lmap, + FunDef {funName = "lmap", + funArgs = [f,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:a] + (TyVar u:b), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = LetE (x, [], MetaTv $115, VarE "vec") + (AppE "map" [] [VarE "f",VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (map, + FunDef {funName = "map", + funArgs = [f,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:a] + (TyVar u:b), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = AppE "generate" + [] + [PrimAppE (VLengthP (MetaTv $110)) + [VarE "vec"], + Ext (LambdaE [(i, MetaTv $112)] + (AppE "f" + [] + [PrimAppE (VNthP (MetaTv $111)) + [VarE "vec", + VarE "i"]]))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lcopy, + FunDef {funName = "lcopy", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "copy" [] [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (copy, + FunDef {funName = "copy", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "generate" + [] + [PrimAppE (VLengthP (MetaTv $93)) + [VarE "vec"], + Ext (LambdaE [(i, MetaTv $94)] + (AppE "nth" + [] + [VarE "vec", + VarE "i"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (generate_loop, + FunDef {funName = "generate_loop", + funArgs = [vec,idx,end,f], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy,IntTy, + ArrowTy [IntTy] + (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "vec") + (LetE (vec1, + [], + MetaTv $86, + PrimAppE (InplaceVUpdateP (MetaTv $85)) + [VarE "vec", + VarE "idx", + AppE "f" + [] + [VarE "idx"]]) + (AppE "generate_loop" + [] + [VarE "vec1", + PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end",VarE "f"])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (tail, + FunDef {funName = "tail", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "slice" + [] + [LitE 1, + PrimAppE SubP + [PrimAppE (VLengthP (MetaTv $80)) + [VarE "vec"], + LitE 1], + VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lsplitAt', + FunDef {funName = "lsplitAt'", + funArgs = [n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + VectorTy (TyVar u:a)] + (ProdTy [IntTy, + VectorTy (TyVar u:a), + IntTy, + VectorTy (TyVar u:a)])), + funBody = LetE (tup74, + [], + MetaTv $75, + AppE "splitAt" + [] + [VarE "n",VarE "vec"]) + (LetE (x, + [], + MetaTv $77, + ProjE 0 (VarE "tup74")) + (LetE (y, + [], + MetaTv $76, + ProjE 1 (VarE "tup74")) + (MkProdE [PrimAppE (VLengthP (MetaTv $71)) + [VarE "x"], + VarE "x", + PrimAppE (VLengthP (MetaTv $73)) + [VarE "y"], + VarE "y"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lsplitAt, + FunDef {funName = "lsplitAt", + funArgs = [n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + VectorTy (TyVar u:a)] + (ProdTy [IntTy, + VectorTy (TyVar u:a), + IntTy, + VectorTy (TyVar u:a)])), + funBody = LetE (x, [], MetaTv $67, VarE "vec") + (AppE "lsplitAt'" + [] + [VarE "n",VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (splitAt, + FunDef {funName = "splitAt", + funArgs = [n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + VectorTy (TyVar u:a)] + (ProdTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a)])), + funBody = LetE (len, + [], + MetaTv $64, + PrimAppE (VLengthP (MetaTv $63)) + [VarE "vec"]) + (LetE (n', + [], + MetaTv $62, + AppE "maxInt" + [] + [VarE "n",LitE 0]) + (LetE (m, + [], + MetaTv $61, + AppE "minInt" + [] + [VarE "n'", + VarE "len"]) + (LetE (m', + [], + MetaTv $60, + AppE "maxInt" + [] + [LitE 0, + PrimAppE SubP + [VarE "len", + VarE "n'"]]) + (MkProdE [PrimAppE (VSliceP (MetaTv $58)) + [LitE 0, + VarE "m", + VarE "vec"], + PrimAppE (VSliceP (MetaTv $59)) + [VarE "m", + VarE "m'", + VarE "vec"]])))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (isEmpty, + FunDef {funName = "isEmpty", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + BoolTy), + funBody = PrimAppE EqIntP + [PrimAppE (VLengthP (MetaTv $51)) + [VarE "vec"], + LitE 0], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (inplaceUpdate, + FunDef {funName = "inplaceUpdate", + funArgs = [i,val,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy,TyVar u:a, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (InplaceVUpdateP (MetaTv $49)) + [VarE "vec",VarE "i", + VarE "val"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (inplaceSort, + FunDef {funName = "inplaceSort", + funArgs = [cmp,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a, + TyVar u:a] + IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (InplaceVSortP (MetaTv $45)) + [VarE "vec",VarE "cmp"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (flatten, + FunDef {funName = "flatten", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (VectorTy (TyVar u:a))] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VConcatP (MetaTv $42)) + [VarE "ls"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (sort, + FunDef {funName = "sort", + funArgs = [cmp,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a, + TyVar u:a] + IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VSortP (MetaTv $40)) + [VarE "vec",VarE "cmp"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (merge, + FunDef {funName = "merge", + funArgs = [vec1,vec2], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VMergeP (MetaTv $37)) + [VarE "vec1",VarE "vec2"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (unsafeSlice, + FunDef {funName = "unsafeSlice", + funArgs = [i,n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy,IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VSliceP (MetaTv $34)) + [VarE "i",VarE "n",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (slice, + FunDef {funName = "slice", + funArgs = [i,n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy,IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VSliceP (MetaTv $30)) + [VarE "i",VarE "n",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth2, + FunDef {funName = "nth2", + funArgs = [vec,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy] + (ProdTy [TyVar u:a, + VectorTy (TyVar u:a)])), + funBody = LetE (tup26, [], MetaTv $24, VarE "vec") + (LetE (vec1, + [], + MetaTv $24, + VarE "tup26") + (LetE (vec2, + [], + MetaTv $25, + VarE "tup26") + (MkProdE [PrimAppE (VNthP (MetaTv $23)) + [VarE "vec1", + VarE "i"], + VarE "vec2"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth1, + FunDef {funName = "nth1", + funArgs = [vec,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy] + (TyVar u:a)), + funBody = PrimAppE (VNthP (MetaTv $19)) + [VarE "vec",VarE "i"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length2, + FunDef {funName = "length2", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (ProdTy [IntTy, + VectorTy (TyVar u:a)])), + funBody = LetE (tup12, [], MetaTv $10, VarE "vec") + (LetE (vec1, + [], + MetaTv $10, + VarE "tup12") + (LetE (vec2, + [], + MetaTv $11, + VarE "tup12") + (MkProdE [PrimAppE (VLengthP (MetaTv $9)) + [VarE "vec1"], + VarE "vec2"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length1, + FunDef {funName = "length1", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + IntTy), + funBody = PrimAppE (VLengthP (MetaTv $6)) + [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 1 10 22, srcInfoPoints = [SrcSpan ".hs" 10 1 10 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 8 10 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Gibbon.Prim" + (Prog {ddefs = [], fundefs = [], mainExp = Nothing}) + [], + ProgModule "Gibbon.Prelude" + (Prog + {ddefs = [], + fundefs = [(maxInt, + FunDef {funName = "maxInt", + funArgs = [a,b], + funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), + funBody = IfE (PrimAppE GtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (print_space, + FunDef {funName = "print_space", + funArgs = [wildcard_20], + funTy = ForAll [] + (ArrowTy [ProdTy []] (ProdTy [])), + funBody = PrimAppE PrintSym [LitSymE " "], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (print_newline, + FunDef {funName = "print_newline", + funArgs = [wildcard_18], + funTy = ForAll [] + (ArrowTy [ProdTy []] (ProdTy [])), + funBody = PrimAppE PrintSym [LitSymE "\n"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (print_check, + FunDef {funName = "print_check", + funArgs = [b], + funTy = ForAll [] (ArrowTy [BoolTy] (ProdTy [])), + funBody = IfE (VarE "b") + (LetE (wildcard_14, + [], + MetaTv $15, + PrimAppE PrintSym + [LitSymE "OK\n"]) + (MkProdE [])) + (LetE (wildcard_16, + [], + MetaTv $17, + PrimAppE PrintSym + [LitSymE "Err\n"]) + (MkProdE [])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (compare_int, + FunDef {funName = "compare_int", + funArgs = [r1,r2], + funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), + funBody = IfE (PrimAppE LtP [VarE "r1",VarE "r2"]) + (PrimAppE SubP [LitE 0,LitE 1]) + (IfE (PrimAppE GtP + [VarE "r1",VarE "r2"]) + (LitE 1) + (LitE 0)), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (compare_float, + FunDef {funName = "compare_float", + funArgs = [r1,r2], + funTy = ForAll [] + (ArrowTy [FloatTy,FloatTy] IntTy), + funBody = IfE (PrimAppE FLtP [VarE "r1",VarE "r2"]) + (PrimAppE SubP [LitE 0,LitE 1]) + (IfE (PrimAppE FGtP + [VarE "r1",VarE "r2"]) + (LitE 1) + (LitE 0)), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (float_abs, + FunDef {funName = "float_abs", + funArgs = [f], + funTy = ForAll [] (ArrowTy [FloatTy] FloatTy), + funBody = IfE (PrimAppE FLtP [VarE "f",FloatE 0.0]) + (PrimAppE FMulP + [VarE "f", + PrimAppE FSubP + [FloatE 0.0, + FloatE 1.0]]) + (VarE "f"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (minFloat, + FunDef {funName = "minFloat", + funArgs = [a,b], + funTy = ForAll [] + (ArrowTy [FloatTy,FloatTy] FloatTy), + funBody = IfE (PrimAppE FLtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (maxFloat, + FunDef {funName = "maxFloat", + funArgs = [a,b], + funTy = ForAll [] + (ArrowTy [FloatTy,FloatTy] FloatTy), + funBody = IfE (PrimAppE FGtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (minInt, + FunDef {funName = "minInt", + funArgs = [a,b], + funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), + funBody = IfE (PrimAppE LtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 12 1 12 19, srcInfoPoints = [SrcSpan ".hs" 12 1 12 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 12 8 12 19, srcInfoPoints = []}) "Gibbon.Prim", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Gibbon.PList" + (Prog + {ddefs = [(PList, + DDef {tyName = "PList", + tyArgs = [u:a], + dataCons = [("Nil", []), + ("Cons", + [(False, TyVar u:a), + (False, + PackedTy "PList" [TyVar u:a])])]})], + fundefs = [(is_empty_plist, + FunDef {funName = "is_empty_plist", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + BoolTy), + funBody = CaseE (VarE "ls") + [("Nil", [], PrimAppE MkTrue []), + ("Cons", + [(wildcard_1, MetaTv $3), + (wildcard_2, MetaTv $4)], + PrimAppE MkFalse [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (zip_plist, + FunDef {funName = "zip_plist", + funArgs = [as,bs], + funTy = ForAll [u:a,u:b] + (ArrowTy [PackedTy "PList" + [TyVar u:a], + PackedTy "PList" + [TyVar u:b]] + (PackedTy "PList" + [ProdTy [TyVar u:a, + TyVar u:b]])), + funBody = CaseE (VarE "as") + [("Nil", + [], + DataConE (MetaTv $71) "Nil" []), + ("Cons", + [(z, MetaTv $76), + (zs, MetaTv $77)], + CaseE (VarE "bs") + [("Nil", + [], + DataConE (MetaTv $72) + "Nil" + []), + ("Cons", + [(y, MetaTv $74), + (ys, MetaTv $75)], + DataConE (MetaTv $73) + "Cons" + [MkProdE [VarE "z", + VarE "y"], + AppE "zip_plist" + [] + [VarE "zs", + VarE "ys"]])])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (splitAt_plist, + FunDef {funName = "splitAt_plist", + funArgs = [n,a], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + PackedTy "PList" + [TyVar u:a]] + (ProdTy [PackedTy "PList" + [TyVar u:a], + PackedTy "PList" + [TyVar u:a]])), + funBody = IfE (PrimAppE EqIntP [VarE "n",LitE 0]) + (MkProdE [DataConE (MetaTv $59) + "Nil" + [], + VarE "a"]) + (CaseE (VarE "a") + [("Nil", + [], + MkProdE [DataConE (MetaTv $60) + "Nil" + [], + DataConE (MetaTv $61) + "Nil" + []]), + ("Cons", + [(x, MetaTv $67), + (xs, MetaTv $68)], + LetE (tup63, + [], + MetaTv $64, + AppE "splitAt_plist" + [] + [PrimAppE SubP + [VarE "n", + LitE 1], + VarE "xs"]) + (LetE (c, + [], + MetaTv $66, + ProjE 0 + (VarE "tup63")) + (LetE (d, + [], + MetaTv $65, + ProjE 1 + (VarE "tup63")) + (MkProdE [DataConE (MetaTv $62) + "Cons" + [VarE "x", + VarE "c"], + VarE "d"]))))]), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (map_plist, + FunDef {funName = "map_plist", + funArgs = [f,ls], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:a] + (TyVar u:b), + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:b])), + funBody = CaseE (VarE "ls") + [("Nil", + [], + DataConE (MetaTv $53) "Nil" []), + ("Cons", + [(x, MetaTv $55), + (xs, MetaTv $56)], + DataConE (MetaTv $54) + "Cons" + [AppE "f" [] [VarE "x"], + AppE "map_plist" + [] + [VarE "f", + VarE "xs"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (reverse_plist, + FunDef {funName = "reverse_plist", + funArgs = [xs,acc], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a], + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "xs") + [("Nil", [], VarE "acc"), + ("Cons", + [(z, MetaTv $49), + (zs, MetaTv $50)], + AppE "reverse_plist" + [] + [VarE "zs", + DataConE (MetaTv $48) + "Cons" + [VarE "z", + VarE "acc"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (drop_plist, + FunDef {funName = "drop_plist", + funArgs = [num,list], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "list") + [("Nil", + [], + DataConE (MetaTv $42) "Nil" []), + ("Cons", + [(x, MetaTv $44), + (rst, MetaTv $45)], + IfE (PrimAppE LtEqP + [VarE "num", + LitE 0]) + (DataConE (MetaTv $43) + "Cons" + [VarE "x", + VarE "rst"]) + (AppE "drop_plist" + [] + [PrimAppE SubP + [VarE "num", + LitE 1], + VarE "rst"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (take_plist, + FunDef {funName = "take_plist", + funArgs = [n,a], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = IfE (PrimAppE EqIntP [VarE "n",LitE 0]) + (DataConE (MetaTv $35) "Nil" []) + (CaseE (VarE "a") + [("Nil", + [], + DataConE (MetaTv $36) + "Nil" + []), + ("Cons", + [(z, MetaTv $38), + (zs, MetaTv $39)], + DataConE (MetaTv $37) + "Cons" + [VarE "z", + AppE "take_plist" + [] + [PrimAppE SubP + [VarE "n", + LitE 1], + VarE "zs"]])]), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (filter_plist, + FunDef {funName = "filter_plist", + funArgs = [f,a], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a] + BoolTy, + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "a") + [("Nil", + [], + DataConE (MetaTv $29) "Nil" []), + ("Cons", + [(z, MetaTv $31), + (zs, MetaTv $32)], + IfE (AppE "f" [] [VarE "z"]) + (DataConE (MetaTv $30) + "Cons" + [VarE "z", + AppE "filter_plist" + [] + [VarE "f", + VarE "zs"]]) + (AppE "filter_plist" + [] + [VarE "f", + VarE "zs"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length_plist, + FunDef {funName = "length_plist", + funArgs = [a], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + IntTy), + funBody = CaseE (VarE "a") + [("Nil", [], LitE 0), + ("Cons", + [(x, MetaTv $25), + (xs, MetaTv $26)], + PrimAppE AddP + [LitE 1, + AppE "length_plist" + [] + [VarE "xs"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth_plist, + FunDef {funName = "nth_plist", + funArgs = [list,def,index,start], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a], + TyVar u:a,IntTy,IntTy] + (TyVar u:a)), + funBody = CaseE (VarE "list") + [("Nil", [], VarE "def"), + ("Cons", + [(x, MetaTv $22), + (rst, MetaTv $23)], + IfE (PrimAppE EqIntP + [VarE "index", + VarE "start"]) + (VarE "x") + (AppE "nth_plist" + [] + [VarE "rst",VarE "def", + VarE "index", + PrimAppE AddP + [VarE "start", + LitE 1]]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (elem_plist, + FunDef {funName = "elem_plist", + funArgs = [cmp,a,list], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a, + TyVar u:a] + IntTy, + TyVar u:a, + PackedTy "PList" + [TyVar u:a]] + BoolTy), + funBody = CaseE (VarE "list") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(x, MetaTv $16), + (rst, MetaTv $17)], + IfE (PrimAppE EqIntP + [AppE "cmp" + [] + [VarE "x", + VarE "a"], + LitE 0]) + (PrimAppE MkTrue []) + (AppE "elem_plist" + [] + [VarE "cmp",VarE "a", + VarE "rst"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (tail_plist, + FunDef {funName = "tail_plist", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "ls") + [("Cons", + [(wildcard_10, MetaTv $11), + (xs, MetaTv $12)], + VarE "xs")], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (head_plist, + FunDef {funName = "head_plist", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + (TyVar u:a)), + funBody = CaseE (VarE "ls") + [("Cons", + [(x, MetaTv $7), + (wildcard_6, MetaTv $8)], + VarE "x")], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 1 8 22, srcInfoPoints = [SrcSpan ".hs" 8 1 8 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 8 8 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Basics" + (Prog + {ddefs = [(Inline, + DDef {tyName = "Inline", + tyArgs = [], + dataCons = [("Str", [(False, VectorTy CharTy)]), + ("Emph", + [(False, + PackedTy "PList" + [PackedTy "Inline" []])]), + ("Space", [])]}), + (Block, + DDef {tyName = "Block", + tyArgs = [], + dataCons = [("Plain", + [(False, + PackedTy "PList" + [PackedTy "Inline" []])]), + ("Null", [])]}), + (BlogHeader, + DDef {tyName = "BlogHeader", + tyArgs = [], + dataCons = [("Header", [(False, VectorTy CharTy)])]}), + (BlogId, + DDef {tyName = "BlogId", + tyArgs = [], + dataCons = [("ID", [(False, IntTy)])]}), + (BlogAuthor, + DDef {tyName = "BlogAuthor", + tyArgs = [], + dataCons = [("Author", [(False, VectorTy CharTy)])]}), + (BlogDate, + DDef {tyName = "BlogDate", + tyArgs = [], + dataCons = [("Date", [(False, VectorTy CharTy)])]}), + (BlogContent, + DDef {tyName = "BlogContent", + tyArgs = [], + dataCons = [("Content", + [(False, PackedTy "Block" [])])]}), + (BlogTags, + DDef {tyName = "BlogTags", + tyArgs = [], + dataCons = [("TagList", + [(False, + PackedTy "PList" + [VectorTy CharTy])])]}), + (Blog, + DDef {tyName = "Blog", + tyArgs = [], + dataCons = [("End", []), + ("Layout1", + [(False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogTags" []), + (False, PackedTy "Blog" [])]), + ("Layout2", + [(False, PackedTy "BlogContent" []), + (False, PackedTy "BlogTags" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout3", + [(False, PackedTy "BlogTags" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout4", + [(False, PackedTy "BlogTags" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout5", + [(False, PackedTy "Blog" []), + (False, PackedTy "BlogTags" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout6", + [(False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogTags" [])]), + ("Layout7", + [(False, PackedTy "Blog" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogTags" [])]), + ("Layout8", + [(False, PackedTy "BlogContent" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogTags" [])])]})], + fundefs = [(emphasizeKeywordInBlock, + FunDef {funName = "emphasizeKeywordInBlock", + funArgs = [keyword,contentBlock], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Block" []] + (PackedTy "Block" [])), + funBody = CaseE (VarE "contentBlock") + [("Plain", + [(list_inline, MetaTv $91)], + DataConE (MetaTv $90) + "Plain" + [AppE "emphasizeInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]]), + ("Null", + [], + DataConE (MetaTv $92) + "Null" + [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (blogLength, + FunDef {funName = "blogLength", + funArgs = [blog], + funTy = ForAll [] + (ArrowTy [PackedTy "Blog" []] + IntTy), + funBody = CaseE (VarE "blog") + [("End", [], LitE 0), + ("Layout1", + [(a, MetaTv $234), + (b, MetaTv $235), + (c, MetaTv $236), + (d, MetaTv $237), + (e, MetaTv $238), + (f, MetaTv $239), + (rst, MetaTv $240)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout2", + [(a, MetaTv $241), + (b, MetaTv $242), + (rst, MetaTv $243), + (c, MetaTv $244), + (d, MetaTv $245), + (e, MetaTv $246), + (f, MetaTv $247)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout3", + [(a, MetaTv $248), + (rst, MetaTv $249), + (b, MetaTv $250), + (c, MetaTv $251), + (d, MetaTv $252), + (e, MetaTv $253), + (f, MetaTv $254)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout4", + [(a, MetaTv $255), + (b, MetaTv $256), + (rst, MetaTv $257), + (d, MetaTv $258), + (e, MetaTv $259), + (f, MetaTv $260), + (g, MetaTv $261)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout5", + [(rst, MetaTv $262), + (a, MetaTv $263), + (b, MetaTv $264), + (c, MetaTv $265), + (d, MetaTv $266), + (e, MetaTv $267), + (f, MetaTv $268)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout6", + [(a, MetaTv $269), + (b, MetaTv $270), + (c, MetaTv $271), + (d, MetaTv $272), + (e, MetaTv $273), + (rst, MetaTv $274), + (f, MetaTv $275)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout7", + [(rst, MetaTv $276), + (a, MetaTv $277), + (b, MetaTv $278), + (c, MetaTv $279), + (d, MetaTv $280), + (e, MetaTv $281), + (f, MetaTv $282)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout8", + [(a, MetaTv $283), + (rst, MetaTv $284), + (b, MetaTv $285), + (c, MetaTv $286), + (d, MetaTv $287), + (e, MetaTv $288), + (f, MetaTv $289)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (getChar, + FunDef {funName = "getChar", + funArgs = [decimal], + funTy = ForAll [] (ArrowTy [IntTy] CharTy), + funBody = IfE (PrimAppE EqIntP + [VarE "decimal",LitE 0]) + (CharE 'a') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 1]) + (CharE 'b') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 2]) + (CharE 'c') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 3]) + (CharE 'd') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 4]) + (CharE 'e') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 5]) + (CharE 'f') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 6]) + (CharE 'g') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 7]) + (CharE 'h') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 8]) + (CharE 'i') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 9]) + (CharE 'j') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 10]) + (CharE 'k') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 11]) + (CharE 'l') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 12]) + (CharE 'm') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 13]) + (CharE 'n') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 14]) + (CharE 'o') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 15]) + (CharE 'p') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 16]) + (CharE 'q') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 17]) + (CharE 'r') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 18]) + (CharE 's') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 19]) + (CharE 't') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 20]) + (CharE 'u') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 21]) + (CharE 'v') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 22]) + (CharE 'w') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 23]) + (CharE 'x') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 24]) + (CharE 'y') + (CharE 'z'))))))))))))))))))))))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printInline, + FunDef {funName = "printInline", + funArgs = [inline], + funTy = ForAll [] + (ArrowTy [PackedTy "Inline" []] + (ProdTy [])), + funBody = CaseE (VarE "inline") + [("Str", + [(text, MetaTv $394)], + LetE (wildcard_392, + [], + MetaTv $393, + PrimAppE PrintSym + [LitSymE "Str "]) + (LetE (wildcard_390, + [], + MetaTv $391, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $389)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "text"]) + (MkProdE []))), + ("Emph", + [(plist, MetaTv $399)], + LetE (wildcard_397, + [], + MetaTv $398, + PrimAppE PrintSym + [LitSymE "Emph "]) + (LetE (wildcard_395, + [], + MetaTv $396, + AppE "printPlistInline" + [] + [VarE "plist"]) + (MkProdE []))), + ("Space", + [], + LetE (wildcard_400, + [], + MetaTv $401, + PrimAppE PrintSym + [LitSymE "Space "]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printPlistText, + FunDef {funName = "printPlistText", + funArgs = [list], + funTy = ForAll [] + (ArrowTy [PackedTy "PList" + [VectorTy CharTy]] + (ProdTy [])), + funBody = CaseE (VarE "list") + [("Cons", + [(x, MetaTv $384), + (rst, MetaTv $385)], + LetE (wildcard_382, + [], + MetaTv $383, + PrimAppE PrintSym + [LitSymE "PList ( Cons "]) + (LetE (wildcard_380, + [], + MetaTv $381, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $379)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "x"]) + (LetE (wildcard_377, + [], + MetaTv $378, + AppE "printPlistText" + [] + [VarE "rst"]) + (LetE (wildcard_375, + [], + MetaTv $376, + PrimAppE PrintSym + [LitSymE " ) "]) + (MkProdE []))))), + ("Nil", + [], + LetE (wildcard_386, + [], + MetaTv $387, + PrimAppE PrintSym + [LitSymE "Nil"]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printPlistInline, + FunDef {funName = "printPlistInline", + funArgs = [list], + funTy = ForAll [] + (ArrowTy [PackedTy "PList" + [PackedTy "Inline" + []]] + (ProdTy [])), + funBody = CaseE (VarE "list") + [("Cons", + [(x, MetaTv $370), + (rst, MetaTv $371)], + LetE (wildcard_368, + [], + MetaTv $369, + PrimAppE PrintSym + [LitSymE "PList ( Cons "]) + (LetE (wildcard_366, + [], + MetaTv $367, + AppE "printInline" + [] + [VarE "x"]) + (LetE (wildcard_364, + [], + MetaTv $365, + AppE "printPlistInline" + [] + [VarE "rst"]) + (LetE (wildcard_362, + [], + MetaTv $363, + PrimAppE PrintSym + [LitSymE " ) "]) + (MkProdE []))))), + ("Nil", + [], + LetE (wildcard_372, + [], + MetaTv $373, + PrimAppE PrintSym + [LitSymE "Nil"]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printBlock, + FunDef {funName = "printBlock", + funArgs = [block], + funTy = ForAll [] + (ArrowTy [PackedTy "Block" []] + (ProdTy [])), + funBody = CaseE (VarE "block") + [("Plain", + [(plist, MetaTv $358)], + LetE (wildcard_356, + [], + MetaTv $357, + PrimAppE PrintSym + [LitSymE "Plain "]) + (LetE (wildcard_354, + [], + MetaTv $355, + AppE "printPlistInline" + [] + [VarE "plist"]) + (MkProdE []))), + ("Null", + [], + LetE (wildcard_359, + [], + MetaTv $360, + PrimAppE PrintSym + [LitSymE "Null"]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printBlog, + FunDef {funName = "printBlog", + funArgs = [blog], + funTy = ForAll [] + (ArrowTy [PackedTy "Blog" []] + (ProdTy [])), + funBody = CaseE (VarE "blog") + [("Layout1", + [(header, MetaTv $346), + (id, MetaTv $347), + (author, MetaTv $348), + (date, MetaTv $349), + (content, MetaTv $350), + (tags, MetaTv $351), + (rst, MetaTv $352)], + LetE (wildcard_344, + [], + MetaTv $345, + PrimAppE PrintSym + [LitSymE "Layout1 "]) + (LetE (wildcard_342, + [], + MetaTv $343, + AppE "printHeader" + [] + [VarE "header"]) + (LetE (wildcard_340, + [], + MetaTv $341, + AppE "printID" + [] + [VarE "id"]) + (LetE (wildcard_338, + [], + MetaTv $339, + AppE "printAuthor" + [] + [VarE "author"]) + (LetE (wildcard_336, + [], + MetaTv $337, + AppE "printDate" + [] + [VarE "date"]) + (LetE (wildcard_334, + [], + MetaTv $335, + AppE "printContent" + [] + [VarE "content"]) + (LetE (wildcard_332, + [], + MetaTv $333, + AppE "printTagList" + [] + [VarE "tags"]) + (LetE (wildcard_330, + [], + MetaTv $331, + AppE "printBlog" + [] + [VarE "rst"]) + (MkProdE [])))))))))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printID, + FunDef {funName = "printID", + funArgs = [id], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogId" []] + (ProdTy [])), + funBody = CaseE (VarE "id") + [("ID", + [(val, MetaTv $328)], + LetE (wildcard_326, + [], + MetaTv $327, + PrimAppE PrintSym + [LitSymE "ID "]) + (LetE (wildcard_324, + [], + MetaTv $325, + PrimAppE PrintInt + [VarE "val"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printHeader, + FunDef {funName = "printHeader", + funArgs = [header], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogHeader" []] + (ProdTy [])), + funBody = CaseE (VarE "header") + [("Header", + [(str, MetaTv $322)], + LetE (wildcard_320, + [], + MetaTv $321, + PrimAppE PrintSym + [LitSymE "Header "]) + (LetE (wildcard_318, + [], + MetaTv $319, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $317)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "str"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printAuthor, + FunDef {funName = "printAuthor", + funArgs = [date], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogAuthor" []] + (ProdTy [])), + funBody = CaseE (VarE "date") + [("Author", + [(str, MetaTv $315)], + LetE (wildcard_313, + [], + MetaTv $314, + PrimAppE PrintSym + [LitSymE "Author "]) + (LetE (wildcard_311, + [], + MetaTv $312, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $310)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "str"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printDate, + FunDef {funName = "printDate", + funArgs = [date], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogDate" []] + (ProdTy [])), + funBody = CaseE (VarE "date") + [("Date", + [(str, MetaTv $308)], + LetE (wildcard_306, + [], + MetaTv $307, + PrimAppE PrintSym + [LitSymE "Date "]) + (LetE (wildcard_304, + [], + MetaTv $305, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $303)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "str"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printTagList, + FunDef {funName = "printTagList", + funArgs = [tags], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogTags" []] + (ProdTy [])), + funBody = CaseE (VarE "tags") + [("TagList", + [(plist, MetaTv $301)], + LetE (wildcard_299, + [], + MetaTv $300, + PrimAppE PrintSym + [LitSymE "TagList "]) + (LetE (wildcard_297, + [], + MetaTv $298, + AppE "printPlistText" + [] + [VarE "plist"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printContent, + FunDef {funName = "printContent", + funArgs = [content], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogContent" []] + (ProdTy [])), + funBody = CaseE (VarE "content") + [("Content", + [(block, MetaTv $295)], + LetE (wildcard_293, + [], + MetaTv $294, + PrimAppE PrintSym + [LitSymE "Content "]) + (LetE (wildcard_291, + [], + MetaTv $292, + AppE "printBlock" + [] + [VarE "block"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlockList, + FunDef {funName = "mkBlockList", + funArgs = [length,base], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy] + (PackedTy "PList" + [PackedTy "Block" + []])), + funBody = IfE (PrimAppE LtEqP + [VarE "length",LitE 0]) + (DataConE (MetaTv $224) "Nil" []) + (IfE (PrimAppE EqIntP + [VarE "base",LitE 0]) + (LetE (item, + [], + MetaTv $228, + DataConE (MetaTv $227) + "Plain" + [AppE "mkInlineList" + [] + [LitE 1000, + LitE 1]]) + (LetE (rst, + [], + MetaTv $226, + AppE "mkBlockList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $225) + "Cons" + [VarE "item", + VarE "rst"]))) + (LetE (item, + [], + MetaTv $232, + DataConE (MetaTv $231) + "Null" + []) + (LetE (rst, + [], + MetaTv $230, + AppE "mkBlockList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $229) + "Cons" + [VarE "item", + VarE "rst"])))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkSomeTags, + FunDef {funName = "mkSomeTags", + funArgs = [len], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = IfE (PrimAppE LtEqP [VarE "len",LitE 0]) + (DataConE (MetaTv $217) "Nil" []) + (LetE (word, + [], + MetaTv $221, + LetE (vec220, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec220", + LitE 0, + CharE 'a']) + (VarE "vec220"))) + (LetE (rst, + [], + MetaTv $219, + AppE "mkSomeTags" + [] + [PrimAppE SubP + [VarE "len", + LitE 1]]) + (DataConE (MetaTv $218) + "Cons" + [VarE "word", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkRandomInlineList, + FunDef {funName = "mkRandomInlineList", + funArgs = [len], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = IfE (PrimAppE LtEqP [VarE "len",LitE 0]) + (DataConE (MetaTv $211) "Nil" []) + (LetE (word, + [], + MetaTv $215, + DataConE (MetaTv $214) + "Str" + [AppE "getRandomString" + [] + [LitE 1]]) + (LetE (rst, + [], + MetaTv $213, + AppE "mkRandomInlineList" + [] + [PrimAppE SubP + [VarE "len", + LitE 1]]) + (DataConE (MetaTv $212) + "Cons" + [VarE "word", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkInlineList', + FunDef {funName = "mkInlineList'", + funArgs = [length,index,words], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy, + VectorTy (VectorTy CharTy)] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "length"]) + (DataConE (MetaTv $205) "Nil" []) + (LetE (item, + [], + MetaTv $209, + DataConE (MetaTv $208) + "Str" + [AppE "nth" + [] + [VarE "words", + VarE "index"]]) + (LetE (rst, + [], + MetaTv $207, + AppE "mkInlineList'" + [] + [VarE "length", + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "words"]) + (DataConE (MetaTv $206) + "Cons" + [VarE "item", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkInlineList, + FunDef {funName = "mkInlineList", + funArgs = [length,base], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = IfE (PrimAppE LtEqP + [VarE "length",LitE 0]) + (DataConE (MetaTv $194) "Nil" []) + (IfE (PrimAppE EqIntP + [VarE "base",LitE 0]) + (LetE (item, + [], + MetaTv $198, + DataConE (MetaTv $197) + "Emph" + [AppE "mkInlineList" + [] + [LitE 100, + LitE 1]]) + (LetE (rst, + [], + MetaTv $196, + AppE "mkInlineList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $195) + "Cons" + [VarE "item", + VarE "rst"]))) + (LetE (item, + [], + MetaTv $201, + AppE "mkInlineBaseCase" + [] + [PrimAppE ModP + [PrimAppE RandP + [], + LitE 4]]) + (LetE (rst, + [], + MetaTv $200, + AppE "mkInlineList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $199) + "Cons" + [VarE "item", + VarE "rst"])))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkInlineBaseCase, + FunDef {funName = "mkInlineBaseCase", + funArgs = [option], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "Inline" [])), + funBody = IfE (PrimAppE EqIntP + [VarE "option",LitE 0]) + (DataConE (MetaTv $190) + "Str" + [AppE "getRandomString" + [] + [LitE 5]]) + (DataConE (MetaTv $191) "Space" []), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkContentFromText, + FunDef {funName = "mkContentFromText", + funArgs = [f], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogContent" + [])), + funBody = LetE (block, + [], + MetaTv $188, + AppE "fileToContent" + [] + [VarE "f", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "f", + LitE 0]], + DataConE (MetaTv $186) + "Nil" + [], + LitE 1, + PrimAppE (VLengthP (MetaTv $187)) + [VarE "f"]]) + (LetE (content, + [], + MetaTv $185, + AppE "mkBlogContent" + [] + [VarE "block"]) + (VarE "content")), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkTagsFromText, + FunDef {funName = "mkTagsFromText", + funArgs = [f'], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogTags" [])), + funBody = LetE (tags, + [], + MetaTv $183, + AppE "fileToTags" + [] + [VarE "f'", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "f'", + LitE 0]], + LitE 1, + PrimAppE (VLengthP (MetaTv $182)) + [VarE "f'"]]) + (LetE (tags', + [], + MetaTv $181, + DataConE (MetaTv $180) + "TagList" + [VarE "tags"]) + (VarE "tags'")), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (fileToTags, + FunDef {funName = "fileToTags", + funArgs = [file,word,index,max_len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy,IntTy, + IntTy] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "max_len"]) + (DataConE (MetaTv $174) "Nil" []) + (LetE (character, + [], + CharTy, + AppE "nth" + [] + [VarE "file", + VarE "index"]) + (LetE (isSpace, + [], + MetaTv $178, + IfE (PrimAppE EqCharP + [VarE "character", + AppE "head" + [] + [LetE (vec177, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec177", + LitE 0, + CharE ' ']) + (VarE "vec177"))]]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse + [])) + (LetE (char_vec, + [], + MetaTv $176, + AppE "singleton" + [] + [VarE "character"]) + (IfE (VarE "isSpace") + (DataConE (MetaTv $175) + "Cons" + [VarE "word", + AppE "fileToTags" + [] + [VarE "file", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "file", + PrimAppE AddP + [VarE "index", + LitE 1]]], + PrimAppE AddP + [VarE "index", + LitE 2], + VarE "max_len"]]) + (AppE "fileToTags" + [] + [VarE "file", + AppE "append" + [] + [VarE "word", + VarE "char_vec"], + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "max_len"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printWordList, + FunDef {funName = "printWordList", + funArgs = [vec,start,end], + funTy = ForAll [] + (ArrowTy [VectorTy (VectorTy CharTy), + IntTy,IntTy] + (ProdTy [])), + funBody = IfE (PrimAppE LtP + [VarE "start",VarE "end"]) + (LetE (element, + [], + MetaTv $169, + AppE "nth" + [] + [VarE "vec", + VarE "start"]) + (LetE (wildcard_167, + [], + MetaTv $168, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $166)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "element"]) + (AppE "printWordList" + [] + [VarE "vec", + PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end"]))) + (MkProdE []), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (fileToContent', + FunDef {funName = "fileToContent'", + funArgs = [file,word,running_list,index,max_len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + VectorTy (VectorTy CharTy), + IntTy,IntTy] + (VectorTy (VectorTy CharTy))), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "max_len"]) + (AppE "append" + [] + [VarE "running_list", + PrimAppE (VAllocP (MetaTv $158)) + [LitE 0]]) + (LetE (character, + [], + CharTy, + AppE "nth" + [] + [VarE "file", + VarE "index"]) + (LetE (isSpace, + [], + MetaTv $162, + IfE (PrimAppE EqCharP + [VarE "character", + AppE "head" + [] + [LetE (vec161, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec161", + LitE 0, + CharE ' ']) + (VarE "vec161"))]]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse + [])) + (LetE (char_vec, + [], + MetaTv $160, + AppE "singleton" + [] + [VarE "character"]) + (IfE (VarE "isSpace") + (AppE "fileToContent'" + [] + [VarE "file", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "file", + PrimAppE AddP + [VarE "index", + LitE 1]]], + AppE "append" + [] + [VarE "running_list", + AppE "generate" + [] + [LitE 1, + Ext (LambdaE [(i, + MetaTv $159)] + (VarE "word"))]], + PrimAppE AddP + [VarE "index", + LitE 2], + VarE "max_len"]) + (AppE "fileToContent'" + [] + [VarE "file", + AppE "append" + [] + [VarE "word", + VarE "char_vec"], + VarE "running_list", + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "max_len"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (fileToContent, + FunDef {funName = "fileToContent", + funArgs = [file,word,plist_inline,index,max_len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + PackedTy "PList" + [PackedTy "Inline" + []], + IntTy,IntTy] + (PackedTy "Block" [])), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "max_len"]) + (DataConE (MetaTv $147) + "Plain" + [VarE "plist_inline"]) + (LetE (character, + [], + CharTy, + AppE "nth" + [] + [VarE "file", + VarE "index"]) + (LetE (isSpace, + [], + MetaTv $152, + IfE (PrimAppE EqCharP + [VarE "character", + AppE "head" + [] + [LetE (vec151, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec151", + LitE 0, + CharE ' ']) + (VarE "vec151"))]]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse + [])) + (LetE (char_vec, + [], + MetaTv $150, + AppE "singleton" + [] + [VarE "character"]) + (IfE (VarE "isSpace") + (AppE "fileToContent" + [] + [VarE "file", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "file", + PrimAppE AddP + [VarE "index", + LitE 1]]], + DataConE (MetaTv $148) + "Cons" + [DataConE (MetaTv $149) + "Str" + [VarE "word"], + VarE "plist_inline"], + PrimAppE AddP + [VarE "index", + LitE 2], + VarE "max_len"]) + (AppE "fileToContent" + [] + [VarE "file", + AppE "append" + [] + [VarE "word", + VarE "char_vec"], + VarE "plist_inline", + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "max_len"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchBlogContent, + FunDef {funName = "searchBlogContent", + funArgs = [keyword,content], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogContent" []] + BoolTy), + funBody = CaseE (VarE "content") + [("Content", + [(block, MetaTv $141)], + AppE "isKeywordPresentInBlock" + [] + [VarE "keyword", + VarE "block"])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeBlogContent, + FunDef {funName = "emphasizeBlogContent", + funArgs = [keyword,oldContent], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogContent" []] + (PackedTy "BlogContent" + [])), + funBody = CaseE (VarE "oldContent") + [("Content", + [(block, MetaTv $138)], + DataConE (MetaTv $137) + "Content" + [AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeBlogContent', + FunDef {funName = "emphasizeBlogContent'", + funArgs = [keyword,oldContent], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogContent" []] + (PackedTy "BlogContent" + [])), + funBody = CaseE (VarE "oldContent") + [("Content", + [(block, MetaTv $134)], + DataConE (MetaTv $133) + "Content" + [AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (insertBlogTags, + FunDef {funName = "insertBlogTags", + funArgs = [keyword,tags], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogTags" []] + (PackedTy "BlogTags" [])), + funBody = CaseE (VarE "tags") + [("TagList", + [(list, MetaTv $130)], + DataConE (MetaTv $129) + "TagList" + [AppE "insertTagList" + [] + [VarE "keyword", + VarE "list"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (deleteBlogTags, + FunDef {funName = "deleteBlogTags", + funArgs = [keyword,tags], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogTags" []] + (PackedTy "BlogTags" [])), + funBody = CaseE (VarE "tags") + [("TagList", + [(list, MetaTv $126)], + DataConE (MetaTv $125) + "TagList" + [AppE "deleteTagList" + [] + [VarE "keyword", + VarE "list"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchBlogTags, + FunDef {funName = "searchBlogTags", + funArgs = [keyword,tags], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogTags" []] + BoolTy), + funBody = CaseE (VarE "tags") + [("TagList", + [(list, MetaTv $122)], + AppE "searchTagList" + [] + [VarE "keyword", + VarE "list"])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeKeywordInBlockList, + FunDef {funName = "emphasizeKeywordInBlockList", + funArgs = [keyword,block_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Block" + []]] + (PackedTy "PList" + [PackedTy "Block" + []])), + funBody = CaseE (VarE "block_list") + [("Nil", + [], + DataConE (MetaTv $114) "Nil" []), + ("Cons", + [(block, MetaTv $118), + (rst, MetaTv $119)], + LetE (newBlock, + [], + MetaTv $117, + AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]) + (LetE (rst', + [], + MetaTv $116, + AppE "emphasizeKeywordInBlockList" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $115) + "Cons" + [VarE "newBlock", + VarE "rst'"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeInlineListForKeyword, + FunDef {funName = "emphasizeInlineListForKeyword", + funArgs = [keyword,inline_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Inline" + []]] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = CaseE (VarE "inline_list") + [("Nil", + [], + DataConE (MetaTv $106) "Nil" []), + ("Cons", + [(inline, MetaTv $110), + (rst, MetaTv $111)], + LetE (newinline, + [], + MetaTv $109, + AppE "emphasizeKeywordInline" + [] + [VarE "keyword", + VarE "inline"]) + (LetE (rst', + [], + MetaTv $108, + AppE "emphasizeInlineListForKeyword" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $107) + "Cons" + [VarE "newinline", + VarE "rst'"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeKeywordInline, + FunDef {funName = "emphasizeKeywordInline", + funArgs = [keyword,inline], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Inline" []] + (PackedTy "Inline" [])), + funBody = CaseE (VarE "inline") + [("Str", + [(text, MetaTv $100)], + LetE (isSame, + [], + MetaTv $99, + AppE "compareWord" + [] + [VarE "keyword", + VarE "text"]) + (IfE (VarE "isSame") + (LetE (newlist, + [], + PackedTy "PList" + [PackedTy "Inline" + []], + DataConE (MetaTv $96) + "Cons" + [Ext (CopyPacked (MetaTv $97) + (VarE "inline")), + DataConE (MetaTv $98) + "Nil" + []]) + (DataConE (MetaTv $95) + "Emph" + [VarE "newlist"])) + (VarE "inline"))), + ("Emph", + [(list_inline, MetaTv $102)], + DataConE (MetaTv $101) + "Emph" + [AppE "emphasizeInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]]), + ("Space", + [], + DataConE (MetaTv $103) + "Space" + [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchInlineListForKeyword, + FunDef {funName = "searchInlineListForKeyword", + funArgs = [keyword,inline_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Inline" + []]] + BoolTy), + funBody = CaseE (VarE "inline_list") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(inline, MetaTv $86), + (rst, MetaTv $87)], + PrimAppE OrP + [AppE "isKeywordPresentInline" + [] + [VarE "keyword", + VarE "inline"], + AppE "searchInlineListForKeyword" + [] + [VarE "keyword", + VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchBlockListForKeyword, + FunDef {funName = "searchBlockListForKeyword", + funArgs = [keyword,block_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Block" + []]] + BoolTy), + funBody = CaseE (VarE "block_list") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(block, MetaTv $82), + (rst, MetaTv $83)], + PrimAppE OrP + [AppE "isKeywordPresentInBlock" + [] + [VarE "keyword", + VarE "block"], + AppE "searchBlockListForKeyword" + [] + [VarE "keyword", + VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (isKeywordPresentInline, + FunDef {funName = "isKeywordPresentInline", + funArgs = [keyword,inline], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Inline" []] + BoolTy), + funBody = CaseE (VarE "inline") + [("Str", + [(text, MetaTv $78)], + AppE "compareWord" + [] + [VarE "keyword", + VarE "text"]), + ("Emph", + [(list_inline, MetaTv $79)], + AppE "searchInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]), + ("Space", + [], + PrimAppE MkFalse [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (isKeywordPresentInBlock, + FunDef {funName = "isKeywordPresentInBlock", + funArgs = [keyword,contentBlock], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Block" []] + BoolTy), + funBody = CaseE (VarE "contentBlock") + [("Plain", + [(list_inline, MetaTv $75)], + AppE "searchInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]), + ("Null", + [], + PrimAppE MkFalse [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (insertTagList, + FunDef {funName = "insertTagList", + funArgs = [keyword,taglist], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [VectorTy CharTy]] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = CaseE (VarE "taglist") + [("Nil", + [], + DataConE (MetaTv $69) + "Cons" + [VarE "keyword", + DataConE (MetaTv $70) + "Nil" + []]), + ("Cons", + [(word, MetaTv $71), + (rst, MetaTv $72)], + AppE "insertTagList" + [] + [VarE "keyword", + VarE "rst"])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (deleteTagList, + FunDef {funName = "deleteTagList", + funArgs = [keyword,taglist], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [VectorTy CharTy]] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = CaseE (VarE "taglist") + [("Nil", + [], + DataConE (MetaTv $63) "Nil" []), + ("Cons", + [(word, MetaTv $65), + (rst, MetaTv $66)], + IfE (AppE "compareWord" + [] + [VarE "keyword", + VarE "word"]) + (AppE "deleteTagList" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $64) + "Cons" + [VarE "word", + AppE "deleteTagList" + [] + [VarE "keyword", + VarE "rst"]]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchTagList, + FunDef {funName = "searchTagList", + funArgs = [keyword,taglist], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [VectorTy CharTy]] + BoolTy), + funBody = CaseE (VarE "taglist") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(word, MetaTv $59), + (rst, MetaTv $60)], + PrimAppE OrP + [AppE "compareWord" + [] + [VarE "keyword", + VarE "word"], + AppE "searchTagList" + [] + [VarE "keyword", + VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (cmp, + FunDef {funName = "cmp", + funArgs = [start,end,word1,word2], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy, + VectorTy CharTy, + VectorTy CharTy] + BoolTy), + funBody = IfE (PrimAppE LtP + [VarE "start",VarE "end"]) + (LetE (a, + [], + MetaTv $56, + AppE "nth" + [] + [VarE "word1", + VarE "start"]) + (LetE (b, + [], + MetaTv $55, + AppE "nth" + [] + [VarE "word2", + VarE "start"]) + (LetE (eq, + [], + MetaTv $54, + IfE (PrimAppE EqCharP + [VarE "a", + VarE "b"]) + (PrimAppE MkTrue + []) + (PrimAppE MkFalse + [])) + (LetE (recurse, + [], + MetaTv $53, + AppE "cmp" + [] + [PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end", + VarE "word1", + VarE "word2"]) + (PrimAppE AndP + [VarE "eq", + VarE "recurse"]))))) + (PrimAppE MkTrue []), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (compareWord, + FunDef {funName = "compareWord", + funArgs = [word1,word2], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy] + BoolTy), + funBody = LetE (len1, + [], + MetaTv $48, + AppE "length" [] [VarE "word1"]) + (LetE (len2, + [], + MetaTv $47, + AppE "length" + [] + [VarE "word2"]) + (LetE (compare_len, + [], + MetaTv $46, + IfE (PrimAppE EqIntP + [VarE "len1", + VarE "len2"]) + (PrimAppE MkTrue + []) + (PrimAppE MkFalse + [])) + (IfE (VarE "compare_len") + (AppE "cmp" + [] + [LitE 0, + VarE "len1", + VarE "word1", + VarE "word2"]) + (PrimAppE MkFalse + [])))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (checkBlogID, + FunDef {funName = "checkBlogID", + funArgs = [id,val], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogId" [], + IntTy] + BoolTy), + funBody = CaseE (VarE "id") + [("ID", + [(x, MetaTv $43)], + IfE (PrimAppE EqIntP + [VarE "x", + VarE "val"]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkListFiles, + FunDef {funName = "mkListFiles", + funArgs = [f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy,IntTy] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = IfE (PrimAppE LtP [VarE "len",LitE 0]) + (DataConE (MetaTv $37) "Nil" []) + (LetE (f, + [], + MetaTv $40, + AppE "getFile" + [] + [VarE "f1",VarE "f2", + VarE "f3",VarE "f4", + VarE "f5",VarE "f6", + VarE "f7",VarE "f8", + VarE "f9",VarE "f10", + VarE "len"]) + (LetE (rst, + [], + MetaTv $39, + AppE "mkListFiles" + [] + [VarE "f1", + VarE "f2", + VarE "f3", + VarE "f4", + VarE "f5", + VarE "f6", + VarE "f7", + VarE "f8", + VarE "f9", + VarE "f10", + PrimAppE SubP + [VarE "len", + LitE 1]]) + (DataConE (MetaTv $38) + "Cons" + [VarE "f", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (getFile, + FunDef {funName = "getFile", + funArgs = [f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,select], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy,IntTy] + (VectorTy CharTy)), + funBody = IfE (PrimAppE EqIntP + [VarE "select",LitE 0]) + (VarE "f1") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 1]) + (VarE "f2") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 2]) + (VarE "f3") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 3]) + (VarE "f4") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 4]) + (VarE "f5") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 5]) + (VarE "f6") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 6]) + (VarE "f7") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 7]) + (VarE "f8") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 8]) + (VarE "f9") + (VarE "f10"))))))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogTags, + FunDef {funName = "mkBlogTags", + funArgs = [taglist], + funTy = ForAll [] + (ArrowTy [PackedTy "PList" + [VectorTy CharTy]] + (PackedTy "BlogTags" [])), + funBody = DataConE (MetaTv $14) + "TagList" + [VarE "taglist"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogContent, + FunDef {funName = "mkBlogContent", + funArgs = [block], + funTy = ForAll [] + (ArrowTy [PackedTy "Block" []] + (PackedTy "BlogContent" + [])), + funBody = DataConE (MetaTv $12) + "Content" + [VarE "block"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogDate, + FunDef {funName = "mkBlogDate", + funArgs = [text], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogDate" [])), + funBody = DataConE (MetaTv $10) + "Date" + [VarE "text"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogAuthor, + FunDef {funName = "mkBlogAuthor", + funArgs = [text], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogAuthor" + [])), + funBody = DataConE (MetaTv $8) + "Author" + [VarE "text"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogID, + FunDef {funName = "mkBlogID", + funArgs = [val], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "BlogId" [])), + funBody = DataConE (MetaTv $6) "ID" [VarE "val"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogHeader, + FunDef {funName = "mkBlogHeader", + funArgs = [text], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogHeader" + [])), + funBody = DataConE (MetaTv $4) + "Header" + [VarE "text"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (getRandomString, + FunDef {funName = "getRandomString", + funArgs = [length], + funTy = ForAll [] + (ArrowTy [IntTy] (VectorTy CharTy)), + funBody = AppE "generate" + [] + [VarE "length",VarE "mkChar"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkChar, + FunDef {funName = "mkChar", + funArgs = [val], + funTy = ForAll [] (ArrowTy [IntTy] CharTy), + funBody = AppE "getChar" + [] + [PrimAppE ModP + [PrimAppE RandP [], + LitE 26]], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 1 4 22, srcInfoPoints = [SrcSpan ".hs" 4 1 4 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 8 4 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, + ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 1 5 20, srcInfoPoints = [SrcSpan ".hs" 5 1 5 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 8 5 20, srcInfoPoints = []}) "Gibbon.PList", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, + ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 1 6 21, srcInfoPoints = [SrcSpan ".hs" 6 1 6 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 8 6 21, srcInfoPoints = []}) "Gibbon.Vector", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}]] + (ProgModule "Main" + (Prog + {ddefs = [], + fundefs = [(emphKeywordInContent, + FunDef {funName = "emphKeywordInContent", + funArgs = [keyword,blogs], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Blog" []] + (PackedTy "Blog" [])), + funBody = CaseE (VarE "blogs") + [("End", + [], + DataConE (MetaTv $2) "End" []), + ("Layout1", + [(header, MetaTv $8), + (id, MetaTv $9), + (author, MetaTv $10), + (date, MetaTv $11), + (content, MetaTv $12), + (tags, MetaTv $13), + (rst, MetaTv $14)], + LetE (newContent, + [], + MetaTv $7, + CaseE (VarE "content") + [("Content", + [(block, + MetaTv $6)], + DataConE (MetaTv $5) + "Content" + [AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]])]) + (LetE (newRst, + [], + MetaTv $4, + AppE "emphKeywordInContent" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $3) + "Layout1" + [VarE "header", + VarE "id", + VarE "author", + VarE "date", + VarE "newContent", + VarE "tags", + VarE "newRst"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (LetE (blogs, + [], + MetaTv $17, + AppE "mkBlogs_layout1" [] [LitE 1000]) + (LetE (keyword, + [], + VectorTy CharTy, + LetE (vec16, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec16",LitE 0, + CharE 'a']) + (VarE "vec16"))) + (LetE (newblgs, + [], + MetaTv $15, + AppE "emphKeywordInContent" + [] + [VarE "keyword",VarE "blogs"]) + (PrimAppE EqIntP + [AppE "blogLength" + [] + [VarE "newblgs"], + LitE 1000]))), + MetaTv $18)}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 14, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Basics", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, + ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 1 3 23, srcInfoPoints = [SrcSpan ".hs" 3 1 3 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 8 3 23, srcInfoPoints = []}) "GenerateLayout1", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}]) +gibbon: PackedTy doesn't match PackedTy "PList91" [PackedTy "Block150" []] with PackedTy "Block150" [] +CallStack (from HasCallStack): + error, called at src/Gibbon/L0/Typecheck.hs:884:24 in gibbon-0.3-inplace:Gibbon.L0.Typecheck diff --git a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs index a01d21fb5..ffe96a369 100644 --- a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs +++ b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs @@ -18,4 +18,5 @@ gibbon_main = keyword :: Vector Char keyword = "a" newblgs = emphKeywordInContent keyword blogs - in printPacked newblgs + --in printPacked newblgs + in printBlog newblgs diff --git a/gibbon-compiler/examples/layout_bench/manyFuncsGlobal.ans b/gibbon-compiler/examples/layout_bench/manyFuncsGlobal.ans index 338363cd1..d55b6449f 100644 --- a/gibbon-compiler/examples/layout_bench/manyFuncsGlobal.ans +++ b/gibbon-compiler/examples/layout_bench/manyFuncsGlobal.ans @@ -1 +1 @@ -(Layout4 ->i ->i ->i (TagList (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Nil_v_1132)))))))))))) ->i (Content (Plain (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) ->r (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))))))))))))))))))))))))))))))))))))))))))))))))))))) (Layout4 ->i ->i ->i (TagList (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Nil_v_1132)))))))))))) ->i (Content (Plain (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))))))))))))))))))))))))))))))))))))))))))))))))))))) (End) ->i ->i ->i (Header Vector) ->i ->i ->i (ID 9) ->i ->i ->i (Author Vector) ->i ->i ->i (Date Vector)) ->i ->i ->i (Header Vector) ->i ->i ->i (ID 8) ->i ->i ->i (Author Vector) ->i ->i ->i (Date Vector))'#() +(Layout4198 ->i ->i ->i (TagList203 (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Nil128_v1293)))))))))))) ->i (Content204 (Plain209 (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 (Emph212 (Cons129_v1292 (Emph212 (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))) (Nil128_v1292))) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) ->r (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 (Emph212 (Cons129_v1292 (Emph212 (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))) (Nil128_v1292))) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))))))))))))))))))))))))))))))))))))))))))))))))))))) (Layout4198 ->i ->i ->i (TagList203 (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Nil128_v1293)))))))))))) ->i (Content204 (Plain209 (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 (Emph212 (Cons129_v1292 (Emph212 (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))) (Nil128_v1292))) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))))))))))))))))))))))))))))))))))))))))))))))))))))) (End194) ->i ->i ->i (Header208 Vector) ->i ->i ->i (ID207 9) ->i ->i ->i (Author206 Vector) ->i ->i ->i (Date205 Vector)) ->i ->i ->i (Header208 Vector) ->i ->i ->i (ID207 8) ->i ->i ->i (Author206 Vector) ->i ->i ->i (Date205 Vector))'#() \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_bench/manyFuncsLocal.ans b/gibbon-compiler/examples/layout_bench/manyFuncsLocal.ans index cabe0b9cd..ca249f4fe 100644 --- a/gibbon-compiler/examples/layout_bench/manyFuncsLocal.ans +++ b/gibbon-compiler/examples/layout_bench/manyFuncsLocal.ans @@ -1 +1 @@ -(Layout4 ->i ->i ->i (TagList (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Nil_v_1132)))))))))))) ->i (Content (Plain (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))))))))))))))))))))))))))))))))))))))))))))))))))))) (Layout4 ->i ->i ->i (TagList (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Nil_v_1132)))))))))))) ->i (Content (Plain (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) ->r (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))))))))))))))))))))))))))))))))))))))))))))))))))))) (End) ->i ->i ->i (Header Vector) ->i ->i ->i (ID 9) ->i ->i ->i (Author Vector) ->i ->i ->i (Date Vector)) ->i ->i ->i (Header Vector) ->i ->i ->i (ID 8) ->i ->i ->i (Author Vector) ->i ->i ->i (Date Vector))'#() +(Layout4198 ->i ->i ->i (TagList203 (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Nil128_v1293)))))))))))) ->i (Content204 (Plain209 (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 (Emph212 (Cons129_v1292 (Emph212 (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))) (Nil128_v1292))) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))))))))))))))))))))))))))))))))))))))))))))))))))))) (Layout4198 ->i ->i ->i (TagList203 (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Cons129_v1293 Vector (Nil128_v1293)))))))))))) ->i (Content204 (Plain209 (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 (Emph212 (Cons129_v1292 (Emph212 (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))) (Nil128_v1292))) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) ->r (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 (Emph212 (Cons129_v1292 (Emph212 (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))) (Nil128_v1292))) (Cons129_v1292 ->i (Str211 Vector) (Cons129_v1292 ->i (Str211 Vector) (Nil128_v1292))))))))))))))))))))))))))))))))))))))))))))))))))))) (End194) ->i ->i ->i (Header208 Vector) ->i ->i ->i (ID207 9) ->i ->i ->i (Author206 Vector) ->i ->i ->i (Date205 Vector)) ->i ->i ->i (Header208 Vector) ->i ->i ->i (ID207 8) ->i ->i ->i (Author206 Vector) ->i ->i ->i (Date205 Vector))'#() \ No newline at end of file diff --git a/gibbon-compiler/examples/layout_bench/manyFuncsLocal2.ans b/gibbon-compiler/examples/layout_bench/manyFuncsLocal2.ans new file mode 100644 index 000000000..02c81e513 --- /dev/null +++ b/gibbon-compiler/examples/layout_bench/manyFuncsLocal2.ans @@ -0,0 +1 @@ +(Layout4 ->i ->i ->i (TagList (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Nil_v_1132)))))))))))) ->i (Content (Plain (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) ->r (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))))))))))))))))))))))))))))))))))))))))))))))))))))) (Layout4 ->i ->i ->i (TagList (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Cons_v_1132 Vector (Nil_v_1132)))))))))))) ->i (Content (Plain (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 (Emph (Cons_v_1131 (Emph (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))) (Nil_v_1131))) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Cons_v_1131 ->i (Str Vector) (Nil_v_1131))))))))))))))))))))))))))))))))))))))))))))))))))))) (End) ->i ->i ->i (Header Vector) ->i ->i ->i (ID 9) ->i ->i ->i (Author Vector) ->i ->i ->i (Date Vector)) ->i ->i ->i (Header Vector) ->i ->i ->i (ID 8) ->i ->i ->i (Author Vector) ->i ->i ->i (Date Vector))'#() \ No newline at end of file diff --git a/gibbon-compiler/examples/test_153.ans b/gibbon-compiler/examples/test_153.ans index 0fd69c661..3bbd24cf0 100644 --- a/gibbon-compiler/examples/test_153.ans +++ b/gibbon-compiler/examples/test_153.ans @@ -1 +1 @@ -'#((A_v_11 2 3) (B_v_12 4 5)) \ No newline at end of file +'#((A6_v15 2 3) (B5_v16 4 5)) \ No newline at end of file diff --git a/gibbon-compiler/examples/test_166.ans b/gibbon-compiler/examples/test_166.ans index 86a4b2368..663746e89 100644 --- a/gibbon-compiler/examples/test_166.ans +++ b/gibbon-compiler/examples/test_166.ans @@ -1 +1 @@ -(Node_v_54 10 10 10 10 10 10 10 10 (Cell_v_54 5 5 5 5 5 5 5 5) (Cell_v_54 2 2 2 2 2 2 2 2)) +(Node16_v61 10 10 10 10 10 10 10 10 (Cell15_v61 5 5 5 5 5 5 5 5) (Cell15_v61 2 2 2 2 2 2 2 2)) diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log new file mode 100644 index 000000000..db105efd3 --- /dev/null +++ b/gibbon-compiler/ir.log @@ -0,0 +1,5338 @@ + ! Responding to env Var: GIBBON_DEBUG=4 + ! We set DEBUG based on command-line verbose arg: 4 + +Parsed: +================================================================================ +ProgBundle [ProgModule "GenerateLayout1" + (Prog + {ddefs = [], + fundefs = [(mkBlogs_layout1, + FunDef {funName = "mkBlogs_layout1", + funArgs = [length], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "Blog" [])), + funBody = IfE (PrimAppE LtEqP + [VarE "length",LitE 0]) + (DataConE (MetaTv $1) "End" []) + (LetE (header, + [], + MetaTv $16, + DataConE (MetaTv $15) + "Header" + [AppE "getRandomString" + [] + [LitE 5]]) + (LetE (id, + [], + MetaTv $14, + DataConE (MetaTv $13) + "ID" + [PrimAppE SubP + [LitE 10, + PrimAppE ModP + [VarE "length", + LitE 10]]]) + (LetE (author, + [], + MetaTv $12, + DataConE (MetaTv $11) + "Author" + [AppE "getRandomString" + [] + [LitE 5]]) + (LetE (date, + [], + MetaTv $10, + DataConE (MetaTv $9) + "Date" + [AppE "getRandomString" + [] + [LitE 5]]) + (LetE (content, + [], + MetaTv $8, + DataConE (MetaTv $6) + "Content" + [DataConE (MetaTv $7) + "Plain" + [AppE "mkRandomInlineList" + [] + [LitE 50]]]) + (LetE (tags, + [], + MetaTv $5, + DataConE (MetaTv $4) + "TagList" + [AppE "mkSomeTags" + [] + [LitE 10]]) + (LetE (rst, + [], + MetaTv $3, + AppE "mkBlogs_layout1" + [] + [PrimAppE SubP + [VarE "length", + LitE 1]]) + (DataConE (MetaTv $2) + "Layout1" + [VarE "header", + VarE "id", + VarE "author", + VarE "date", + VarE "content", + VarE "tags", + VarE "rst"])))))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 1 3 14, srcInfoPoints = [SrcSpan ".hs" 3 1 3 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 8 3 14, srcInfoPoints = []}) "Basics", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Gibbon.Vector" + (Prog + {ddefs = [], + fundefs = [(generate, + FunDef {funName = "generate", + funArgs = [n,f], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + ArrowTy [IntTy] + (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (n', + [], + MetaTv $91, + AppE "maxInt" [] [VarE "n",LitE 0]) + (LetE (vec, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $90)) + [VarE "n'"]) + (LetE (vec1, + [], + MetaTv $89, + AppE "generate_loop" + [] + [VarE "vec", + LitE 0,VarE "n'", + VarE "f"]) + (VarE "vec1"))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length, + FunDef {funName = "length", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + IntTy), + funBody = PrimAppE (VLengthP (MetaTv $3)) + [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (select, + FunDef {funName = "select", + funArgs = [v1,v2,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a), + IntTy] + (TyVar u:a)), + funBody = LetE (len, + [], + MetaTv $102, + PrimAppE (VLengthP (MetaTv $101)) + [VarE "v1"]) + (IfE (PrimAppE LtP + [VarE "i", + VarE "len"]) + (PrimAppE (VNthP (MetaTv $99)) + [VarE "v1",VarE "i"]) + (PrimAppE (VNthP (MetaTv $100)) + [VarE "v2", + PrimAppE SubP + [VarE "i", + VarE "len"]])), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth, + FunDef {funName = "nth", + funArgs = [vec,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy] + (TyVar u:a)), + funBody = PrimAppE (VNthP (MetaTv $15)) + [VarE "vec",VarE "i"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (singleton, + FunDef {funName = "singleton", + funArgs = [x], + funTy = ForAll [u:a] + (ArrowTy [TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = LetE (vec, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $55)) + [LitE 1]) + (LetE (vec2, + [], + MetaTv $54, + PrimAppE (InplaceVUpdateP (MetaTv $53)) + [VarE "vec",LitE 0, + VarE "x"]) + (VarE "vec2")), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (append, + FunDef {funName = "append", + funArgs = [v1,v2], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "generate" + [] + [PrimAppE AddP + [PrimAppE (VLengthP (MetaTv $105)) + [VarE "v1"], + PrimAppE (VLengthP (MetaTv $106)) + [VarE "v2"]], + Ext (LambdaE [(i, MetaTv $107)] + (AppE "select" + [] + [VarE "v1", + VarE "v2", + VarE "i"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (head, + FunDef {funName = "head", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (TyVar u:a)), + funBody = AppE "nth" [] [VarE "vec",LitE 0], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printVec, + FunDef {funName = "printVec", + funArgs = [f,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a] + (ProdTy []), + VectorTy (TyVar u:a)] + (ProdTy [])), + funBody = LetE (wildcard_178, + [], + MetaTv $179, + PrimAppE PrintSym [LitSymE "["]) + (LetE (wildcard_176, + [], + MetaTv $177, + AppE "printVec_loop" + [] + [LitE 0, + PrimAppE (VLengthP (MetaTv $175)) + [VarE "vec"], + VarE "vec",VarE "f"]) + (LetE (wildcard_173, + [], + MetaTv $174, + PrimAppE PrintSym + [LitSymE "]"]) + (MkProdE []))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (alloc, + FunDef {funName = "alloc", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VAllocP (MetaTv $1)) + [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (filter, + FunDef {funName = "filter", + funArgs = [f,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a] + BoolTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (idxs, + [], + VectorTy IntTy, + AppE "generate" + [] + [PrimAppE (VLengthP (MetaTv $231)) + [VarE "vec"], + Ext (LambdaE [(i, + MetaTv $232)] + (IfE (AppE "f" + [] + [AppE "nth" + [] + [VarE "vec", + VarE "i"]]) + (VarE "i") + (PrimAppE SubP + [LitE 0, + LitE 1])))]) + (LetE (num_ones, + [], + MetaTv $230, + AppE "foldl" + [] + [Ext (LambdaE [(acc, + IntTy), + (x, + IntTy)] + (IfE (PrimAppE EqIntP + [VarE "x", + PrimAppE SubP + [LitE 0, + LitE 1]]) + (VarE "acc") + (PrimAppE AddP + [VarE "acc", + LitE 1]))), + LitE 0,VarE "idxs"]) + (LetE (to, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $227)) + [VarE "num_ones"]) + (LetE (len_idxs, + [], + MetaTv $226, + PrimAppE (VLengthP (MetaTv $225)) + [VarE "idxs"]) + (AppE "filter_loop" + [] + [VarE "idxs", + LitE 0, + LitE 0, + VarE "len_idxs", + VarE "vec", + VarE "to"])))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (filter_loop, + FunDef {funName = "filter_loop", + funArgs = [idxs,write_at,start,end,from,to], + funTy = ForAll [u:a] + (ArrowTy [VectorTy IntTy,IntTy, + IntTy,IntTy, + VectorTy (TyVar u:a), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = IfE (PrimAppE EqIntP + [VarE "start",VarE "end"]) + (VarE "to") + (LetE (idx, + [], + MetaTv $222, + AppE "nth" + [] + [VarE "idxs", + VarE "start"]) + (IfE (PrimAppE EqIntP + [VarE "idx", + PrimAppE SubP + [LitE 0, + LitE 1]]) + (AppE "filter_loop" + [] + [VarE "idxs", + VarE "write_at", + PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end", + VarE "from", + VarE "to"]) + (LetE (elt, + [], + MetaTv $221, + AppE "nth" + [] + [VarE "from", + VarE "idx"]) + (LetE (to1, + [], + MetaTv $220, + PrimAppE (InplaceVUpdateP (MetaTv $219)) + [VarE "to", + VarE "write_at", + VarE "elt"]) + (AppE "filter_loop" + [] + [VarE "idxs", + PrimAppE AddP + [VarE "write_at", + LitE 1], + PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end", + VarE "from", + VarE "to1"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lcons, + FunDef {funName = "lcons", + funArgs = [x,vec], + funTy = ForAll [u:a] + (ArrowTy [TyVar u:a, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (y, [], MetaTv $212, VarE "vec") + (AppE "cons" + [] + [VarE "x",VarE "y"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (cons, + FunDef {funName = "cons", + funArgs = [x,vec], + funTy = ForAll [u:a] + (ArrowTy [TyVar u:a, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = LetE (len, + [], + MetaTv $209, + PrimAppE (VLengthP (MetaTv $208)) + [VarE "vec"]) + (LetE (vec2, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $207)) + [PrimAppE AddP + [VarE "len", + LitE 1]]) + (LetE (vec3, + [], + MetaTv $206, + AppE "generate_loop" + [] + [VarE "vec2", + LitE 1, + PrimAppE AddP + [VarE "len", + LitE 1], + Ext (LambdaE [(i, + MetaTv $205)] + (AppE "nth" + [] + [VarE "vec", + PrimAppE SubP + [VarE "i", + LitE 1]]))]) + (LetE (vec4, + [], + MetaTv $204, + PrimAppE (InplaceVUpdateP (MetaTv $203)) + [VarE "vec3", + LitE 0, + VarE "x"]) + (VarE "vec4")))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lsnoc, + FunDef {funName = "lsnoc", + funArgs = [vec,x], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = LetE (y, [], MetaTv $200, VarE "vec") + (AppE "snoc" + [] + [VarE "y",VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (snoc, + FunDef {funName = "snoc", + funArgs = [vec,x], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = LetE (len, + [], + MetaTv $197, + PrimAppE (VLengthP (MetaTv $196)) + [VarE "vec"]) + (LetE (vec2, + [], + VectorTy (TyVar u:a), + PrimAppE (VAllocP (MetaTv $195)) + [PrimAppE AddP + [VarE "len", + LitE 1]]) + (LetE (vec3, + [], + MetaTv $194, + AppE "generate_loop" + [] + [VarE "vec2", + LitE 0, + VarE "len", + Ext (LambdaE [(i, + MetaTv $193)] + (AppE "nth" + [] + [VarE "vec", + VarE "i"]))]) + (LetE (vec4, + [], + MetaTv $192, + PrimAppE (InplaceVUpdateP (MetaTv $191)) + [VarE "vec3", + VarE "len", + VarE "x"]) + (VarE "vec4")))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printVec_loop, + FunDef {funName = "printVec_loop", + funArgs = [idx,end,vec,f], + funTy = ForAll [u:a] + (ArrowTy [IntTy,IntTy, + VectorTy (TyVar u:a), + ArrowTy [TyVar u:a] + (ProdTy [])] + (ProdTy [])), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (MkProdE []) + (LetE (wildcard_187, + [], + MetaTv $188, + AppE "f" + [] + [PrimAppE (VNthP (MetaTv $186)) + [VarE "vec", + VarE "idx"]]) + (LetE (wildcard_184, + [], + MetaTv $185, + PrimAppE PrintSym + [LitSymE ","]) + (AppE "printVec_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end", + VarE "vec", + VarE "f"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lifoldl, + FunDef {funName = "lifoldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b,IntTy, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = LetE (x, [], MetaTv $170, VarE "vec") + (AppE "ifoldl" + [] + [VarE "f",VarE "acc", + VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (ifoldl_loop, + FunDef {funName = "ifoldl_loop", + funArgs = [idx,end,f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [IntTy,IntTy, + ArrowTy [TyVar u:b,IntTy, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "acc") + (LetE (acc1, + [], + MetaTv $166, + AppE "f" + [] + [VarE "acc",VarE "idx", + PrimAppE (VNthP (MetaTv $165)) + [VarE "vec", + VarE "idx"]]) + (AppE "ifoldl_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end",VarE "f", + VarE "acc1", + VarE "vec"])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (ifoldl, + FunDef {funName = "ifoldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b,IntTy, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = AppE "ifoldl_loop" + [] + [LitE 0, + PrimAppE (VLengthP (MetaTv $159)) + [VarE "vec"], + VarE "f",VarE "acc",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lscanl, + FunDef {funName = "lscanl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = LetE (x, [], MetaTv $155, VarE "vec") + (AppE "scanl" + [] + [VarE "f",VarE "acc", + VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (scanl_loop, + FunDef {funName = "scanl_loop", + funArgs = [idx,end,f,acc,vec,result], + funTy = ForAll [u:a,u:b] + (ArrowTy [IntTy,IntTy, + ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a), + VectorTy (TyVar u:b)] + (VectorTy (TyVar u:b))), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "result") + (LetE (acc1, + [], + MetaTv $151, + AppE "f" + [] + [VarE "acc", + PrimAppE (VNthP (MetaTv $150)) + [VarE "vec", + VarE "idx"]]) + (LetE (result', + [], + MetaTv $149, + PrimAppE (InplaceVUpdateP (MetaTv $148)) + [VarE "result", + VarE "idx", + VarE "acc1"]) + (AppE "scanl_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end", + VarE "f", + VarE "acc1", + VarE "vec", + VarE "result'"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (scanl, + FunDef {funName = "scanl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = LetE (len, + [], + MetaTv $141, + PrimAppE (VLengthP (MetaTv $140)) + [VarE "vec"]) + (LetE (result, + [], + VectorTy (TyVar u:b), + PrimAppE (VAllocP (MetaTv $139)) + [VarE "len"]) + (AppE "scanl_loop" + [] + [LitE 0,VarE "len", + VarE "f",VarE "acc", + VarE "vec", + VarE "result"])), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lfoldl, + FunDef {funName = "lfoldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = LetE (x, [], MetaTv $135, VarE "vec") + (AppE "foldl" + [] + [VarE "f",VarE "acc", + VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (foldl_loop, + FunDef {funName = "foldl_loop", + funArgs = [idx,end,f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [IntTy,IntTy, + ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "acc") + (LetE (acc1, + [], + MetaTv $131, + AppE "f" + [] + [VarE "acc", + PrimAppE (VNthP (MetaTv $130)) + [VarE "vec", + VarE "idx"]]) + (AppE "foldl_loop" + [] + [PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end",VarE "f", + VarE "acc1", + VarE "vec"])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (foldl, + FunDef {funName = "foldl", + funArgs = [f,acc,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:b, + TyVar u:a] + (TyVar u:b), + TyVar u:b, + VectorTy (TyVar u:a)] + (TyVar u:b)), + funBody = AppE "foldl_loop" + [] + [LitE 0, + PrimAppE (VLengthP (MetaTv $124)) + [VarE "vec"], + VarE "f",VarE "acc",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (update, + FunDef {funName = "update", + funArgs = [vec,i,x], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy,TyVar u:a] + (VectorTy (TyVar u:a))), + funBody = AppE "generate" + [] + [AppE "length" [] [VarE "vec"], + Ext (LambdaE [(j, MetaTv $120)] + (IfE (PrimAppE EqIntP + [VarE "i", + VarE "j"]) + (VarE "x") + (PrimAppE (VNthP (MetaTv $119)) + [VarE "vec", + VarE "j"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lmap, + FunDef {funName = "lmap", + funArgs = [f,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:a] + (TyVar u:b), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = LetE (x, [], MetaTv $115, VarE "vec") + (AppE "map" [] [VarE "f",VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (map, + FunDef {funName = "map", + funArgs = [f,vec], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:a] + (TyVar u:b), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:b))), + funBody = AppE "generate" + [] + [PrimAppE (VLengthP (MetaTv $110)) + [VarE "vec"], + Ext (LambdaE [(i, MetaTv $112)] + (AppE "f" + [] + [PrimAppE (VNthP (MetaTv $111)) + [VarE "vec", + VarE "i"]]))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lcopy, + FunDef {funName = "lcopy", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "copy" [] [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (copy, + FunDef {funName = "copy", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "generate" + [] + [PrimAppE (VLengthP (MetaTv $93)) + [VarE "vec"], + Ext (LambdaE [(i, MetaTv $94)] + (AppE "nth" + [] + [VarE "vec", + VarE "i"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (generate_loop, + FunDef {funName = "generate_loop", + funArgs = [vec,idx,end,f], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy,IntTy, + ArrowTy [IntTy] + (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = IfE (PrimAppE EqIntP + [VarE "idx",VarE "end"]) + (VarE "vec") + (LetE (vec1, + [], + MetaTv $86, + PrimAppE (InplaceVUpdateP (MetaTv $85)) + [VarE "vec", + VarE "idx", + AppE "f" + [] + [VarE "idx"]]) + (AppE "generate_loop" + [] + [VarE "vec1", + PrimAppE AddP + [VarE "idx", + LitE 1], + VarE "end",VarE "f"])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (tail, + FunDef {funName = "tail", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = AppE "slice" + [] + [LitE 1, + PrimAppE SubP + [PrimAppE (VLengthP (MetaTv $80)) + [VarE "vec"], + LitE 1], + VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lsplitAt', + FunDef {funName = "lsplitAt'", + funArgs = [n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + VectorTy (TyVar u:a)] + (ProdTy [IntTy, + VectorTy (TyVar u:a), + IntTy, + VectorTy (TyVar u:a)])), + funBody = LetE (tup74, + [], + MetaTv $75, + AppE "splitAt" + [] + [VarE "n",VarE "vec"]) + (LetE (x, + [], + MetaTv $77, + ProjE 0 (VarE "tup74")) + (LetE (y, + [], + MetaTv $76, + ProjE 1 (VarE "tup74")) + (MkProdE [PrimAppE (VLengthP (MetaTv $71)) + [VarE "x"], + VarE "x", + PrimAppE (VLengthP (MetaTv $73)) + [VarE "y"], + VarE "y"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (lsplitAt, + FunDef {funName = "lsplitAt", + funArgs = [n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + VectorTy (TyVar u:a)] + (ProdTy [IntTy, + VectorTy (TyVar u:a), + IntTy, + VectorTy (TyVar u:a)])), + funBody = LetE (x, [], MetaTv $67, VarE "vec") + (AppE "lsplitAt'" + [] + [VarE "n",VarE "x"]), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (splitAt, + FunDef {funName = "splitAt", + funArgs = [n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + VectorTy (TyVar u:a)] + (ProdTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a)])), + funBody = LetE (len, + [], + MetaTv $64, + PrimAppE (VLengthP (MetaTv $63)) + [VarE "vec"]) + (LetE (n', + [], + MetaTv $62, + AppE "maxInt" + [] + [VarE "n",LitE 0]) + (LetE (m, + [], + MetaTv $61, + AppE "minInt" + [] + [VarE "n'", + VarE "len"]) + (LetE (m', + [], + MetaTv $60, + AppE "maxInt" + [] + [LitE 0, + PrimAppE SubP + [VarE "len", + VarE "n'"]]) + (MkProdE [PrimAppE (VSliceP (MetaTv $58)) + [LitE 0, + VarE "m", + VarE "vec"], + PrimAppE (VSliceP (MetaTv $59)) + [VarE "m", + VarE "m'", + VarE "vec"]])))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (isEmpty, + FunDef {funName = "isEmpty", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + BoolTy), + funBody = PrimAppE EqIntP + [PrimAppE (VLengthP (MetaTv $51)) + [VarE "vec"], + LitE 0], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (inplaceUpdate, + FunDef {funName = "inplaceUpdate", + funArgs = [i,val,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy,TyVar u:a, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (InplaceVUpdateP (MetaTv $49)) + [VarE "vec",VarE "i", + VarE "val"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (inplaceSort, + FunDef {funName = "inplaceSort", + funArgs = [cmp,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a, + TyVar u:a] + IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (InplaceVSortP (MetaTv $45)) + [VarE "vec",VarE "cmp"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (flatten, + FunDef {funName = "flatten", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (VectorTy (TyVar u:a))] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VConcatP (MetaTv $42)) + [VarE "ls"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (sort, + FunDef {funName = "sort", + funArgs = [cmp,vec], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a, + TyVar u:a] + IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VSortP (MetaTv $40)) + [VarE "vec",VarE "cmp"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (merge, + FunDef {funName = "merge", + funArgs = [vec1,vec2], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VMergeP (MetaTv $37)) + [VarE "vec1",VarE "vec2"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (unsafeSlice, + FunDef {funName = "unsafeSlice", + funArgs = [i,n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy,IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VSliceP (MetaTv $34)) + [VarE "i",VarE "n",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (slice, + FunDef {funName = "slice", + funArgs = [i,n,vec], + funTy = ForAll [u:a] + (ArrowTy [IntTy,IntTy, + VectorTy (TyVar u:a)] + (VectorTy (TyVar u:a))), + funBody = PrimAppE (VSliceP (MetaTv $30)) + [VarE "i",VarE "n",VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth2, + FunDef {funName = "nth2", + funArgs = [vec,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy] + (ProdTy [TyVar u:a, + VectorTy (TyVar u:a)])), + funBody = LetE (tup26, [], MetaTv $24, VarE "vec") + (LetE (vec1, + [], + MetaTv $24, + VarE "tup26") + (LetE (vec2, + [], + MetaTv $25, + VarE "tup26") + (MkProdE [PrimAppE (VNthP (MetaTv $23)) + [VarE "vec1", + VarE "i"], + VarE "vec2"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth1, + FunDef {funName = "nth1", + funArgs = [vec,i], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a), + IntTy] + (TyVar u:a)), + funBody = PrimAppE (VNthP (MetaTv $19)) + [VarE "vec",VarE "i"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length2, + FunDef {funName = "length2", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + (ProdTy [IntTy, + VectorTy (TyVar u:a)])), + funBody = LetE (tup12, [], MetaTv $10, VarE "vec") + (LetE (vec1, + [], + MetaTv $10, + VarE "tup12") + (LetE (vec2, + [], + MetaTv $11, + VarE "tup12") + (MkProdE [PrimAppE (VLengthP (MetaTv $9)) + [VarE "vec1"], + VarE "vec2"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length1, + FunDef {funName = "length1", + funArgs = [vec], + funTy = ForAll [u:a] + (ArrowTy [VectorTy (TyVar u:a)] + IntTy), + funBody = PrimAppE (VLengthP (MetaTv $6)) + [VarE "vec"], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 1 10 22, srcInfoPoints = [SrcSpan ".hs" 10 1 10 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 8 10 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Gibbon.Prim" + (Prog {ddefs = [], fundefs = [], mainExp = Nothing}) + [], + ProgModule "Gibbon.Prelude" + (Prog + {ddefs = [], + fundefs = [(maxInt, + FunDef {funName = "maxInt", + funArgs = [a,b], + funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), + funBody = IfE (PrimAppE GtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (print_space, + FunDef {funName = "print_space", + funArgs = [wildcard_20], + funTy = ForAll [] + (ArrowTy [ProdTy []] (ProdTy [])), + funBody = PrimAppE PrintSym [LitSymE " "], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (print_newline, + FunDef {funName = "print_newline", + funArgs = [wildcard_18], + funTy = ForAll [] + (ArrowTy [ProdTy []] (ProdTy [])), + funBody = PrimAppE PrintSym [LitSymE "\n"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (print_check, + FunDef {funName = "print_check", + funArgs = [b], + funTy = ForAll [] (ArrowTy [BoolTy] (ProdTy [])), + funBody = IfE (VarE "b") + (LetE (wildcard_14, + [], + MetaTv $15, + PrimAppE PrintSym + [LitSymE "OK\n"]) + (MkProdE [])) + (LetE (wildcard_16, + [], + MetaTv $17, + PrimAppE PrintSym + [LitSymE "Err\n"]) + (MkProdE [])), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (compare_int, + FunDef {funName = "compare_int", + funArgs = [r1,r2], + funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), + funBody = IfE (PrimAppE LtP [VarE "r1",VarE "r2"]) + (PrimAppE SubP [LitE 0,LitE 1]) + (IfE (PrimAppE GtP + [VarE "r1",VarE "r2"]) + (LitE 1) + (LitE 0)), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (compare_float, + FunDef {funName = "compare_float", + funArgs = [r1,r2], + funTy = ForAll [] + (ArrowTy [FloatTy,FloatTy] IntTy), + funBody = IfE (PrimAppE FLtP [VarE "r1",VarE "r2"]) + (PrimAppE SubP [LitE 0,LitE 1]) + (IfE (PrimAppE FGtP + [VarE "r1",VarE "r2"]) + (LitE 1) + (LitE 0)), + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (float_abs, + FunDef {funName = "float_abs", + funArgs = [f], + funTy = ForAll [] (ArrowTy [FloatTy] FloatTy), + funBody = IfE (PrimAppE FLtP [VarE "f",FloatE 0.0]) + (PrimAppE FMulP + [VarE "f", + PrimAppE FSubP + [FloatE 0.0, + FloatE 1.0]]) + (VarE "f"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (minFloat, + FunDef {funName = "minFloat", + funArgs = [a,b], + funTy = ForAll [] + (ArrowTy [FloatTy,FloatTy] FloatTy), + funBody = IfE (PrimAppE FLtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (maxFloat, + FunDef {funName = "maxFloat", + funArgs = [a,b], + funTy = ForAll [] + (ArrowTy [FloatTy,FloatTy] FloatTy), + funBody = IfE (PrimAppE FGtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (minInt, + FunDef {funName = "minInt", + funArgs = [a,b], + funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), + funBody = IfE (PrimAppE LtP [VarE "a",VarE "b"]) + (VarE "a") + (VarE "b"), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 12 1 12 19, srcInfoPoints = [SrcSpan ".hs" 12 1 12 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 12 8 12 19, srcInfoPoints = []}) "Gibbon.Prim", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Gibbon.PList" + (Prog + {ddefs = [(PList, + DDef {tyName = "PList", + tyArgs = [u:a], + dataCons = [("Nil", []), + ("Cons", + [(False, TyVar u:a), + (False, + PackedTy "PList" [TyVar u:a])])]})], + fundefs = [(is_empty_plist, + FunDef {funName = "is_empty_plist", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + BoolTy), + funBody = CaseE (VarE "ls") + [("Nil", [], PrimAppE MkTrue []), + ("Cons", + [(wildcard_1, MetaTv $3), + (wildcard_2, MetaTv $4)], + PrimAppE MkFalse [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (zip_plist, + FunDef {funName = "zip_plist", + funArgs = [as,bs], + funTy = ForAll [u:a,u:b] + (ArrowTy [PackedTy "PList" + [TyVar u:a], + PackedTy "PList" + [TyVar u:b]] + (PackedTy "PList" + [ProdTy [TyVar u:a, + TyVar u:b]])), + funBody = CaseE (VarE "as") + [("Nil", + [], + DataConE (MetaTv $71) "Nil" []), + ("Cons", + [(z, MetaTv $76), + (zs, MetaTv $77)], + CaseE (VarE "bs") + [("Nil", + [], + DataConE (MetaTv $72) + "Nil" + []), + ("Cons", + [(y, MetaTv $74), + (ys, MetaTv $75)], + DataConE (MetaTv $73) + "Cons" + [MkProdE [VarE "z", + VarE "y"], + AppE "zip_plist" + [] + [VarE "zs", + VarE "ys"]])])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (splitAt_plist, + FunDef {funName = "splitAt_plist", + funArgs = [n,a], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + PackedTy "PList" + [TyVar u:a]] + (ProdTy [PackedTy "PList" + [TyVar u:a], + PackedTy "PList" + [TyVar u:a]])), + funBody = IfE (PrimAppE EqIntP [VarE "n",LitE 0]) + (MkProdE [DataConE (MetaTv $59) + "Nil" + [], + VarE "a"]) + (CaseE (VarE "a") + [("Nil", + [], + MkProdE [DataConE (MetaTv $60) + "Nil" + [], + DataConE (MetaTv $61) + "Nil" + []]), + ("Cons", + [(x, MetaTv $67), + (xs, MetaTv $68)], + LetE (tup63, + [], + MetaTv $64, + AppE "splitAt_plist" + [] + [PrimAppE SubP + [VarE "n", + LitE 1], + VarE "xs"]) + (LetE (c, + [], + MetaTv $66, + ProjE 0 + (VarE "tup63")) + (LetE (d, + [], + MetaTv $65, + ProjE 1 + (VarE "tup63")) + (MkProdE [DataConE (MetaTv $62) + "Cons" + [VarE "x", + VarE "c"], + VarE "d"]))))]), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (map_plist, + FunDef {funName = "map_plist", + funArgs = [f,ls], + funTy = ForAll [u:a,u:b] + (ArrowTy [ArrowTy [TyVar u:a] + (TyVar u:b), + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:b])), + funBody = CaseE (VarE "ls") + [("Nil", + [], + DataConE (MetaTv $53) "Nil" []), + ("Cons", + [(x, MetaTv $55), + (xs, MetaTv $56)], + DataConE (MetaTv $54) + "Cons" + [AppE "f" [] [VarE "x"], + AppE "map_plist" + [] + [VarE "f", + VarE "xs"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (reverse_plist, + FunDef {funName = "reverse_plist", + funArgs = [xs,acc], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a], + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "xs") + [("Nil", [], VarE "acc"), + ("Cons", + [(z, MetaTv $49), + (zs, MetaTv $50)], + AppE "reverse_plist" + [] + [VarE "zs", + DataConE (MetaTv $48) + "Cons" + [VarE "z", + VarE "acc"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (drop_plist, + FunDef {funName = "drop_plist", + funArgs = [num,list], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "list") + [("Nil", + [], + DataConE (MetaTv $42) "Nil" []), + ("Cons", + [(x, MetaTv $44), + (rst, MetaTv $45)], + IfE (PrimAppE LtEqP + [VarE "num", + LitE 0]) + (DataConE (MetaTv $43) + "Cons" + [VarE "x", + VarE "rst"]) + (AppE "drop_plist" + [] + [PrimAppE SubP + [VarE "num", + LitE 1], + VarE "rst"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (take_plist, + FunDef {funName = "take_plist", + funArgs = [n,a], + funTy = ForAll [u:a] + (ArrowTy [IntTy, + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = IfE (PrimAppE EqIntP [VarE "n",LitE 0]) + (DataConE (MetaTv $35) "Nil" []) + (CaseE (VarE "a") + [("Nil", + [], + DataConE (MetaTv $36) + "Nil" + []), + ("Cons", + [(z, MetaTv $38), + (zs, MetaTv $39)], + DataConE (MetaTv $37) + "Cons" + [VarE "z", + AppE "take_plist" + [] + [PrimAppE SubP + [VarE "n", + LitE 1], + VarE "zs"]])]), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (filter_plist, + FunDef {funName = "filter_plist", + funArgs = [f,a], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a] + BoolTy, + PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "a") + [("Nil", + [], + DataConE (MetaTv $29) "Nil" []), + ("Cons", + [(z, MetaTv $31), + (zs, MetaTv $32)], + IfE (AppE "f" [] [VarE "z"]) + (DataConE (MetaTv $30) + "Cons" + [VarE "z", + AppE "filter_plist" + [] + [VarE "f", + VarE "zs"]]) + (AppE "filter_plist" + [] + [VarE "f", + VarE "zs"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (length_plist, + FunDef {funName = "length_plist", + funArgs = [a], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + IntTy), + funBody = CaseE (VarE "a") + [("Nil", [], LitE 0), + ("Cons", + [(x, MetaTv $25), + (xs, MetaTv $26)], + PrimAppE AddP + [LitE 1, + AppE "length_plist" + [] + [VarE "xs"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (nth_plist, + FunDef {funName = "nth_plist", + funArgs = [list,def,index,start], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a], + TyVar u:a,IntTy,IntTy] + (TyVar u:a)), + funBody = CaseE (VarE "list") + [("Nil", [], VarE "def"), + ("Cons", + [(x, MetaTv $22), + (rst, MetaTv $23)], + IfE (PrimAppE EqIntP + [VarE "index", + VarE "start"]) + (VarE "x") + (AppE "nth_plist" + [] + [VarE "rst",VarE "def", + VarE "index", + PrimAppE AddP + [VarE "start", + LitE 1]]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (elem_plist, + FunDef {funName = "elem_plist", + funArgs = [cmp,a,list], + funTy = ForAll [u:a] + (ArrowTy [ArrowTy [TyVar u:a, + TyVar u:a] + IntTy, + TyVar u:a, + PackedTy "PList" + [TyVar u:a]] + BoolTy), + funBody = CaseE (VarE "list") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(x, MetaTv $16), + (rst, MetaTv $17)], + IfE (PrimAppE EqIntP + [AppE "cmp" + [] + [VarE "x", + VarE "a"], + LitE 0]) + (PrimAppE MkTrue []) + (AppE "elem_plist" + [] + [VarE "cmp",VarE "a", + VarE "rst"]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (tail_plist, + FunDef {funName = "tail_plist", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + (PackedTy "PList" + [TyVar u:a])), + funBody = CaseE (VarE "ls") + [("Cons", + [(wildcard_10, MetaTv $11), + (xs, MetaTv $12)], + VarE "xs")], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (head_plist, + FunDef {funName = "head_plist", + funArgs = [ls], + funTy = ForAll [u:a] + (ArrowTy [PackedTy "PList" + [TyVar u:a]] + (TyVar u:a)), + funBody = CaseE (VarE "ls") + [("Cons", + [(x, MetaTv $7), + (wildcard_6, MetaTv $8)], + VarE "x")], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 1 8 22, srcInfoPoints = [SrcSpan ".hs" 8 1 8 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 8 8 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], + ProgModule "Basics" + (Prog + {ddefs = [(Inline, + DDef {tyName = "Inline", + tyArgs = [], + dataCons = [("Str", [(False, VectorTy CharTy)]), + ("Emph", + [(False, + PackedTy "PList" + [PackedTy "Inline" []])]), + ("Space", [])]}), + (Block, + DDef {tyName = "Block", + tyArgs = [], + dataCons = [("Plain", + [(False, + PackedTy "PList" + [PackedTy "Inline" []])]), + ("Null", [])]}), + (BlogHeader, + DDef {tyName = "BlogHeader", + tyArgs = [], + dataCons = [("Header", [(False, VectorTy CharTy)])]}), + (BlogId, + DDef {tyName = "BlogId", + tyArgs = [], + dataCons = [("ID", [(False, IntTy)])]}), + (BlogAuthor, + DDef {tyName = "BlogAuthor", + tyArgs = [], + dataCons = [("Author", [(False, VectorTy CharTy)])]}), + (BlogDate, + DDef {tyName = "BlogDate", + tyArgs = [], + dataCons = [("Date", [(False, VectorTy CharTy)])]}), + (BlogContent, + DDef {tyName = "BlogContent", + tyArgs = [], + dataCons = [("Content", + [(False, PackedTy "Block" [])])]}), + (BlogTags, + DDef {tyName = "BlogTags", + tyArgs = [], + dataCons = [("TagList", + [(False, + PackedTy "PList" + [VectorTy CharTy])])]}), + (Blog, + DDef {tyName = "Blog", + tyArgs = [], + dataCons = [("End", []), + ("Layout1", + [(False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogTags" []), + (False, PackedTy "Blog" [])]), + ("Layout2", + [(False, PackedTy "BlogContent" []), + (False, PackedTy "BlogTags" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout3", + [(False, PackedTy "BlogTags" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout4", + [(False, PackedTy "BlogTags" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout5", + [(False, PackedTy "Blog" []), + (False, PackedTy "BlogTags" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" [])]), + ("Layout6", + [(False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogTags" [])]), + ("Layout7", + [(False, PackedTy "Blog" []), + (False, PackedTy "BlogContent" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogTags" [])]), + ("Layout8", + [(False, PackedTy "BlogContent" []), + (False, PackedTy "Blog" []), + (False, PackedTy "BlogId" []), + (False, PackedTy "BlogAuthor" []), + (False, PackedTy "BlogDate" []), + (False, PackedTy "BlogHeader" []), + (False, PackedTy "BlogTags" [])])]})], + fundefs = [(emphasizeKeywordInBlock, + FunDef {funName = "emphasizeKeywordInBlock", + funArgs = [keyword,contentBlock], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Block" []] + (PackedTy "Block" [])), + funBody = CaseE (VarE "contentBlock") + [("Plain", + [(list_inline, MetaTv $91)], + DataConE (MetaTv $90) + "Plain" + [AppE "emphasizeInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]]), + ("Null", + [], + DataConE (MetaTv $92) + "Null" + [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printBlog, + FunDef {funName = "printBlog", + funArgs = [blog], + funTy = ForAll [] + (ArrowTy [PackedTy "Blog" []] + (ProdTy [])), + funBody = CaseE (VarE "blog") + [("Layout1", + [(header, MetaTv $346), + (id, MetaTv $347), + (author, MetaTv $348), + (date, MetaTv $349), + (content, MetaTv $350), + (tags, MetaTv $351), + (rst, MetaTv $352)], + LetE (wildcard_344, + [], + MetaTv $345, + PrimAppE PrintSym + [LitSymE "Layout1 "]) + (LetE (wildcard_342, + [], + MetaTv $343, + AppE "printHeader" + [] + [VarE "header"]) + (LetE (wildcard_340, + [], + MetaTv $341, + AppE "printID" + [] + [VarE "id"]) + (LetE (wildcard_338, + [], + MetaTv $339, + AppE "printAuthor" + [] + [VarE "author"]) + (LetE (wildcard_336, + [], + MetaTv $337, + AppE "printDate" + [] + [VarE "date"]) + (LetE (wildcard_334, + [], + MetaTv $335, + AppE "printContent" + [] + [VarE "content"]) + (LetE (wildcard_332, + [], + MetaTv $333, + AppE "printTagList" + [] + [VarE "tags"]) + (LetE (wildcard_330, + [], + MetaTv $331, + AppE "printBlog" + [] + [VarE "rst"]) + (MkProdE [])))))))))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (getChar, + FunDef {funName = "getChar", + funArgs = [decimal], + funTy = ForAll [] (ArrowTy [IntTy] CharTy), + funBody = IfE (PrimAppE EqIntP + [VarE "decimal",LitE 0]) + (CharE 'a') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 1]) + (CharE 'b') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 2]) + (CharE 'c') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 3]) + (CharE 'd') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 4]) + (CharE 'e') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 5]) + (CharE 'f') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 6]) + (CharE 'g') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 7]) + (CharE 'h') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 8]) + (CharE 'i') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 9]) + (CharE 'j') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 10]) + (CharE 'k') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 11]) + (CharE 'l') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 12]) + (CharE 'm') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 13]) + (CharE 'n') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 14]) + (CharE 'o') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 15]) + (CharE 'p') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 16]) + (CharE 'q') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 17]) + (CharE 'r') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 18]) + (CharE 's') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 19]) + (CharE 't') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 20]) + (CharE 'u') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 21]) + (CharE 'v') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 22]) + (CharE 'w') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 23]) + (CharE 'x') + (IfE (PrimAppE EqIntP + [VarE "decimal", + LitE 24]) + (CharE 'y') + (CharE 'z'))))))))))))))))))))))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printInline, + FunDef {funName = "printInline", + funArgs = [inline], + funTy = ForAll [] + (ArrowTy [PackedTy "Inline" []] + (ProdTy [])), + funBody = CaseE (VarE "inline") + [("Str", + [(text, MetaTv $394)], + LetE (wildcard_392, + [], + MetaTv $393, + PrimAppE PrintSym + [LitSymE "Str "]) + (LetE (wildcard_390, + [], + MetaTv $391, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $389)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "text"]) + (MkProdE []))), + ("Emph", + [(plist, MetaTv $399)], + LetE (wildcard_397, + [], + MetaTv $398, + PrimAppE PrintSym + [LitSymE "Emph "]) + (LetE (wildcard_395, + [], + MetaTv $396, + AppE "printPlistInline" + [] + [VarE "plist"]) + (MkProdE []))), + ("Space", + [], + LetE (wildcard_400, + [], + MetaTv $401, + PrimAppE PrintSym + [LitSymE "Space "]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printPlistText, + FunDef {funName = "printPlistText", + funArgs = [list], + funTy = ForAll [] + (ArrowTy [PackedTy "PList" + [VectorTy CharTy]] + (ProdTy [])), + funBody = CaseE (VarE "list") + [("Cons", + [(x, MetaTv $384), + (rst, MetaTv $385)], + LetE (wildcard_382, + [], + MetaTv $383, + PrimAppE PrintSym + [LitSymE "PList ( Cons "]) + (LetE (wildcard_380, + [], + MetaTv $381, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $379)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "x"]) + (LetE (wildcard_377, + [], + MetaTv $378, + AppE "printPlistText" + [] + [VarE "rst"]) + (LetE (wildcard_375, + [], + MetaTv $376, + PrimAppE PrintSym + [LitSymE " ) "]) + (MkProdE []))))), + ("Nil", + [], + LetE (wildcard_386, + [], + MetaTv $387, + PrimAppE PrintSym + [LitSymE "Nil"]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printPlistInline, + FunDef {funName = "printPlistInline", + funArgs = [list], + funTy = ForAll [] + (ArrowTy [PackedTy "PList" + [PackedTy "Inline" + []]] + (ProdTy [])), + funBody = CaseE (VarE "list") + [("Cons", + [(x, MetaTv $370), + (rst, MetaTv $371)], + LetE (wildcard_368, + [], + MetaTv $369, + PrimAppE PrintSym + [LitSymE "PList ( Cons "]) + (LetE (wildcard_366, + [], + MetaTv $367, + AppE "printInline" + [] + [VarE "x"]) + (LetE (wildcard_364, + [], + MetaTv $365, + AppE "printPlistInline" + [] + [VarE "rst"]) + (LetE (wildcard_362, + [], + MetaTv $363, + PrimAppE PrintSym + [LitSymE " ) "]) + (MkProdE []))))), + ("Nil", + [], + LetE (wildcard_372, + [], + MetaTv $373, + PrimAppE PrintSym + [LitSymE "Nil"]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printBlock, + FunDef {funName = "printBlock", + funArgs = [block], + funTy = ForAll [] + (ArrowTy [PackedTy "Block" []] + (ProdTy [])), + funBody = CaseE (VarE "block") + [("Plain", + [(plist, MetaTv $358)], + LetE (wildcard_356, + [], + MetaTv $357, + PrimAppE PrintSym + [LitSymE "Plain "]) + (LetE (wildcard_354, + [], + MetaTv $355, + AppE "printPlistInline" + [] + [VarE "plist"]) + (MkProdE []))), + ("Null", + [], + LetE (wildcard_359, + [], + MetaTv $360, + PrimAppE PrintSym + [LitSymE "Null"]) + (MkProdE []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printID, + FunDef {funName = "printID", + funArgs = [id], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogId" []] + (ProdTy [])), + funBody = CaseE (VarE "id") + [("ID", + [(val, MetaTv $328)], + LetE (wildcard_326, + [], + MetaTv $327, + PrimAppE PrintSym + [LitSymE "ID "]) + (LetE (wildcard_324, + [], + MetaTv $325, + PrimAppE PrintInt + [VarE "val"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printHeader, + FunDef {funName = "printHeader", + funArgs = [header], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogHeader" []] + (ProdTy [])), + funBody = CaseE (VarE "header") + [("Header", + [(str, MetaTv $322)], + LetE (wildcard_320, + [], + MetaTv $321, + PrimAppE PrintSym + [LitSymE "Header "]) + (LetE (wildcard_318, + [], + MetaTv $319, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $317)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "str"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printAuthor, + FunDef {funName = "printAuthor", + funArgs = [date], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogAuthor" []] + (ProdTy [])), + funBody = CaseE (VarE "date") + [("Author", + [(str, MetaTv $315)], + LetE (wildcard_313, + [], + MetaTv $314, + PrimAppE PrintSym + [LitSymE "Author "]) + (LetE (wildcard_311, + [], + MetaTv $312, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $310)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "str"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printDate, + FunDef {funName = "printDate", + funArgs = [date], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogDate" []] + (ProdTy [])), + funBody = CaseE (VarE "date") + [("Date", + [(str, MetaTv $308)], + LetE (wildcard_306, + [], + MetaTv $307, + PrimAppE PrintSym + [LitSymE "Date "]) + (LetE (wildcard_304, + [], + MetaTv $305, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $303)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "str"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printTagList, + FunDef {funName = "printTagList", + funArgs = [tags], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogTags" []] + (ProdTy [])), + funBody = CaseE (VarE "tags") + [("TagList", + [(plist, MetaTv $301)], + LetE (wildcard_299, + [], + MetaTv $300, + PrimAppE PrintSym + [LitSymE "TagList "]) + (LetE (wildcard_297, + [], + MetaTv $298, + AppE "printPlistText" + [] + [VarE "plist"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printContent, + FunDef {funName = "printContent", + funArgs = [content], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogContent" []] + (ProdTy [])), + funBody = CaseE (VarE "content") + [("Content", + [(block, MetaTv $295)], + LetE (wildcard_293, + [], + MetaTv $294, + PrimAppE PrintSym + [LitSymE "Content "]) + (LetE (wildcard_291, + [], + MetaTv $292, + AppE "printBlock" + [] + [VarE "block"]) + (MkProdE [])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (blogLength, + FunDef {funName = "blogLength", + funArgs = [blog], + funTy = ForAll [] + (ArrowTy [PackedTy "Blog" []] + IntTy), + funBody = CaseE (VarE "blog") + [("End", [], LitE 0), + ("Layout1", + [(a, MetaTv $234), + (b, MetaTv $235), + (c, MetaTv $236), + (d, MetaTv $237), + (e, MetaTv $238), + (f, MetaTv $239), + (rst, MetaTv $240)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout2", + [(a, MetaTv $241), + (b, MetaTv $242), + (rst, MetaTv $243), + (c, MetaTv $244), + (d, MetaTv $245), + (e, MetaTv $246), + (f, MetaTv $247)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout3", + [(a, MetaTv $248), + (rst, MetaTv $249), + (b, MetaTv $250), + (c, MetaTv $251), + (d, MetaTv $252), + (e, MetaTv $253), + (f, MetaTv $254)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout4", + [(a, MetaTv $255), + (b, MetaTv $256), + (rst, MetaTv $257), + (d, MetaTv $258), + (e, MetaTv $259), + (f, MetaTv $260), + (g, MetaTv $261)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout5", + [(rst, MetaTv $262), + (a, MetaTv $263), + (b, MetaTv $264), + (c, MetaTv $265), + (d, MetaTv $266), + (e, MetaTv $267), + (f, MetaTv $268)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout6", + [(a, MetaTv $269), + (b, MetaTv $270), + (c, MetaTv $271), + (d, MetaTv $272), + (e, MetaTv $273), + (rst, MetaTv $274), + (f, MetaTv $275)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout7", + [(rst, MetaTv $276), + (a, MetaTv $277), + (b, MetaTv $278), + (c, MetaTv $279), + (d, MetaTv $280), + (e, MetaTv $281), + (f, MetaTv $282)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]]), + ("Layout8", + [(a, MetaTv $283), + (rst, MetaTv $284), + (b, MetaTv $285), + (c, MetaTv $286), + (d, MetaTv $287), + (e, MetaTv $288), + (f, MetaTv $289)], + PrimAppE AddP + [LitE 1, + AppE "blogLength" + [] + [VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlockList, + FunDef {funName = "mkBlockList", + funArgs = [length,base], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy] + (PackedTy "PList" + [PackedTy "Block" + []])), + funBody = IfE (PrimAppE LtEqP + [VarE "length",LitE 0]) + (DataConE (MetaTv $224) "Nil" []) + (IfE (PrimAppE EqIntP + [VarE "base",LitE 0]) + (LetE (item, + [], + MetaTv $228, + DataConE (MetaTv $227) + "Plain" + [AppE "mkInlineList" + [] + [LitE 1000, + LitE 1]]) + (LetE (rst, + [], + MetaTv $226, + AppE "mkBlockList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $225) + "Cons" + [VarE "item", + VarE "rst"]))) + (LetE (item, + [], + MetaTv $232, + DataConE (MetaTv $231) + "Null" + []) + (LetE (rst, + [], + MetaTv $230, + AppE "mkBlockList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $229) + "Cons" + [VarE "item", + VarE "rst"])))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkSomeTags, + FunDef {funName = "mkSomeTags", + funArgs = [len], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = IfE (PrimAppE LtEqP [VarE "len",LitE 0]) + (DataConE (MetaTv $217) "Nil" []) + (LetE (word, + [], + MetaTv $221, + LetE (vec220, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec220", + LitE 0, + CharE 'a']) + (VarE "vec220"))) + (LetE (rst, + [], + MetaTv $219, + AppE "mkSomeTags" + [] + [PrimAppE SubP + [VarE "len", + LitE 1]]) + (DataConE (MetaTv $218) + "Cons" + [VarE "word", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkRandomInlineList, + FunDef {funName = "mkRandomInlineList", + funArgs = [len], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = IfE (PrimAppE LtEqP [VarE "len",LitE 0]) + (DataConE (MetaTv $211) "Nil" []) + (LetE (word, + [], + MetaTv $215, + DataConE (MetaTv $214) + "Str" + [AppE "getRandomString" + [] + [LitE 1]]) + (LetE (rst, + [], + MetaTv $213, + AppE "mkRandomInlineList" + [] + [PrimAppE SubP + [VarE "len", + LitE 1]]) + (DataConE (MetaTv $212) + "Cons" + [VarE "word", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkInlineList', + FunDef {funName = "mkInlineList'", + funArgs = [length,index,words], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy, + VectorTy (VectorTy CharTy)] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "length"]) + (DataConE (MetaTv $205) "Nil" []) + (LetE (item, + [], + MetaTv $209, + DataConE (MetaTv $208) + "Str" + [AppE "nth" + [] + [VarE "words", + VarE "index"]]) + (LetE (rst, + [], + MetaTv $207, + AppE "mkInlineList'" + [] + [VarE "length", + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "words"]) + (DataConE (MetaTv $206) + "Cons" + [VarE "item", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkInlineList, + FunDef {funName = "mkInlineList", + funArgs = [length,base], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = IfE (PrimAppE LtEqP + [VarE "length",LitE 0]) + (DataConE (MetaTv $194) "Nil" []) + (IfE (PrimAppE EqIntP + [VarE "base",LitE 0]) + (LetE (item, + [], + MetaTv $198, + DataConE (MetaTv $197) + "Emph" + [AppE "mkInlineList" + [] + [LitE 100, + LitE 1]]) + (LetE (rst, + [], + MetaTv $196, + AppE "mkInlineList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $195) + "Cons" + [VarE "item", + VarE "rst"]))) + (LetE (item, + [], + MetaTv $201, + AppE "mkInlineBaseCase" + [] + [PrimAppE ModP + [PrimAppE RandP + [], + LitE 4]]) + (LetE (rst, + [], + MetaTv $200, + AppE "mkInlineList" + [] + [PrimAppE SubP + [VarE "length", + LitE 1], + VarE "base"]) + (DataConE (MetaTv $199) + "Cons" + [VarE "item", + VarE "rst"])))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkInlineBaseCase, + FunDef {funName = "mkInlineBaseCase", + funArgs = [option], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "Inline" [])), + funBody = IfE (PrimAppE EqIntP + [VarE "option",LitE 0]) + (DataConE (MetaTv $190) + "Str" + [AppE "getRandomString" + [] + [LitE 5]]) + (DataConE (MetaTv $191) "Space" []), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkContentFromText, + FunDef {funName = "mkContentFromText", + funArgs = [f], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogContent" + [])), + funBody = LetE (block, + [], + MetaTv $188, + AppE "fileToContent" + [] + [VarE "f", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "f", + LitE 0]], + DataConE (MetaTv $186) + "Nil" + [], + LitE 1, + PrimAppE (VLengthP (MetaTv $187)) + [VarE "f"]]) + (LetE (content, + [], + MetaTv $185, + AppE "mkBlogContent" + [] + [VarE "block"]) + (VarE "content")), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkTagsFromText, + FunDef {funName = "mkTagsFromText", + funArgs = [f'], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogTags" [])), + funBody = LetE (tags, + [], + MetaTv $183, + AppE "fileToTags" + [] + [VarE "f'", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "f'", + LitE 0]], + LitE 1, + PrimAppE (VLengthP (MetaTv $182)) + [VarE "f'"]]) + (LetE (tags', + [], + MetaTv $181, + DataConE (MetaTv $180) + "TagList" + [VarE "tags"]) + (VarE "tags'")), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (fileToTags, + FunDef {funName = "fileToTags", + funArgs = [file,word,index,max_len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy,IntTy, + IntTy] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "max_len"]) + (DataConE (MetaTv $174) "Nil" []) + (LetE (character, + [], + CharTy, + AppE "nth" + [] + [VarE "file", + VarE "index"]) + (LetE (isSpace, + [], + MetaTv $178, + IfE (PrimAppE EqCharP + [VarE "character", + AppE "head" + [] + [LetE (vec177, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec177", + LitE 0, + CharE ' ']) + (VarE "vec177"))]]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse + [])) + (LetE (char_vec, + [], + MetaTv $176, + AppE "singleton" + [] + [VarE "character"]) + (IfE (VarE "isSpace") + (DataConE (MetaTv $175) + "Cons" + [VarE "word", + AppE "fileToTags" + [] + [VarE "file", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "file", + PrimAppE AddP + [VarE "index", + LitE 1]]], + PrimAppE AddP + [VarE "index", + LitE 2], + VarE "max_len"]]) + (AppE "fileToTags" + [] + [VarE "file", + AppE "append" + [] + [VarE "word", + VarE "char_vec"], + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "max_len"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (printWordList, + FunDef {funName = "printWordList", + funArgs = [vec,start,end], + funTy = ForAll [] + (ArrowTy [VectorTy (VectorTy CharTy), + IntTy,IntTy] + (ProdTy [])), + funBody = IfE (PrimAppE LtP + [VarE "start",VarE "end"]) + (LetE (element, + [], + MetaTv $169, + AppE "nth" + [] + [VarE "vec", + VarE "start"]) + (LetE (wildcard_167, + [], + MetaTv $168, + AppE "printVec" + [] + [Ext (LambdaE [(i, + MetaTv $166)] + (PrimAppE PrintChar + [VarE "i"])), + VarE "element"]) + (AppE "printWordList" + [] + [VarE "vec", + PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end"]))) + (MkProdE []), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (fileToContent', + FunDef {funName = "fileToContent'", + funArgs = [file,word,running_list,index,max_len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + VectorTy (VectorTy CharTy), + IntTy,IntTy] + (VectorTy (VectorTy CharTy))), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "max_len"]) + (AppE "append" + [] + [VarE "running_list", + PrimAppE (VAllocP (MetaTv $158)) + [LitE 0]]) + (LetE (character, + [], + CharTy, + AppE "nth" + [] + [VarE "file", + VarE "index"]) + (LetE (isSpace, + [], + MetaTv $162, + IfE (PrimAppE EqCharP + [VarE "character", + AppE "head" + [] + [LetE (vec161, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec161", + LitE 0, + CharE ' ']) + (VarE "vec161"))]]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse + [])) + (LetE (char_vec, + [], + MetaTv $160, + AppE "singleton" + [] + [VarE "character"]) + (IfE (VarE "isSpace") + (AppE "fileToContent'" + [] + [VarE "file", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "file", + PrimAppE AddP + [VarE "index", + LitE 1]]], + AppE "append" + [] + [VarE "running_list", + AppE "generate" + [] + [LitE 1, + Ext (LambdaE [(i, + MetaTv $159)] + (VarE "word"))]], + PrimAppE AddP + [VarE "index", + LitE 2], + VarE "max_len"]) + (AppE "fileToContent'" + [] + [VarE "file", + AppE "append" + [] + [VarE "word", + VarE "char_vec"], + VarE "running_list", + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "max_len"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (fileToContent, + FunDef {funName = "fileToContent", + funArgs = [file,word,plist_inline,index,max_len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + PackedTy "PList" + [PackedTy "Inline" + []], + IntTy,IntTy] + (PackedTy "Block" [])), + funBody = IfE (PrimAppE GtEqP + [VarE "index", + VarE "max_len"]) + (DataConE (MetaTv $147) + "Plain" + [VarE "plist_inline"]) + (LetE (character, + [], + CharTy, + AppE "nth" + [] + [VarE "file", + VarE "index"]) + (LetE (isSpace, + [], + MetaTv $152, + IfE (PrimAppE EqCharP + [VarE "character", + AppE "head" + [] + [LetE (vec151, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) + [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec151", + LitE 0, + CharE ' ']) + (VarE "vec151"))]]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse + [])) + (LetE (char_vec, + [], + MetaTv $150, + AppE "singleton" + [] + [VarE "character"]) + (IfE (VarE "isSpace") + (AppE "fileToContent" + [] + [VarE "file", + AppE "singleton" + [] + [AppE "nth" + [] + [VarE "file", + PrimAppE AddP + [VarE "index", + LitE 1]]], + DataConE (MetaTv $148) + "Cons" + [DataConE (MetaTv $149) + "Str" + [VarE "word"], + VarE "plist_inline"], + PrimAppE AddP + [VarE "index", + LitE 2], + VarE "max_len"]) + (AppE "fileToContent" + [] + [VarE "file", + AppE "append" + [] + [VarE "word", + VarE "char_vec"], + VarE "plist_inline", + PrimAppE AddP + [VarE "index", + LitE 1], + VarE "max_len"]))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchBlogContent, + FunDef {funName = "searchBlogContent", + funArgs = [keyword,content], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogContent" []] + BoolTy), + funBody = CaseE (VarE "content") + [("Content", + [(block, MetaTv $141)], + AppE "isKeywordPresentInBlock" + [] + [VarE "keyword", + VarE "block"])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeBlogContent, + FunDef {funName = "emphasizeBlogContent", + funArgs = [keyword,oldContent], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogContent" []] + (PackedTy "BlogContent" + [])), + funBody = CaseE (VarE "oldContent") + [("Content", + [(block, MetaTv $138)], + DataConE (MetaTv $137) + "Content" + [AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeBlogContent', + FunDef {funName = "emphasizeBlogContent'", + funArgs = [keyword,oldContent], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogContent" []] + (PackedTy "BlogContent" + [])), + funBody = CaseE (VarE "oldContent") + [("Content", + [(block, MetaTv $134)], + DataConE (MetaTv $133) + "Content" + [AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (insertBlogTags, + FunDef {funName = "insertBlogTags", + funArgs = [keyword,tags], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogTags" []] + (PackedTy "BlogTags" [])), + funBody = CaseE (VarE "tags") + [("TagList", + [(list, MetaTv $130)], + DataConE (MetaTv $129) + "TagList" + [AppE "insertTagList" + [] + [VarE "keyword", + VarE "list"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (deleteBlogTags, + FunDef {funName = "deleteBlogTags", + funArgs = [keyword,tags], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogTags" []] + (PackedTy "BlogTags" [])), + funBody = CaseE (VarE "tags") + [("TagList", + [(list, MetaTv $126)], + DataConE (MetaTv $125) + "TagList" + [AppE "deleteTagList" + [] + [VarE "keyword", + VarE "list"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchBlogTags, + FunDef {funName = "searchBlogTags", + funArgs = [keyword,tags], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "BlogTags" []] + BoolTy), + funBody = CaseE (VarE "tags") + [("TagList", + [(list, MetaTv $122)], + AppE "searchTagList" + [] + [VarE "keyword", + VarE "list"])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeKeywordInBlockList, + FunDef {funName = "emphasizeKeywordInBlockList", + funArgs = [keyword,block_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Block" + []]] + (PackedTy "PList" + [PackedTy "Block" + []])), + funBody = CaseE (VarE "block_list") + [("Nil", + [], + DataConE (MetaTv $114) "Nil" []), + ("Cons", + [(block, MetaTv $118), + (rst, MetaTv $119)], + LetE (newBlock, + [], + MetaTv $117, + AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]) + (LetE (rst', + [], + MetaTv $116, + AppE "emphasizeKeywordInBlockList" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $115) + "Cons" + [VarE "newBlock", + VarE "rst'"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeInlineListForKeyword, + FunDef {funName = "emphasizeInlineListForKeyword", + funArgs = [keyword,inline_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Inline" + []]] + (PackedTy "PList" + [PackedTy "Inline" + []])), + funBody = CaseE (VarE "inline_list") + [("Nil", + [], + DataConE (MetaTv $106) "Nil" []), + ("Cons", + [(inline, MetaTv $110), + (rst, MetaTv $111)], + LetE (newinline, + [], + MetaTv $109, + AppE "emphasizeKeywordInline" + [] + [VarE "keyword", + VarE "inline"]) + (LetE (rst', + [], + MetaTv $108, + AppE "emphasizeInlineListForKeyword" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $107) + "Cons" + [VarE "newinline", + VarE "rst'"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (emphasizeKeywordInline, + FunDef {funName = "emphasizeKeywordInline", + funArgs = [keyword,inline], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Inline" []] + (PackedTy "Inline" [])), + funBody = CaseE (VarE "inline") + [("Str", + [(text, MetaTv $100)], + LetE (isSame, + [], + MetaTv $99, + AppE "compareWord" + [] + [VarE "keyword", + VarE "text"]) + (IfE (VarE "isSame") + (LetE (newlist, + [], + PackedTy "PList" + [PackedTy "Inline" + []], + DataConE (MetaTv $96) + "Cons" + [Ext (CopyPacked (MetaTv $97) + (VarE "inline")), + DataConE (MetaTv $98) + "Nil" + []]) + (DataConE (MetaTv $95) + "Emph" + [VarE "newlist"])) + (VarE "inline"))), + ("Emph", + [(list_inline, MetaTv $102)], + DataConE (MetaTv $101) + "Emph" + [AppE "emphasizeInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]]), + ("Space", + [], + DataConE (MetaTv $103) + "Space" + [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchInlineListForKeyword, + FunDef {funName = "searchInlineListForKeyword", + funArgs = [keyword,inline_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Inline" + []]] + BoolTy), + funBody = CaseE (VarE "inline_list") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(inline, MetaTv $86), + (rst, MetaTv $87)], + PrimAppE OrP + [AppE "isKeywordPresentInline" + [] + [VarE "keyword", + VarE "inline"], + AppE "searchInlineListForKeyword" + [] + [VarE "keyword", + VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchBlockListForKeyword, + FunDef {funName = "searchBlockListForKeyword", + funArgs = [keyword,block_list], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [PackedTy "Block" + []]] + BoolTy), + funBody = CaseE (VarE "block_list") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(block, MetaTv $82), + (rst, MetaTv $83)], + PrimAppE OrP + [AppE "isKeywordPresentInBlock" + [] + [VarE "keyword", + VarE "block"], + AppE "searchBlockListForKeyword" + [] + [VarE "keyword", + VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (isKeywordPresentInline, + FunDef {funName = "isKeywordPresentInline", + funArgs = [keyword,inline], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Inline" []] + BoolTy), + funBody = CaseE (VarE "inline") + [("Str", + [(text, MetaTv $78)], + AppE "compareWord" + [] + [VarE "keyword", + VarE "text"]), + ("Emph", + [(list_inline, MetaTv $79)], + AppE "searchInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]), + ("Space", + [], + PrimAppE MkFalse [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (isKeywordPresentInBlock, + FunDef {funName = "isKeywordPresentInBlock", + funArgs = [keyword,contentBlock], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Block" []] + BoolTy), + funBody = CaseE (VarE "contentBlock") + [("Plain", + [(list_inline, MetaTv $75)], + AppE "searchInlineListForKeyword" + [] + [VarE "keyword", + VarE "list_inline"]), + ("Null", + [], + PrimAppE MkFalse [])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (insertTagList, + FunDef {funName = "insertTagList", + funArgs = [keyword,taglist], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [VectorTy CharTy]] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = CaseE (VarE "taglist") + [("Nil", + [], + DataConE (MetaTv $69) + "Cons" + [VarE "keyword", + DataConE (MetaTv $70) + "Nil" + []]), + ("Cons", + [(word, MetaTv $71), + (rst, MetaTv $72)], + AppE "insertTagList" + [] + [VarE "keyword", + VarE "rst"])], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (deleteTagList, + FunDef {funName = "deleteTagList", + funArgs = [keyword,taglist], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [VectorTy CharTy]] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = CaseE (VarE "taglist") + [("Nil", + [], + DataConE (MetaTv $63) "Nil" []), + ("Cons", + [(word, MetaTv $65), + (rst, MetaTv $66)], + IfE (AppE "compareWord" + [] + [VarE "keyword", + VarE "word"]) + (AppE "deleteTagList" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $64) + "Cons" + [VarE "word", + AppE "deleteTagList" + [] + [VarE "keyword", + VarE "rst"]]))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (searchTagList, + FunDef {funName = "searchTagList", + funArgs = [keyword,taglist], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "PList" + [VectorTy CharTy]] + BoolTy), + funBody = CaseE (VarE "taglist") + [("Nil", [], PrimAppE MkFalse []), + ("Cons", + [(word, MetaTv $59), + (rst, MetaTv $60)], + PrimAppE OrP + [AppE "compareWord" + [] + [VarE "keyword", + VarE "word"], + AppE "searchTagList" + [] + [VarE "keyword", + VarE "rst"]])], + funMeta = FunMeta {funRec = NotRec, + funInline = Inline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (cmp, + FunDef {funName = "cmp", + funArgs = [start,end,word1,word2], + funTy = ForAll [] + (ArrowTy [IntTy,IntTy, + VectorTy CharTy, + VectorTy CharTy] + BoolTy), + funBody = IfE (PrimAppE LtP + [VarE "start",VarE "end"]) + (LetE (a, + [], + MetaTv $56, + AppE "nth" + [] + [VarE "word1", + VarE "start"]) + (LetE (b, + [], + MetaTv $55, + AppE "nth" + [] + [VarE "word2", + VarE "start"]) + (LetE (eq, + [], + MetaTv $54, + IfE (PrimAppE EqCharP + [VarE "a", + VarE "b"]) + (PrimAppE MkTrue + []) + (PrimAppE MkFalse + [])) + (LetE (recurse, + [], + MetaTv $53, + AppE "cmp" + [] + [PrimAppE AddP + [VarE "start", + LitE 1], + VarE "end", + VarE "word1", + VarE "word2"]) + (PrimAppE AndP + [VarE "eq", + VarE "recurse"]))))) + (PrimAppE MkTrue []), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (compareWord, + FunDef {funName = "compareWord", + funArgs = [word1,word2], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy] + BoolTy), + funBody = LetE (len1, + [], + MetaTv $48, + AppE "length" [] [VarE "word1"]) + (LetE (len2, + [], + MetaTv $47, + AppE "length" + [] + [VarE "word2"]) + (LetE (compare_len, + [], + MetaTv $46, + IfE (PrimAppE EqIntP + [VarE "len1", + VarE "len2"]) + (PrimAppE MkTrue + []) + (PrimAppE MkFalse + [])) + (IfE (VarE "compare_len") + (AppE "cmp" + [] + [LitE 0, + VarE "len1", + VarE "word1", + VarE "word2"]) + (PrimAppE MkFalse + [])))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (checkBlogID, + FunDef {funName = "checkBlogID", + funArgs = [id,val], + funTy = ForAll [] + (ArrowTy [PackedTy "BlogId" [], + IntTy] + BoolTy), + funBody = CaseE (VarE "id") + [("ID", + [(x, MetaTv $43)], + IfE (PrimAppE EqIntP + [VarE "x", + VarE "val"]) + (PrimAppE MkTrue []) + (PrimAppE MkFalse []))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkListFiles, + FunDef {funName = "mkListFiles", + funArgs = [f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,len], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy,IntTy] + (PackedTy "PList" + [VectorTy CharTy])), + funBody = IfE (PrimAppE LtP [VarE "len",LitE 0]) + (DataConE (MetaTv $37) "Nil" []) + (LetE (f, + [], + MetaTv $40, + AppE "getFile" + [] + [VarE "f1",VarE "f2", + VarE "f3",VarE "f4", + VarE "f5",VarE "f6", + VarE "f7",VarE "f8", + VarE "f9",VarE "f10", + VarE "len"]) + (LetE (rst, + [], + MetaTv $39, + AppE "mkListFiles" + [] + [VarE "f1", + VarE "f2", + VarE "f3", + VarE "f4", + VarE "f5", + VarE "f6", + VarE "f7", + VarE "f8", + VarE "f9", + VarE "f10", + PrimAppE SubP + [VarE "len", + LitE 1]]) + (DataConE (MetaTv $38) + "Cons" + [VarE "f", + VarE "rst"]))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (getFile, + FunDef {funName = "getFile", + funArgs = [f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,select], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy, + VectorTy CharTy,IntTy] + (VectorTy CharTy)), + funBody = IfE (PrimAppE EqIntP + [VarE "select",LitE 0]) + (VarE "f1") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 1]) + (VarE "f2") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 2]) + (VarE "f3") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 3]) + (VarE "f4") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 4]) + (VarE "f5") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 5]) + (VarE "f6") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 6]) + (VarE "f7") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 7]) + (VarE "f8") + (IfE (PrimAppE EqIntP + [VarE "select", + LitE 8]) + (VarE "f9") + (VarE "f10"))))))))), + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogTags, + FunDef {funName = "mkBlogTags", + funArgs = [taglist], + funTy = ForAll [] + (ArrowTy [PackedTy "PList" + [VectorTy CharTy]] + (PackedTy "BlogTags" [])), + funBody = DataConE (MetaTv $14) + "TagList" + [VarE "taglist"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogContent, + FunDef {funName = "mkBlogContent", + funArgs = [block], + funTy = ForAll [] + (ArrowTy [PackedTy "Block" []] + (PackedTy "BlogContent" + [])), + funBody = DataConE (MetaTv $12) + "Content" + [VarE "block"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogDate, + FunDef {funName = "mkBlogDate", + funArgs = [text], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogDate" [])), + funBody = DataConE (MetaTv $10) + "Date" + [VarE "text"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogAuthor, + FunDef {funName = "mkBlogAuthor", + funArgs = [text], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogAuthor" + [])), + funBody = DataConE (MetaTv $8) + "Author" + [VarE "text"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogID, + FunDef {funName = "mkBlogID", + funArgs = [val], + funTy = ForAll [] + (ArrowTy [IntTy] + (PackedTy "BlogId" [])), + funBody = DataConE (MetaTv $6) "ID" [VarE "val"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkBlogHeader, + FunDef {funName = "mkBlogHeader", + funArgs = [text], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy] + (PackedTy "BlogHeader" + [])), + funBody = DataConE (MetaTv $4) + "Header" + [VarE "text"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (getRandomString, + FunDef {funName = "getRandomString", + funArgs = [length], + funTy = ForAll [] + (ArrowTy [IntTy] (VectorTy CharTy)), + funBody = AppE "generate" + [] + [VarE "length",VarE "mkChar"], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}}), + (mkChar, + FunDef {funName = "mkChar", + funArgs = [val], + funTy = ForAll [] (ArrowTy [IntTy] CharTy), + funBody = AppE "getChar" + [] + [PrimAppE ModP + [PrimAppE RandP [], + LitE 26]], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Nothing}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 1 4 22, srcInfoPoints = [SrcSpan ".hs" 4 1 4 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 8 4 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, + ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 1 5 20, srcInfoPoints = [SrcSpan ".hs" 5 1 5 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 8 5 20, srcInfoPoints = []}) "Gibbon.PList", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, + ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 1 6 21, srcInfoPoints = [SrcSpan ".hs" 6 1 6 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 8 6 21, srcInfoPoints = []}) "Gibbon.Vector", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}]] + (ProgModule "Main" + (Prog + {ddefs = [], + fundefs = [(emphKeywordInContent, + FunDef {funName = "emphKeywordInContent", + funArgs = [keyword,blogs], + funTy = ForAll [] + (ArrowTy [VectorTy CharTy, + PackedTy "Blog" []] + (PackedTy "Blog" [])), + funBody = CaseE (VarE "blogs") + [("End", + [], + DataConE (MetaTv $2) "End" []), + ("Layout1", + [(header, MetaTv $8), + (id, MetaTv $9), + (author, MetaTv $10), + (date, MetaTv $11), + (content, MetaTv $12), + (tags, MetaTv $13), + (rst, MetaTv $14)], + LetE (newContent, + [], + MetaTv $7, + CaseE (VarE "content") + [("Content", + [(block, + MetaTv $6)], + DataConE (MetaTv $5) + "Content" + [AppE "emphasizeKeywordInBlock" + [] + [VarE "keyword", + VarE "block"]])]) + (LetE (newRst, + [], + MetaTv $4, + AppE "emphKeywordInContent" + [] + [VarE "keyword", + VarE "rst"]) + (DataConE (MetaTv $3) + "Layout1" + [VarE "header", + VarE "id", + VarE "author", + VarE "date", + VarE "newContent", + VarE "tags", + VarE "newRst"])))], + funMeta = FunMeta {funRec = NotRec, + funInline = NoInline, + funCanTriggerGC = False, + funOptLayout = NoLayoutOpt, + userConstraintsDataCon = Nothing}})], + mainExp = Just (LetE (blogs, + [], + MetaTv $17, + AppE "mkBlogs_layout1" [] [LitE 2]) + (LetE (keyword, + [], + VectorTy CharTy, + LetE (vec16, + [], + VectorTy CharTy, + PrimAppE (VAllocP CharTy) [LitE 1]) + (LetE (_, + [], + VectorTy CharTy, + PrimAppE (InplaceVUpdateP CharTy) + [VarE "vec16",LitE 0, + CharE 'a']) + (VarE "vec16"))) + (LetE (newblgs, + [], + MetaTv $15, + AppE "emphKeywordInContent" + [] + [VarE "keyword",VarE "blogs"]) + (AppE "printBlog" + [] + [VarE "newblgs"]))), + MetaTv $18)}) + [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 14, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Basics", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, + ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 1 3 23, srcInfoPoints = [SrcSpan ".hs" 3 1 3 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 8 3 23, srcInfoPoints = []}) "GenerateLayout1", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}]) + +Typechecked: +================================================================================ +data Inline130 = Str156 Vector Char | + Emph157 (Packed PList72 [(Packed Inline130 [])]) | + Space158 +data Block131 = Plain154 (Packed PList72 [(Packed Inline130 [])]) | + Null155 +data BlogHeader132 = Header153 Vector Char +data BlogId133 = ID152 Int +data BlogAuthor134 = Author151 Vector Char +data BlogDate135 = Date150 Vector Char +data BlogContent136 = Content149 (Packed Block131 []) +data BlogTags137 = TagList148 (Packed PList72 [Vector Char]) +data Blog138 = End139 | + Layout1140 (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogContent136 []) (Packed BlogTags137 []) (Packed Blog138 []) | + Layout2141 (Packed BlogContent136 []) (Packed BlogTags137 []) (Packed Blog138 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | + Layout3142 (Packed BlogTags137 []) (Packed Blog138 []) (Packed BlogContent136 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | + Layout4143 (Packed BlogTags137 []) (Packed BlogContent136 []) (Packed Blog138 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | + Layout5144 (Packed Blog138 []) (Packed BlogTags137 []) (Packed BlogContent136 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | + Layout6145 (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogContent136 []) (Packed Blog138 []) (Packed BlogTags137 []) | + Layout7146 (Packed Blog138 []) (Packed BlogContent136 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogTags137 []) | + Layout8147 (Packed BlogContent136 []) (Packed Blog138 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogHeader132 []) (Packed BlogTags137 []) +data PList72 b:a164 = Nil73 | + Cons74 b:a164 (Packed PList72 [b:a164]) +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlogs_layout11 :: forall. (Int -> (Packed Blog138 [])) +mkBlogs_layout11 length165 = + if <=(length165, 0) + then (End139 ()) + else let header166 :: (Packed BlogHeader132 []) = (Header153 () (getRandomString128 [] 5)) in + let id167 :: (Packed BlogId133 []) = (ID152 () 10 - length165 mod 10) in + let author168 :: (Packed BlogAuthor134 []) = (Author151 () (getRandomString128 [] 5)) in + let date169 :: (Packed BlogDate135 []) = (Date150 () (getRandomString128 [] 5)) in + let content170 :: (Packed BlogContent136 []) = (Content149 () (Plain154 () (mkRandomInlineList91 [] 50))) in + let tags171 :: (Packed BlogTags137 []) = (TagList148 () (mkSomeTags90 [] 10)) in + let rst172 :: (Packed Blog138 []) = (mkBlogs_layout11 [] length165 - 1) in + (Layout1140 () header166 id167 author168 date169 content170 tags171 rst172) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +emphKeywordInContent0 :: forall. (Vector Char -> (Packed Blog138 []) -> (Packed Blog138 [])) +emphKeywordInContent0 keyword173 blogs174 = + case blogs174 of + End139 -> + (End139 ()) + Layout1140 header175::(Packed BlogHeader132 []) id176::(Packed BlogId133 []) author177::(Packed BlogAuthor134 []) date178::(Packed BlogDate135 []) content179::(Packed BlogContent136 []) tags180::(Packed BlogTags137 []) rst181::(Packed Blog138 []) -> + let newContent183 :: (Packed BlogContent136 []) = case content179 of + Content149 block182::(Packed Block131 []) -> + (Content149 () (emphasizeKeywordInBlock75 [] keyword173 block182)) in + let newRst184 :: (Packed Blog138 []) = (emphKeywordInContent0 [] keyword173 rst181) in + (Layout1140 () header175 id176 author177 date178 newContent183 tags180 newRst184) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printBlog76 :: forall. ((Packed Blog138 []) -> ()) +printBlog76 blog185 = + case blog185 of + Layout1140 header186::(Packed BlogHeader132 []) id187::(Packed BlogId133 []) author188::(Packed BlogAuthor134 []) date189::(Packed BlogDate135 []) content190::(Packed BlogContent136 []) tags191::(Packed BlogTags137 []) rst192::(Packed Blog138 []) -> + let wildcard_344193 :: () = printsym("Layout1 ") in + let wildcard_342194 :: () = (printHeader83 [] header186) in + let wildcard_340195 :: () = (printID82 [] id187) in + let wildcard_338196 :: () = (printAuthor84 [] author188) in + let wildcard_336197 :: () = (printDate85 [] date189) in + let wildcard_334198 :: () = (printContent87 [] content190) in + let wildcard_332199 :: () = (printTagList86 [] tags191) in + let wildcard_330200 :: () = (printBlog76 [] rst192) in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +emphasizeKeywordInBlock75 :: forall. (Vector Char -> (Packed Block131 []) -> (Packed Block131 [])) +emphasizeKeywordInBlock75 keyword201 contentBlock202 = + case contentBlock202 of + Plain154 list_inline203::(Packed PList72 [(Packed Inline130 [])]) -> + (Plain154 () (emphasizeInlineListForKeyword108 [] keyword201 list_inline203)) + Null155 -> + (Null155 ()) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +getChar77 :: forall. (Int -> Char) +getChar77 decimal204 = + if decimal204 == 0 + then 'a' + else if decimal204 == 1 + then 'b' + else if decimal204 == 2 + then 'c' + else if decimal204 == 3 + then 'd' + else if decimal204 == 4 + then 'e' + else if decimal204 == 5 + then 'f' + else if decimal204 == 6 + then 'g' + else if decimal204 == 7 + then 'h' + else if decimal204 == 8 + then 'i' + else if decimal204 == 9 + then 'j' + else if decimal204 == 10 + then 'k' + else if decimal204 == 11 + then 'l' + else if decimal204 == 12 + then 'm' + else if decimal204 == 13 + then 'n' + else if decimal204 == 14 + then 'o' + else if decimal204 == 15 + then 'p' + else if decimal204 == 16 + then 'q' + else if decimal204 == 17 + then 'r' + else if decimal204 == 18 + then 's' + else if decimal204 == 19 + then 't' + else if decimal204 == 20 + then 'u' + else if decimal204 == 21 + then 'v' + else if decimal204 == 22 + then 'w' + else if decimal204 == 23 + then 'x' + else if decimal204 == 24 + then 'y' + else 'z' + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printInline78 :: forall. ((Packed Inline130 []) -> ()) +printInline78 inline205 = + case inline205 of + Str156 text206::Vector Char -> + let wildcard_392207 :: () = printsym("Str ") in + let wildcard_390209 :: () = (printVec9 [Char] (\(i208 :: Char) -> + printchar(i208)) text206) in + () + Emph157 plist210::(Packed PList72 [(Packed Inline130 [])]) -> + let wildcard_397211 :: () = printsym("Emph ") in + let wildcard_395212 :: () = (printPlistInline80 [] plist210) in + () + Space158 -> + let wildcard_400213 :: () = printsym("Space ") in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printPlistText79 :: forall. ((Packed PList72 [Vector Char]) -> ()) +printPlistText79 list214 = + case list214 of + Cons74 x215::Vector Char rst216::(Packed PList72 [Vector Char]) -> + let wildcard_382217 :: () = printsym("PList ( Cons ") in + let wildcard_380219 :: () = (printVec9 [Char] (\(i218 :: Char) -> + printchar(i218)) x215) in + let wildcard_377220 :: () = (printPlistText79 [] rst216) in + let wildcard_375221 :: () = printsym(" ) ") in + () + Nil73 -> + let wildcard_386222 :: () = printsym("Nil") in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printPlistInline80 :: forall. ((Packed PList72 [(Packed Inline130 [])]) -> ()) +printPlistInline80 list223 = + case list223 of + Cons74 x224::(Packed Inline130 []) rst225::(Packed PList72 [(Packed Inline130 [])]) -> + let wildcard_368226 :: () = printsym("PList ( Cons ") in + let wildcard_366227 :: () = (printInline78 [] x224) in + let wildcard_364228 :: () = (printPlistInline80 [] rst225) in + let wildcard_362229 :: () = printsym(" ) ") in + () + Nil73 -> + let wildcard_372230 :: () = printsym("Nil") in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printBlock81 :: forall. ((Packed Block131 []) -> ()) +printBlock81 block231 = + case block231 of + Plain154 plist232::(Packed PList72 [(Packed Inline130 [])]) -> + let wildcard_356233 :: () = printsym("Plain ") in + let wildcard_354234 :: () = (printPlistInline80 [] plist232) in + () + Null155 -> + let wildcard_359235 :: () = printsym("Null") in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printID82 :: forall. ((Packed BlogId133 []) -> ()) +printID82 id236 = + case id236 of + ID152 val237::Int -> + let wildcard_326238 :: () = printsym("ID ") in + let wildcard_324239 :: () = printint(val237) in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printHeader83 :: forall. ((Packed BlogHeader132 []) -> ()) +printHeader83 header240 = + case header240 of + Header153 str241::Vector Char -> + let wildcard_320242 :: () = printsym("Header ") in + let wildcard_318244 :: () = (printVec9 [Char] (\(i243 :: Char) -> + printchar(i243)) str241) in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printAuthor84 :: forall. ((Packed BlogAuthor134 []) -> ()) +printAuthor84 date245 = + case date245 of + Author151 str246::Vector Char -> + let wildcard_313247 :: () = printsym("Author ") in + let wildcard_311249 :: () = (printVec9 [Char] (\(i248 :: Char) -> + printchar(i248)) str246) in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printDate85 :: forall. ((Packed BlogDate135 []) -> ()) +printDate85 date250 = + case date250 of + Date150 str251::Vector Char -> + let wildcard_306252 :: () = printsym("Date ") in + let wildcard_304254 :: () = (printVec9 [Char] (\(i253 :: Char) -> + printchar(i253)) str251) in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printTagList86 :: forall. ((Packed BlogTags137 []) -> ()) +printTagList86 tags255 = + case tags255 of + TagList148 plist256::(Packed PList72 [Vector Char]) -> + let wildcard_299257 :: () = printsym("TagList ") in + let wildcard_297258 :: () = (printPlistText79 [] plist256) in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printContent87 :: forall. ((Packed BlogContent136 []) -> ()) +printContent87 content259 = + case content259 of + Content149 block260::(Packed Block131 []) -> + let wildcard_293261 :: () = printsym("Content ") in + let wildcard_291262 :: () = (printBlock81 [] block260) in + () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +blogLength88 :: forall. ((Packed Blog138 []) -> Int) +blogLength88 blog263 = + case blog263 of + End139 -> + 0 + Layout1140 a264::(Packed BlogHeader132 []) b265::(Packed BlogId133 []) c266::(Packed BlogAuthor134 []) d267::(Packed BlogDate135 []) e268::(Packed BlogContent136 []) f269::(Packed BlogTags137 []) rst270::(Packed Blog138 []) -> + 1 + (blogLength88 [] rst270) + Layout2141 a271::(Packed BlogContent136 []) b272::(Packed BlogTags137 []) rst273::(Packed Blog138 []) c274::(Packed BlogHeader132 []) d275::(Packed BlogId133 []) e276::(Packed BlogAuthor134 []) f277::(Packed BlogDate135 []) -> + 1 + (blogLength88 [] rst273) + Layout3142 a278::(Packed BlogTags137 []) rst279::(Packed Blog138 []) b280::(Packed BlogContent136 []) c281::(Packed BlogHeader132 []) d282::(Packed BlogId133 []) e283::(Packed BlogAuthor134 []) f284::(Packed BlogDate135 []) -> + 1 + (blogLength88 [] rst279) + Layout4143 a285::(Packed BlogTags137 []) b286::(Packed BlogContent136 []) rst287::(Packed Blog138 []) d288::(Packed BlogHeader132 []) e289::(Packed BlogId133 []) f290::(Packed BlogAuthor134 []) g291::(Packed BlogDate135 []) -> + 1 + (blogLength88 [] rst287) + Layout5144 rst292::(Packed Blog138 []) a293::(Packed BlogTags137 []) b294::(Packed BlogContent136 []) c295::(Packed BlogHeader132 []) d296::(Packed BlogId133 []) e297::(Packed BlogAuthor134 []) f298::(Packed BlogDate135 []) -> + 1 + (blogLength88 [] rst292) + Layout6145 a299::(Packed BlogHeader132 []) b300::(Packed BlogId133 []) c301::(Packed BlogAuthor134 []) d302::(Packed BlogDate135 []) e303::(Packed BlogContent136 []) rst304::(Packed Blog138 []) f305::(Packed BlogTags137 []) -> + 1 + (blogLength88 [] rst304) + Layout7146 rst306::(Packed Blog138 []) a307::(Packed BlogContent136 []) b308::(Packed BlogHeader132 []) c309::(Packed BlogId133 []) d310::(Packed BlogAuthor134 []) e311::(Packed BlogDate135 []) f312::(Packed BlogTags137 []) -> + 1 + (blogLength88 [] rst306) + Layout8147 a313::(Packed BlogContent136 []) rst314::(Packed Blog138 []) b315::(Packed BlogId133 []) c316::(Packed BlogAuthor134 []) d317::(Packed BlogDate135 []) e318::(Packed BlogHeader132 []) f319::(Packed BlogTags137 []) -> + 1 + (blogLength88 [] rst314) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlockList89 :: forall. (Int -> Int -> (Packed PList72 [(Packed Block131 [])])) +mkBlockList89 length320 base321 = + if <=(length320, 0) + then (Nil73 ((Packed Block131 []))) + else if base321 == 0 + then let item322 :: (Packed Block131 []) = (Plain154 () (mkInlineList93 [] 1000 1)) in + let rst323 :: (Packed PList72 [(Packed Block131 [])]) = (mkBlockList89 [] length320 - 1 base321) in + (Cons74 ((Packed Block131 [])) item322 rst323) + else let item324 :: (Packed Block131 []) = (Null155 ()) in + let rst325 :: (Packed PList72 [(Packed Block131 [])]) = (mkBlockList89 [] length320 - 1 base321) in + (Cons74 ((Packed Block131 [])) item324 rst325) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkSomeTags90 :: forall. (Int -> (Packed PList72 [Vector Char])) +mkSomeTags90 len326 = + if <=(len326, 0) + then (Nil73 (Vector Char)) + else let word329 :: Vector Char = let vec220327 :: Vector Char = (valloc :: [Char])(1) in + let _328 :: Vector Char = inplacevupdate(vec220327, 0, 'a') in + vec220327 in + let rst330 :: (Packed PList72 [Vector Char]) = (mkSomeTags90 [] len326 - 1) in + (Cons74 (Vector Char) word329 rst330) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkRandomInlineList91 :: forall. (Int -> (Packed PList72 [(Packed Inline130 [])])) +mkRandomInlineList91 len331 = + if <=(len331, 0) + then (Nil73 ((Packed Inline130 []))) + else let word332 :: (Packed Inline130 []) = (Str156 () (getRandomString128 [] 1)) in + let rst333 :: (Packed PList72 [(Packed Inline130 [])]) = (mkRandomInlineList91 [] len331 - 1) in + (Cons74 ((Packed Inline130 [])) word332 rst333) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkInlineList_92 :: forall. (Int -> Int -> Vector Vector Char -> (Packed PList72 [(Packed Inline130 [])])) +mkInlineList_92 length334 index335 words336 = + if >=(index335, length334) + then (Nil73 ((Packed Inline130 []))) + else let item337 :: (Packed Inline130 []) = (Str156 () (nth5 [Vector Char] words336 index335)) in + let rst338 :: (Packed PList72 [(Packed Inline130 [])]) = (mkInlineList_92 [] length334 index335 + 1 words336) in + (Cons74 ((Packed Inline130 [])) item337 rst338) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkInlineList93 :: forall. (Int -> Int -> (Packed PList72 [(Packed Inline130 [])])) +mkInlineList93 length339 base340 = + if <=(length339, 0) + then (Nil73 ((Packed Inline130 []))) + else if base340 == 0 + then let item341 :: (Packed Inline130 []) = (Emph157 () (mkInlineList93 [] 100 1)) in + let rst342 :: (Packed PList72 [(Packed Inline130 [])]) = (mkInlineList93 [] length339 - 1 base340) in + (Cons74 ((Packed Inline130 [])) item341 rst342) + else let item343 :: (Packed Inline130 []) = (mkInlineBaseCase94 [] rand() mod 4) in + let rst344 :: (Packed PList72 [(Packed Inline130 [])]) = (mkInlineList93 [] length339 - 1 base340) in + (Cons74 ((Packed Inline130 [])) item343 rst344) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkInlineBaseCase94 :: forall. (Int -> (Packed Inline130 [])) +mkInlineBaseCase94 option345 = + if option345 == 0 + then (Str156 () (getRandomString128 [] 5)) + else (Space158 ()) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkContentFromText95 :: forall. (Vector Char -> (Packed BlogContent136 [])) +mkContentFromText95 f346 = + let block347 :: (Packed Block131 []) = (fileToContent100 [] f346 (singleton6 [Char] (nth5 [Char] f346 0)) (Nil73 ((Packed Inline130 []))) 1 vlength(f346)) in + let content348 :: (Packed BlogContent136 []) = (mkBlogContent123 [] block347) in + content348 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkTagsFromText96 :: forall. (Vector Char -> (Packed BlogTags137 [])) +mkTagsFromText96 f_349 = + let tags350 :: (Packed PList72 [Vector Char]) = (fileToTags97 [] f_349 (singleton6 [Char] (nth5 [Char] f_349 0)) 1 vlength(f_349)) in + let tags_351 :: (Packed BlogTags137 []) = (TagList148 () tags350) in + tags_351 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +fileToTags97 :: forall. (Vector Char -> Vector Char -> Int -> Int -> (Packed PList72 [Vector Char])) +fileToTags97 file352 word353 index354 max_len355 = + if >=(index354, max_len355) + then (Nil73 (Vector Char)) + else let character356 :: Char = (nth5 [Char] file352 index354) in + let isSpace359 :: Bool = if *==*(character356, (head8 [Char] let vec177357 :: Vector Char = (valloc :: [Char])(1) in + let _358 :: Vector Char = inplacevupdate(vec177357, 0, ' ') in + vec177357)) + then True + else False in + let char_vec360 :: Vector Char = (singleton6 [Char] character356) in + if isSpace359 + then (Cons74 (Vector Char) word353 (fileToTags97 [] file352 (singleton6 [Char] (nth5 [Char] file352 index354 + 1)) index354 + 2 max_len355)) + else (fileToTags97 [] file352 (append7 [Char] word353 char_vec360) index354 + 1 max_len355) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printWordList98 :: forall. (Vector Vector Char -> Int -> Int -> ()) +printWordList98 vec361 start362 end363 = + if start362 < end363 + then let element364 :: Vector Char = (nth5 [Vector Char] vec361 start362) in + let wildcard_167366 :: () = (printVec9 [Char] (\(i365 :: Char) -> + printchar(i365)) element364) in + (printWordList98 [] vec361 start362 + 1 end363) + else () + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +fileToContent_99 :: forall. (Vector Char -> Vector Char -> Vector Vector Char -> Int -> Int -> Vector Vector Char) +fileToContent_99 file367 word368 running_list369 index370 max_len371 = + if >=(index370, max_len371) + then (append7 [Vector Char] running_list369 (valloc :: [Vector Char])(0)) + else let character372 :: Char = (nth5 [Char] file367 index370) in + let isSpace375 :: Bool = if *==*(character372, (head8 [Char] let vec161373 :: Vector Char = (valloc :: [Char])(1) in + let _374 :: Vector Char = inplacevupdate(vec161373, 0, ' ') in + vec161373)) + then True + else False in + let char_vec376 :: Vector Char = (singleton6 [Char] character372) in + if isSpace375 + then (fileToContent_99 [] file367 (singleton6 [Char] (nth5 [Char] file367 index370 + 1)) (append7 [Vector Char] running_list369 (generate2 [Vector Char] 1 (\(i377 :: Int) -> + word368))) index370 + 2 max_len371) + else (fileToContent_99 [] file367 (append7 [Char] word368 char_vec376) running_list369 index370 + 1 max_len371) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +fileToContent100 :: forall. (Vector Char -> Vector Char -> (Packed PList72 [(Packed Inline130 [])]) -> Int -> Int -> (Packed Block131 [])) +fileToContent100 file378 word379 plist_inline380 index381 max_len382 = + if >=(index381, max_len382) + then (Plain154 () plist_inline380) + else let character383 :: Char = (nth5 [Char] file378 index381) in + let isSpace386 :: Bool = if *==*(character383, (head8 [Char] let vec151384 :: Vector Char = (valloc :: [Char])(1) in + let _385 :: Vector Char = inplacevupdate(vec151384, 0, ' ') in + vec151384)) + then True + else False in + let char_vec387 :: Vector Char = (singleton6 [Char] character383) in + if isSpace386 + then (fileToContent100 [] file378 (singleton6 [Char] (nth5 [Char] file378 index381 + 1)) (Cons74 ((Packed Inline130 [])) (Str156 () word379) plist_inline380) index381 + 2 max_len382) + else (fileToContent100 [] file378 (append7 [Char] word379 char_vec387) plist_inline380 index381 + 1 max_len382) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +searchBlogContent101 :: forall. (Vector Char -> (Packed BlogContent136 []) -> Bool) +searchBlogContent101 keyword388 content389 = + case content389 of + Content149 block390::(Packed Block131 []) -> + (isKeywordPresentInBlock113 [] keyword388 block390) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +emphasizeBlogContent102 :: forall. (Vector Char -> (Packed BlogContent136 []) -> (Packed BlogContent136 [])) +emphasizeBlogContent102 keyword391 oldContent392 = + case oldContent392 of + Content149 block393::(Packed Block131 []) -> + (Content149 () (emphasizeKeywordInBlock75 [] keyword391 block393)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +emphasizeBlogContent_103 :: forall. (Vector Char -> (Packed BlogContent136 []) -> (Packed BlogContent136 [])) +emphasizeBlogContent_103 keyword394 oldContent395 = + case oldContent395 of + Content149 block396::(Packed Block131 []) -> + (Content149 () (emphasizeKeywordInBlock75 [] keyword394 block396)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +insertBlogTags104 :: forall. (Vector Char -> (Packed BlogTags137 []) -> (Packed BlogTags137 [])) +insertBlogTags104 keyword397 tags398 = + case tags398 of + TagList148 list399::(Packed PList72 [Vector Char]) -> + (TagList148 () (insertTagList114 [] keyword397 list399)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +deleteBlogTags105 :: forall. (Vector Char -> (Packed BlogTags137 []) -> (Packed BlogTags137 [])) +deleteBlogTags105 keyword400 tags401 = + case tags401 of + TagList148 list402::(Packed PList72 [Vector Char]) -> + (TagList148 () (deleteTagList115 [] keyword400 list402)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +searchBlogTags106 :: forall. (Vector Char -> (Packed BlogTags137 []) -> Bool) +searchBlogTags106 keyword403 tags404 = + case tags404 of + TagList148 list405::(Packed PList72 [Vector Char]) -> + (searchTagList116 [] keyword403 list405) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +emphasizeKeywordInBlockList107 :: forall. (Vector Char -> (Packed PList72 [(Packed Block131 [])]) -> (Packed PList72 [(Packed Block131 [])])) +emphasizeKeywordInBlockList107 keyword406 block_list407 = + case block_list407 of + Nil73 -> + (Nil73 ((Packed Block131 []))) + Cons74 block408::(Packed Block131 []) rst409::(Packed PList72 [(Packed Block131 [])]) -> + let newBlock410 :: (Packed Block131 []) = (emphasizeKeywordInBlock75 [] keyword406 block408) in + let rst_411 :: (Packed PList72 [(Packed Block131 [])]) = (emphasizeKeywordInBlockList107 [] keyword406 rst409) in + (Cons74 ((Packed Block131 [])) newBlock410 rst_411) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +emphasizeInlineListForKeyword108 :: forall. (Vector Char -> (Packed PList72 [(Packed Inline130 [])]) -> (Packed PList72 [(Packed Inline130 [])])) +emphasizeInlineListForKeyword108 keyword412 inline_list413 = + case inline_list413 of + Nil73 -> + (Nil73 ((Packed Inline130 []))) + Cons74 inline414::(Packed Inline130 []) rst415::(Packed PList72 [(Packed Inline130 [])]) -> + let newinline416 :: (Packed Inline130 []) = (emphasizeKeywordInline109 [] keyword412 inline414) in + let rst_417 :: (Packed PList72 [(Packed Inline130 [])]) = (emphasizeInlineListForKeyword108 [] keyword412 rst415) in + (Cons74 ((Packed Inline130 [])) newinline416 rst_417) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +emphasizeKeywordInline109 :: forall. (Vector Char -> (Packed Inline130 []) -> (Packed Inline130 [])) +emphasizeKeywordInline109 keyword418 inline419 = + case inline419 of + Str156 text420::Vector Char -> + let isSame421 :: Bool = (compareWord118 [] keyword418 text420) in + if isSame421 + then let newlist422 :: (Packed PList72 [(Packed Inline130 [])]) = (Cons74 ((Packed Inline130 [])) copyPacked (inline419::(Packed Inline130 [])) (Nil73 ((Packed Inline130 [])))) in + (Emph157 () newlist422) + else inline419 + Emph157 list_inline423::(Packed PList72 [(Packed Inline130 [])]) -> + (Emph157 () (emphasizeInlineListForKeyword108 [] keyword418 list_inline423)) + Space158 -> + (Space158 ()) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +searchInlineListForKeyword110 :: forall. (Vector Char -> (Packed PList72 [(Packed Inline130 [])]) -> Bool) +searchInlineListForKeyword110 keyword424 inline_list425 = + case inline_list425 of + Nil73 -> + False + Cons74 inline426::(Packed Inline130 []) rst427::(Packed PList72 [(Packed Inline130 [])]) -> + ||((isKeywordPresentInline112 [] keyword424 inline426), (searchInlineListForKeyword110 [] keyword424 rst427)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +searchBlockListForKeyword111 :: forall. (Vector Char -> (Packed PList72 [(Packed Block131 [])]) -> Bool) +searchBlockListForKeyword111 keyword428 block_list429 = + case block_list429 of + Nil73 -> + False + Cons74 block430::(Packed Block131 []) rst431::(Packed PList72 [(Packed Block131 [])]) -> + ||((isKeywordPresentInBlock113 [] keyword428 block430), (searchBlockListForKeyword111 [] keyword428 rst431)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +isKeywordPresentInline112 :: forall. (Vector Char -> (Packed Inline130 []) -> Bool) +isKeywordPresentInline112 keyword432 inline433 = + case inline433 of + Str156 text434::Vector Char -> + (compareWord118 [] keyword432 text434) + Emph157 list_inline435::(Packed PList72 [(Packed Inline130 [])]) -> + (searchInlineListForKeyword110 [] keyword432 list_inline435) + Space158 -> + False + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +isKeywordPresentInBlock113 :: forall. (Vector Char -> (Packed Block131 []) -> Bool) +isKeywordPresentInBlock113 keyword436 contentBlock437 = + case contentBlock437 of + Plain154 list_inline438::(Packed PList72 [(Packed Inline130 [])]) -> + (searchInlineListForKeyword110 [] keyword436 list_inline438) + Null155 -> + False + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +insertTagList114 :: forall. (Vector Char -> (Packed PList72 [Vector Char]) -> (Packed PList72 [Vector Char])) +insertTagList114 keyword439 taglist440 = + case taglist440 of + Nil73 -> + (Cons74 (Vector Char) keyword439 (Nil73 (Vector Char))) + Cons74 word441::Vector Char rst442::(Packed PList72 [Vector Char]) -> + (insertTagList114 [] keyword439 rst442) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +deleteTagList115 :: forall. (Vector Char -> (Packed PList72 [Vector Char]) -> (Packed PList72 [Vector Char])) +deleteTagList115 keyword443 taglist444 = + case taglist444 of + Nil73 -> + (Nil73 (Vector Char)) + Cons74 word445::Vector Char rst446::(Packed PList72 [Vector Char]) -> + if (compareWord118 [] keyword443 word445) + then (deleteTagList115 [] keyword443 rst446) + else (Cons74 (Vector Char) word445 (deleteTagList115 [] keyword443 rst446)) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +searchTagList116 :: forall. (Vector Char -> (Packed PList72 [Vector Char]) -> Bool) +searchTagList116 keyword447 taglist448 = + case taglist448 of + Nil73 -> + False + Cons74 word449::Vector Char rst450::(Packed PList72 [Vector Char]) -> + ||((compareWord118 [] keyword447 word449), (searchTagList116 [] keyword447 rst450)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +cmp117 :: forall. (Int -> Int -> Vector Char -> Vector Char -> Bool) +cmp117 start451 end452 word1453 word2454 = + if start451 < end452 + then let a455 :: Char = (nth5 [Char] word1453 start451) in + let b456 :: Char = (nth5 [Char] word2454 start451) in + let eq457 :: Bool = if *==*(a455, b456) + then True + else False in + let recurse458 :: Bool = (cmp117 [] start451 + 1 end452 word1453 word2454) in + &&(eq457, recurse458) + else True + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +compareWord118 :: forall. (Vector Char -> Vector Char -> Bool) +compareWord118 word1459 word2460 = + let len1461 :: Int = (length3 [Char] word1459) in + let len2462 :: Int = (length3 [Char] word2460) in + let compare_len463 :: Bool = if len1461 == len2462 + then True + else False in + if compare_len463 + then (cmp117 [] 0 len1461 word1459 word2460) + else False + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +checkBlogID119 :: forall. ((Packed BlogId133 []) -> Int -> Bool) +checkBlogID119 id464 val465 = + case id464 of + ID152 x466::Int -> + if x466 == val465 + then True + else False + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkListFiles120 :: forall. (Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Int -> (Packed PList72 [Vector Char])) +mkListFiles120 f1467 f2468 f3469 f4470 f5471 f6472 f7473 f8474 f9475 f10476 len477 = + if len477 < 0 + then (Nil73 (Vector Char)) + else let f478 :: Vector Char = (getFile121 [] f1467 f2468 f3469 f4470 f5471 f6472 f7473 f8474 f9475 f10476 len477) in + let rst479 :: (Packed PList72 [Vector Char]) = (mkListFiles120 [] f1467 f2468 f3469 f4470 f5471 f6472 f7473 f8474 f9475 f10476 len477 - 1) in + (Cons74 (Vector Char) f478 rst479) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +getFile121 :: forall. (Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Int -> Vector Char) +getFile121 f1480 f2481 f3482 f4483 f5484 f6485 f7486 f8487 f9488 f10489 select490 = + if select490 == 0 + then f1480 + else if select490 == 1 + then f2481 + else if select490 == 2 + then f3482 + else if select490 == 3 + then f4483 + else if select490 == 4 + then f5484 + else if select490 == 5 + then f6485 + else if select490 == 6 + then f7486 + else if select490 == 7 + then f8487 + else if select490 == 8 + then f9488 + else f10489 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlogTags122 :: forall. ((Packed PList72 [Vector Char]) -> (Packed BlogTags137 [])) +mkBlogTags122 taglist491 = + (TagList148 () taglist491) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlogContent123 :: forall. ((Packed Block131 []) -> (Packed BlogContent136 [])) +mkBlogContent123 block492 = + (Content149 () block492) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlogDate124 :: forall. (Vector Char -> (Packed BlogDate135 [])) +mkBlogDate124 text493 = + (Date150 () text493) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlogAuthor125 :: forall. (Vector Char -> (Packed BlogAuthor134 [])) +mkBlogAuthor125 text494 = + (Author151 () text494) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlogID126 :: forall. (Int -> (Packed BlogId133 [])) +mkBlogID126 val495 = + (ID152 () val495) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkBlogHeader127 :: forall. (Vector Char -> (Packed BlogHeader132 [])) +mkBlogHeader127 text496 = + (Header153 () text496) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +getRandomString128 :: forall. (Int -> Vector Char) +getRandomString128 length497 = + (generate2 [Char] length497 (fn:mkChar129 [])) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +mkChar129 :: forall. (Int -> Char) +mkChar129 val498 = + (getChar77 [] rand() mod 26) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +is_empty_plist59 :: forall b:a500. ((Packed PList72 [b:a500]) -> Bool) +is_empty_plist59 ls499 = + case ls499 of + Nil73 -> + True + Cons74 wildcard_1501::b:a500 wildcard_2502::(Packed PList72 [b:a500]) -> + False + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +zip_plist60 :: forall b:a505 b:b506. ((Packed PList72 [b:a505]) -> (Packed PList72 [b:b506]) -> (Packed PList72 [(b:a505,b:b506)])) +zip_plist60 as503 bs504 = + case as503 of + Nil73 -> + (Nil73 ((b:a505,b:b506))) + Cons74 z507::b:a505 zs508::(Packed PList72 [b:a505]) -> + case bs504 of + Nil73 -> + (Nil73 ((b:a505,b:b506))) + Cons74 y509::b:b506 ys510::(Packed PList72 [b:b506]) -> + (Cons74 ((b:a505,b:b506)) (z507, y509) (zip_plist60 [b:a505,b:b506] zs508 ys510)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +splitAt_plist61 :: forall b:a513. (Int -> (Packed PList72 [b:a513]) -> ((Packed PList72 [b:a513]),(Packed PList72 [b:a513]))) +splitAt_plist61 n511 a512 = + if n511 == 0 + then ((Nil73 (b:a513)), a512) + else case a512 of + Nil73 -> + ((Nil73 (b:a513)), (Nil73 (b:a513))) + Cons74 x514::b:a513 xs515::(Packed PList72 [b:a513]) -> + let tup63516 :: ((Packed PList72 [b:a513]),(Packed PList72 [b:a513])) = (splitAt_plist61 [b:a513] n511 - 1 xs515) in + let c517 :: (Packed PList72 [b:a513]) = (#0 tup63516) in + let d518 :: (Packed PList72 [b:a513]) = (#1 tup63516) in + ((Cons74 (b:a513) x514 c517), d518) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +map_plist62 :: forall b:a521 b:b522. ((b:a521 -> b:b522) -> (Packed PList72 [b:a521]) -> (Packed PList72 [b:b522])) +map_plist62 f519 ls520 = + case ls520 of + Nil73 -> + (Nil73 (b:b522)) + Cons74 x523::b:a521 xs524::(Packed PList72 [b:a521]) -> + (Cons74 (b:b522) (f519 [] x523) (map_plist62 [b:a521,b:b522] (fn:f519 []) xs524)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +reverse_plist63 :: forall b:a527. ((Packed PList72 [b:a527]) -> (Packed PList72 [b:a527]) -> (Packed PList72 [b:a527])) +reverse_plist63 xs525 acc526 = + case xs525 of + Nil73 -> + acc526 + Cons74 z528::b:a527 zs529::(Packed PList72 [b:a527]) -> + (reverse_plist63 [b:a527] zs529 (Cons74 (b:a527) z528 acc526)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +drop_plist64 :: forall b:a532. (Int -> (Packed PList72 [b:a532]) -> (Packed PList72 [b:a532])) +drop_plist64 num530 list531 = + case list531 of + Nil73 -> + (Nil73 (b:a532)) + Cons74 x533::b:a532 rst534::(Packed PList72 [b:a532]) -> + if <=(num530, 0) + then (Cons74 (b:a532) x533 rst534) + else (drop_plist64 [b:a532] num530 - 1 rst534) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +take_plist65 :: forall b:a537. (Int -> (Packed PList72 [b:a537]) -> (Packed PList72 [b:a537])) +take_plist65 n535 a536 = + if n535 == 0 + then (Nil73 (b:a537)) + else case a536 of + Nil73 -> + (Nil73 (b:a537)) + Cons74 z538::b:a537 zs539::(Packed PList72 [b:a537]) -> + (Cons74 (b:a537) z538 (take_plist65 [b:a537] n535 - 1 zs539)) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +filter_plist66 :: forall b:a542. ((b:a542 -> Bool) -> (Packed PList72 [b:a542]) -> (Packed PList72 [b:a542])) +filter_plist66 f540 a541 = + case a541 of + Nil73 -> + (Nil73 (b:a542)) + Cons74 z543::b:a542 zs544::(Packed PList72 [b:a542]) -> + if (f540 [] z543) + then (Cons74 (b:a542) z543 (filter_plist66 [b:a542] (fn:f540 []) zs544)) + else (filter_plist66 [b:a542] (fn:f540 []) zs544) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +length_plist67 :: forall b:a546. ((Packed PList72 [b:a546]) -> Int) +length_plist67 a545 = + case a545 of + Nil73 -> + 0 + Cons74 x547::b:a546 xs548::(Packed PList72 [b:a546]) -> + 1 + (length_plist67 [b:a546] xs548) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +nth_plist68 :: forall b:a553. ((Packed PList72 [b:a553]) -> b:a553 -> Int -> Int -> b:a553) +nth_plist68 list549 def550 index551 start552 = + case list549 of + Nil73 -> + def550 + Cons74 x554::b:a553 rst555::(Packed PList72 [b:a553]) -> + if index551 == start552 + then x554 + else (nth_plist68 [b:a553] rst555 def550 index551 start552 + 1) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +elem_plist69 :: forall b:a559. ((b:a559 -> b:a559 -> Int) -> b:a559 -> (Packed PList72 [b:a559]) -> Bool) +elem_plist69 cmp556 a557 list558 = + case list558 of + Nil73 -> + False + Cons74 x560::b:a559 rst561::(Packed PList72 [b:a559]) -> + if (cmp556 [] x560 a557) == 0 + then True + else (elem_plist69 [b:a559] (fn:cmp556 []) a557 rst561) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +tail_plist70 :: forall b:a563. ((Packed PList72 [b:a563]) -> (Packed PList72 [b:a563])) +tail_plist70 ls562 = + case ls562 of + Cons74 wildcard_10564::b:a563 xs565::(Packed PList72 [b:a563]) -> + xs565 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +head_plist71 :: forall b:a567. ((Packed PList72 [b:a567]) -> b:a567) +head_plist71 ls566 = + case ls566 of + Cons74 x568::b:a567 wildcard_6569::(Packed PList72 [b:a567]) -> + x568 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +maxInt49 :: forall. (Int -> Int -> Int) +maxInt49 a570 b571 = + if a570 > b571 + then a570 + else b571 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +print_space50 :: forall. (() -> ()) +print_space50 wildcard_20572 = + printsym(" ") + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +print_newline51 :: forall. (() -> ()) +print_newline51 wildcard_18573 = + printsym(" +") + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +print_check52 :: forall. (Bool -> ()) +print_check52 b574 = + if b574 + then let wildcard_14575 :: () = printsym("OK +") in + () + else let wildcard_16576 :: () = printsym("Err +") in + () + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +compare_int53 :: forall. (Int -> Int -> Int) +compare_int53 r1577 r2578 = + if r1577 < r2578 + then 0 - 1 + else if r1577 > r2578 + then 1 + else 0 + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +compare_float54 :: forall. (Float -> Float -> Int) +compare_float54 r1579 r2580 = + if .<.(r1579, r2580) + then 0 - 1 + else if .>.(r1579, r2580) + then 1 + else 0 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +float_abs55 :: forall. (Float -> Float) +float_abs55 f581 = + if .<.(f581, 0.0) + then .*.(f581, .-.(0.0, 1.0)) + else f581 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +minFloat56 :: forall. (Float -> Float -> Float) +minFloat56 a582 b583 = + if .<.(a582, b583) + then a582 + else b583 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +maxFloat57 :: forall. (Float -> Float -> Float) +maxFloat57 a584 b585 = + if .>.(a584, b585) + then a584 + else b585 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +minInt58 :: forall. (Int -> Int -> Int) +minInt58 a586 b587 = + if a586 < b587 + then a586 + else b587 + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +generate2 :: forall b:a590. (Int -> (Int -> b:a590) -> Vector b:a590) +generate2 n588 f589 = + let n_591 :: Int = (maxInt49 [] n588 0) in + let vec592 :: Vector b:a590 = (valloc :: [b:a590])(n_591) in + let vec1593 :: Vector b:a590 = (generate_loop32 [b:a590] vec592 0 n_591 (fn:f589 [])) in + vec1593 + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +length3 :: forall b:a595. (Vector b:a595 -> Int) +length3 vec594 = + vlength(vec594) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +select4 :: forall b:a599. (Vector b:a599 -> Vector b:a599 -> Int -> b:a599) +select4 v1596 v2597 i598 = + let len600 :: Int = vlength(v1596) in + if i598 < len600 + then vnth(v1596, i598) + else vnth(v2597, i598 - len600) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +nth5 :: forall b:a603. (Vector b:a603 -> Int -> b:a603) +nth5 vec601 i602 = + vnth(vec601, i602) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +singleton6 :: forall b:a605. (b:a605 -> Vector b:a605) +singleton6 x604 = + let vec606 :: Vector b:a605 = (valloc :: [b:a605])(1) in + let vec2607 :: Vector b:a605 = inplacevupdate(vec606, 0, x604) in + vec2607 + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +append7 :: forall b:a610. (Vector b:a610 -> Vector b:a610 -> Vector b:a610) +append7 v1608 v2609 = + (generate2 [b:a610] vlength(v1608) + vlength(v2609) (\(i611 :: Int) -> + (select4 [b:a610] v1608 v2609 i611))) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +head8 :: forall b:a613. (Vector b:a613 -> b:a613) +head8 vec612 = + (nth5 [b:a613] vec612 0) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printVec9 :: forall b:a616. ((b:a616 -> ()) -> Vector b:a616 -> ()) +printVec9 f614 vec615 = + let wildcard_178617 :: () = printsym("[") in + let wildcard_176618 :: () = (printVec_loop17 [b:a616] 0 vlength(vec615) vec615 (fn:f614 [])) in + let wildcard_173619 :: () = printsym("]") in + () + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +alloc10 :: forall b:a621. (Int -> Vector b:a621) +alloc10 vec620 = + (valloc :: [b:a621])(vec620) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +filter11 :: forall b:a624. ((b:a624 -> Bool) -> Vector b:a624 -> Vector b:a624) +filter11 f622 vec623 = + let idxs626 :: Vector Int = (generate2 [Int] vlength(vec623) (\(i625 :: Int) -> + if (f622 [] (nth5 [b:a624] vec623 i625)) + then i625 + else 0 - 1)) in + let num_ones629 :: Int = (foldl26 [Int,Int] (\(acc628 :: Int, x627 :: Int) -> + if x627 == 0 - 1 + then acc628 + else acc628 + 1) 0 idxs626) in + let to630 :: Vector b:a624 = (valloc :: [b:a624])(num_ones629) in + let len_idxs631 :: Int = vlength(idxs626) in + (filter_loop12 [b:a624] idxs626 0 0 len_idxs631 vec623 to630) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +filter_loop12 :: forall b:a638. (Vector Int -> Int -> Int -> Int -> Vector b:a638 -> Vector b:a638 -> Vector b:a638) +filter_loop12 idxs632 write_at633 start634 end635 from636 to637 = + if start634 == end635 + then to637 + else let idx639 :: Int = (nth5 [Int] idxs632 start634) in + if idx639 == 0 - 1 + then (filter_loop12 [b:a638] idxs632 write_at633 start634 + 1 end635 from636 to637) + else let elt640 :: b:a638 = (nth5 [b:a638] from636 idx639) in + let to1641 :: Vector b:a638 = inplacevupdate(to637, write_at633, elt640) in + (filter_loop12 [b:a638] idxs632 write_at633 + 1 start634 + 1 end635 from636 to1641) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lcons13 :: forall b:a644. (b:a644 -> Vector b:a644 -> Vector b:a644) +lcons13 x642 vec643 = + let y645 :: Vector b:a644 = vec643 in + (cons14 [b:a644] x642 y645) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +cons14 :: forall b:a648. (b:a648 -> Vector b:a648 -> Vector b:a648) +cons14 x646 vec647 = + let len649 :: Int = vlength(vec647) in + let vec2650 :: Vector b:a648 = (valloc :: [b:a648])(len649 + 1) in + let vec3652 :: Vector b:a648 = (generate_loop32 [b:a648] vec2650 1 len649 + 1 (\(i651 :: Int) -> + (nth5 [b:a648] vec647 i651 - 1))) in + let vec4653 :: Vector b:a648 = inplacevupdate(vec3652, 0, x646) in + vec4653 + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lsnoc15 :: forall b:a656. (Vector b:a656 -> b:a656 -> Vector b:a656) +lsnoc15 vec654 x655 = + let y657 :: Vector b:a656 = vec654 in + (snoc16 [b:a656] y657 x655) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +snoc16 :: forall b:a660. (Vector b:a660 -> b:a660 -> Vector b:a660) +snoc16 vec658 x659 = + let len661 :: Int = vlength(vec658) in + let vec2662 :: Vector b:a660 = (valloc :: [b:a660])(len661 + 1) in + let vec3664 :: Vector b:a660 = (generate_loop32 [b:a660] vec2662 0 len661 (\(i663 :: Int) -> + (nth5 [b:a660] vec658 i663))) in + let vec4665 :: Vector b:a660 = inplacevupdate(vec3664, len661, x659) in + vec4665 + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +printVec_loop17 :: forall b:a670. (Int -> Int -> Vector b:a670 -> (b:a670 -> ()) -> ()) +printVec_loop17 idx666 end667 vec668 f669 = + if idx666 == end667 + then () + else let wildcard_187671 :: () = (f669 [] vnth(vec668, idx666)) in + let wildcard_184672 :: () = printsym(",") in + (printVec_loop17 [b:a670] idx666 + 1 end667 vec668 (fn:f669 [])) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lifoldl18 :: forall b:a676 b:b677. ((b:b677 -> Int -> b:a676 -> b:b677) -> b:b677 -> Vector b:a676 -> b:b677) +lifoldl18 f673 acc674 vec675 = + let x678 :: Vector b:a676 = vec675 in + (ifoldl20 [b:a676,b:b677] (fn:f673 []) acc674 x678) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +ifoldl_loop19 :: forall b:a684 b:b685. (Int -> Int -> (b:b685 -> Int -> b:a684 -> b:b685) -> b:b685 -> Vector b:a684 -> b:b685) +ifoldl_loop19 idx679 end680 f681 acc682 vec683 = + if idx679 == end680 + then acc682 + else let acc1686 :: b:b685 = (f681 [] acc682 idx679 vnth(vec683, idx679)) in + (ifoldl_loop19 [b:a684,b:b685] idx679 + 1 end680 (fn:f681 []) acc1686 vec683) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +ifoldl20 :: forall b:a690 b:b691. ((b:b691 -> Int -> b:a690 -> b:b691) -> b:b691 -> Vector b:a690 -> b:b691) +ifoldl20 f687 acc688 vec689 = + (ifoldl_loop19 [b:a690,b:b691] 0 vlength(vec689) (fn:f687 []) acc688 vec689) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lscanl21 :: forall b:a695 b:b696. ((b:b696 -> b:a695 -> b:b696) -> b:b696 -> Vector b:a695 -> Vector b:b696) +lscanl21 f692 acc693 vec694 = + let x697 :: Vector b:a695 = vec694 in + (scanl23 [b:a695,b:b696] (fn:f692 []) acc693 x697) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +scanl_loop22 :: forall b:a704 b:b705. (Int -> Int -> (b:b705 -> b:a704 -> b:b705) -> b:b705 -> Vector b:a704 -> Vector b:b705 -> Vector b:b705) +scanl_loop22 idx698 end699 f700 acc701 vec702 result703 = + if idx698 == end699 + then result703 + else let acc1706 :: b:b705 = (f700 [] acc701 vnth(vec702, idx698)) in + let result_707 :: Vector b:b705 = inplacevupdate(result703, idx698, acc1706) in + (scanl_loop22 [b:a704,b:b705] idx698 + 1 end699 (fn:f700 []) acc1706 vec702 result_707) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +scanl23 :: forall b:a711 b:b712. ((b:b712 -> b:a711 -> b:b712) -> b:b712 -> Vector b:a711 -> Vector b:b712) +scanl23 f708 acc709 vec710 = + let len713 :: Int = vlength(vec710) in + let result714 :: Vector b:b712 = (valloc :: [b:b712])(len713) in + (scanl_loop22 [b:a711,b:b712] 0 len713 (fn:f708 []) acc709 vec710 result714) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lfoldl24 :: forall b:a718 b:b719. ((b:b719 -> b:a718 -> b:b719) -> b:b719 -> Vector b:a718 -> b:b719) +lfoldl24 f715 acc716 vec717 = + let x720 :: Vector b:a718 = vec717 in + (foldl26 [b:a718,b:b719] (fn:f715 []) acc716 x720) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +foldl_loop25 :: forall b:a726 b:b727. (Int -> Int -> (b:b727 -> b:a726 -> b:b727) -> b:b727 -> Vector b:a726 -> b:b727) +foldl_loop25 idx721 end722 f723 acc724 vec725 = + if idx721 == end722 + then acc724 + else let acc1728 :: b:b727 = (f723 [] acc724 vnth(vec725, idx721)) in + (foldl_loop25 [b:a726,b:b727] idx721 + 1 end722 (fn:f723 []) acc1728 vec725) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +foldl26 :: forall b:a732 b:b733. ((b:b733 -> b:a732 -> b:b733) -> b:b733 -> Vector b:a732 -> b:b733) +foldl26 f729 acc730 vec731 = + (foldl_loop25 [b:a732,b:b733] 0 vlength(vec731) (fn:f729 []) acc730 vec731) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +update27 :: forall b:a737. (Vector b:a737 -> Int -> b:a737 -> Vector b:a737) +update27 vec734 i735 x736 = + (generate2 [b:a737] (length3 [b:a737] vec734) (\(j738 :: Int) -> + if i735 == j738 + then x736 + else vnth(vec734, j738))) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lmap28 :: forall b:a741 b:b742. ((b:a741 -> b:b742) -> Vector b:a741 -> Vector b:b742) +lmap28 f739 vec740 = + let x743 :: Vector b:a741 = vec740 in + (map29 [b:a741,b:b742] (fn:f739 []) x743) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +map29 :: forall b:a746 b:b747. ((b:a746 -> b:b747) -> Vector b:a746 -> Vector b:b747) +map29 f744 vec745 = + (generate2 [b:b747] vlength(vec745) (\(i748 :: Int) -> + (f744 [] vnth(vec745, i748)))) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lcopy30 :: forall b:a750. (Vector b:a750 -> Vector b:a750) +lcopy30 vec749 = + (copy31 [b:a750] vec749) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +copy31 :: forall b:a752. (Vector b:a752 -> Vector b:a752) +copy31 vec751 = + (generate2 [b:a752] vlength(vec751) (\(i753 :: Int) -> + (nth5 [b:a752] vec751 i753))) + +{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +generate_loop32 :: forall b:a758. (Vector b:a758 -> Int -> Int -> (Int -> b:a758) -> Vector b:a758) +generate_loop32 vec754 idx755 end756 f757 = + if idx755 == end756 + then vec754 + else let vec1759 :: Vector b:a758 = inplacevupdate(vec754, idx755, (f757 [] idx755)) in + (generate_loop32 [b:a758] vec1759 idx755 + 1 end756 (fn:f757 [])) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +tail33 :: forall b:a761. (Vector b:a761 -> Vector b:a761) +tail33 vec760 = + (slice44 [b:a761] 1 vlength(vec760) - 1 vec760) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lsplitAt_34 :: forall b:a764. (Int -> Vector b:a764 -> (Int,Vector b:a764,Int,Vector b:a764)) +lsplitAt_34 n762 vec763 = + let tup74765 :: (Vector b:a764,Vector b:a764) = (splitAt36 [b:a764] n762 vec763) in + let x766 :: Vector b:a764 = (#0 tup74765) in + let y767 :: Vector b:a764 = (#1 tup74765) in + (vlength(x766), x766, vlength(y767), y767) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +lsplitAt35 :: forall b:a770. (Int -> Vector b:a770 -> (Int,Vector b:a770,Int,Vector b:a770)) +lsplitAt35 n768 vec769 = + let x771 :: Vector b:a770 = vec769 in + (lsplitAt_34 [b:a770] n768 x771) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +splitAt36 :: forall b:a774. (Int -> Vector b:a774 -> (Vector b:a774,Vector b:a774)) +splitAt36 n772 vec773 = + let len775 :: Int = vlength(vec773) in + let n_776 :: Int = (maxInt49 [] n772 0) in + let m777 :: Int = (minInt58 [] n_776 len775) in + let m_778 :: Int = (maxInt49 [] 0 len775 - n_776) in + (vslice(0, m777, vec773), vslice(m777, m_778, vec773)) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +isEmpty37 :: forall b:a780. (Vector b:a780 -> Bool) +isEmpty37 vec779 = + vlength(vec779) == 0 + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +inplaceUpdate38 :: forall b:a784. (Int -> b:a784 -> Vector b:a784 -> Vector b:a784) +inplaceUpdate38 i781 val782 vec783 = + inplacevupdate(vec783, i781, val782) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +inplaceSort39 :: forall b:a787. ((b:a787 -> b:a787 -> Int) -> Vector b:a787 -> Vector b:a787) +inplaceSort39 cmp785 vec786 = + inplacevsort(vec786, (fn:cmp785 [])) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +flatten40 :: forall b:a789. (Vector Vector b:a789 -> Vector b:a789) +flatten40 ls788 = + vconcat(ls788) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +sort41 :: forall b:a792. ((b:a792 -> b:a792 -> Int) -> Vector b:a792 -> Vector b:a792) +sort41 cmp790 vec791 = + vsort(vec791, (fn:cmp790 [])) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +merge42 :: forall b:a795. (Vector b:a795 -> Vector b:a795 -> Vector b:a795) +merge42 vec1793 vec2794 = + vmerge(vec1793, vec2794) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +unsafeSlice43 :: forall b:a799. (Int -> Int -> Vector b:a799 -> Vector b:a799) +unsafeSlice43 i796 n797 vec798 = + vslice(i796, n797, vec798) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +slice44 :: forall b:a803. (Int -> Int -> Vector b:a803 -> Vector b:a803) +slice44 i800 n801 vec802 = + vslice(i800, n801, vec802) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +nth245 :: forall b:a806. (Vector b:a806 -> Int -> (b:a806,Vector b:a806)) +nth245 vec804 i805 = + let tup26807 :: Vector b:a806 = vec804 in + let vec1808 :: Vector b:a806 = tup26807 in + let vec2809 :: Vector b:a806 = tup26807 in + (vnth(vec1808, i805), vec2809) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +nth146 :: forall b:a812. (Vector b:a812 -> Int -> b:a812) +nth146 vec810 i811 = + vnth(vec810, i811) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +length247 :: forall b:a814. (Vector b:a814 -> (Int,Vector b:a814)) +length247 vec813 = + let tup12815 :: Vector b:a814 = vec813 in + let vec1816 :: Vector b:a814 = tup12815 in + let vec2817 :: Vector b:a814 = tup12815 in + (vlength(vec1816), vec2817) + +{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} +length148 :: forall b:a819. (Vector b:a819 -> Int) +length148 vec818 = + vlength(vec818) + +gibbon_main :: () +gibbon_main = let blogs159 :: (Packed Blog138 []) = (mkBlogs_layout11 [] 2) in + let keyword162 :: Vector Char = let vec16160 :: Vector Char = (valloc :: [Char])(1) in + let _161 :: Vector Char = inplacevupdate(vec16160, 0, 'a') in + vec16160 in + let newblgs163 :: (Packed Blog138 []) = (emphKeywordInContent0 [] keyword162 blogs159) in + (printBlog76 [] newblgs163) +Layout1 Header [,,,,,]ID Author [,,,,,]Date [,,,,,]Content Plain PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Emph PList ( Cons Str [,]Nil ) PList ( Cons Str [,]PList ( Cons Emph PList ( Cons Str [,]Nil ) Nil ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) TagList PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]Nil ) ) ) ) ) ) ) ) ) ) Layout1 Header [,,,,,]ID Author [,,,,,]Date [,,,,,]Content Plain PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]Nil ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) TagList PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]Nil ) ) ) ) ) ) ) ) ) ) gibbon: lookup3: key "End139" not found in list: + [("Layout1140",[(Var "header186",PackedTy "BlogHeader132" []),(Var "id187",PackedTy "BlogId133" []),(Var "author188",PackedTy "BlogAuthor134" []),(Var "date189",PackedTy "BlogDate135" []),(Var "content190",PackedTy "BlogContent136" []),(Var "tags191",PackedTy "BlogTags137" []),(Var "rst192",PackedTy "Blog138" [])],LetE (Var "wildcard_344193",[],ProdTy [],PrimAppE PrintSym [LitSymE (Var "Layout1 ")]) (LetE (Var "wildcard_342194",[],ProdTy [],AppE (Var "printHeader83") [] [VarE (Var "header186")]) (LetE (Var "wildcard_340195",[],ProdTy [],AppE (Var "printID82") [] [VarE (Var "id187")]) (LetE (Var "wildcard_338196",[],ProdTy [],AppE (Var "printAuthor84") [] [VarE (Var "author188")]) (LetE (Var "wildcard_336197",[],ProdTy [],AppE (Var "printDate85") [] [VarE (Var "date189")]) (LetE (Var "wildcard_334198",[],ProdTy [],AppE (Var "printContent87") [] [VarE (Var "content190")]) (LetE (Var "wildcard_332199",[],ProdTy [],AppE (Var "printTagList86") [] [VarE (Var "tags191")]) (LetE (Var "wildcard_330200",[],ProdTy [],AppE (Var "printBlog76") [] [VarE (Var "rst192")]) (MkProdE [])))))))))] +CallStack (from HasCallStack): + error, called at src/Gibbon/Common.hs:363:12 in gibbon-0.3-inplace:Gibbon.Common + lookup3, called at src/Gibbon/L1/Interp.hs:124:42 in gibbon-0.3-inplace:Gibbon.L1.Interp diff --git a/gibbon-compiler/src/Gibbon/Common.hs b/gibbon-compiler/src/Gibbon/Common.hs index 895b1fa50..75c320f90 100644 --- a/gibbon-compiler/src/Gibbon/Common.hs +++ b/gibbon-compiler/src/Gibbon/Common.hs @@ -356,10 +356,11 @@ abbrv n x = then str else L.take (n-3) str ++ "..." -lookup3 :: (Eq k, Show k, Show a, Show b) => k -> [(k,a,b)] -> (k,a,b) +lookup3 :: HasCallStack => (Eq k, Show k, Show a, Show b) => k -> [(k,a,b)] -> (k,a,b) lookup3 k ls = go ls where - go [] = error$ "lookup3: key "++show k++" not found in list:\n "++L.take 80 (show ls) + --go [] = error$ "lookup3: key "++show k++" not found in list:\n "++L.take 80 (show ls) + go [] = error$ "lookup3: key "++show k++" not found in list:\n "++ (show ls) go ((k1,a1,b1):r) | k1 == k = (k1,a1,b1) | otherwise = go r diff --git a/gibbon-compiler/src/Gibbon/L1/Interp.hs b/gibbon-compiler/src/Gibbon/L1/Interp.hs index bad9dae4f..b9d45b8ec 100644 --- a/gibbon-compiler/src/Gibbon/L1/Interp.hs +++ b/gibbon-compiler/src/Gibbon/L1/Interp.hs @@ -297,6 +297,9 @@ applyPrim rc p args = (PrintSym, [VInt n]) -> do tell $ string8 (show n) pure $ VProd [] + (PrintChar, [c]) -> do + tell $ string8 (show c) + pure $ VProd [] oth -> error $ "unhandled prim or wrong number of arguments: "++show oth where From c6b38d25bf5e59c89d2d599179aa82a1167362be Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 23:08:20 -0500 Subject: [PATCH 58/68] changed layout benches to print the blogs in a way that's independent of internal type names --- .../examples/layout_bench/Basics.hs | 2 + .../examples/layout_bench/manyFuncs.hs | 2 +- gibbon-compiler/ir.log | 5337 +---------------- gibbon-compiler/src/Gibbon/L1/Interp.hs | 10 +- 4 files changed, 14 insertions(+), 5337 deletions(-) diff --git a/gibbon-compiler/examples/layout_bench/Basics.hs b/gibbon-compiler/examples/layout_bench/Basics.hs index 6c5926bf8..aefd8179b 100644 --- a/gibbon-compiler/examples/layout_bench/Basics.hs +++ b/gibbon-compiler/examples/layout_bench/Basics.hs @@ -588,6 +588,8 @@ printID id = case id of printBlog :: Blog -> () printBlog blog = case blog of + End -> let _ = printsym (quote "Fin") + in () Layout1 header id author date content tags rst -> let _ = printsym (quote "Layout1 ") _ = printHeader header _ = printID id diff --git a/gibbon-compiler/examples/layout_bench/manyFuncs.hs b/gibbon-compiler/examples/layout_bench/manyFuncs.hs index 6e0527659..37b964542 100644 --- a/gibbon-compiler/examples/layout_bench/manyFuncs.hs +++ b/gibbon-compiler/examples/layout_bench/manyFuncs.hs @@ -47,4 +47,4 @@ gibbon_main = newblgs = emphKeywordInContent keyword blogs newblgs' = emphKeywordInTag keyword newblgs newblgs'' = filterByKeywordInTagList keyword newblgs' - in printPacked newblgs'' + in printBlog newblgs'' diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log index db105efd3..53b20d9c2 100644 --- a/gibbon-compiler/ir.log +++ b/gibbon-compiler/ir.log @@ -1,5338 +1,5 @@ ! Responding to env Var: GIBBON_DEBUG=4 ! We set DEBUG based on command-line verbose arg: 4 - -Parsed: -================================================================================ -ProgBundle [ProgModule "GenerateLayout1" - (Prog - {ddefs = [], - fundefs = [(mkBlogs_layout1, - FunDef {funName = "mkBlogs_layout1", - funArgs = [length], - funTy = ForAll [] - (ArrowTy [IntTy] - (PackedTy "Blog" [])), - funBody = IfE (PrimAppE LtEqP - [VarE "length",LitE 0]) - (DataConE (MetaTv $1) "End" []) - (LetE (header, - [], - MetaTv $16, - DataConE (MetaTv $15) - "Header" - [AppE "getRandomString" - [] - [LitE 5]]) - (LetE (id, - [], - MetaTv $14, - DataConE (MetaTv $13) - "ID" - [PrimAppE SubP - [LitE 10, - PrimAppE ModP - [VarE "length", - LitE 10]]]) - (LetE (author, - [], - MetaTv $12, - DataConE (MetaTv $11) - "Author" - [AppE "getRandomString" - [] - [LitE 5]]) - (LetE (date, - [], - MetaTv $10, - DataConE (MetaTv $9) - "Date" - [AppE "getRandomString" - [] - [LitE 5]]) - (LetE (content, - [], - MetaTv $8, - DataConE (MetaTv $6) - "Content" - [DataConE (MetaTv $7) - "Plain" - [AppE "mkRandomInlineList" - [] - [LitE 50]]]) - (LetE (tags, - [], - MetaTv $5, - DataConE (MetaTv $4) - "TagList" - [AppE "mkSomeTags" - [] - [LitE 10]]) - (LetE (rst, - [], - MetaTv $3, - AppE "mkBlogs_layout1" - [] - [PrimAppE SubP - [VarE "length", - LitE 1]]) - (DataConE (MetaTv $2) - "Layout1" - [VarE "header", - VarE "id", - VarE "author", - VarE "date", - VarE "content", - VarE "tags", - VarE "rst"])))))))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing}) - [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 1 3 14, srcInfoPoints = [SrcSpan ".hs" 3 1 3 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 8 3 14, srcInfoPoints = []}) "Basics", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], - ProgModule "Gibbon.Vector" - (Prog - {ddefs = [], - fundefs = [(generate, - FunDef {funName = "generate", - funArgs = [n,f], - funTy = ForAll [u:a] - (ArrowTy [IntTy, - ArrowTy [IntTy] - (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = LetE (n', - [], - MetaTv $91, - AppE "maxInt" [] [VarE "n",LitE 0]) - (LetE (vec, - [], - VectorTy (TyVar u:a), - PrimAppE (VAllocP (MetaTv $90)) - [VarE "n'"]) - (LetE (vec1, - [], - MetaTv $89, - AppE "generate_loop" - [] - [VarE "vec", - LitE 0,VarE "n'", - VarE "f"]) - (VarE "vec1"))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (length, - FunDef {funName = "length", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - IntTy), - funBody = PrimAppE (VLengthP (MetaTv $3)) - [VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (select, - FunDef {funName = "select", - funArgs = [v1,v2,i], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - VectorTy (TyVar u:a), - IntTy] - (TyVar u:a)), - funBody = LetE (len, - [], - MetaTv $102, - PrimAppE (VLengthP (MetaTv $101)) - [VarE "v1"]) - (IfE (PrimAppE LtP - [VarE "i", - VarE "len"]) - (PrimAppE (VNthP (MetaTv $99)) - [VarE "v1",VarE "i"]) - (PrimAppE (VNthP (MetaTv $100)) - [VarE "v2", - PrimAppE SubP - [VarE "i", - VarE "len"]])), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (nth, - FunDef {funName = "nth", - funArgs = [vec,i], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - IntTy] - (TyVar u:a)), - funBody = PrimAppE (VNthP (MetaTv $15)) - [VarE "vec",VarE "i"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (singleton, - FunDef {funName = "singleton", - funArgs = [x], - funTy = ForAll [u:a] - (ArrowTy [TyVar u:a] - (VectorTy (TyVar u:a))), - funBody = LetE (vec, - [], - VectorTy (TyVar u:a), - PrimAppE (VAllocP (MetaTv $55)) - [LitE 1]) - (LetE (vec2, - [], - MetaTv $54, - PrimAppE (InplaceVUpdateP (MetaTv $53)) - [VarE "vec",LitE 0, - VarE "x"]) - (VarE "vec2")), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (append, - FunDef {funName = "append", - funArgs = [v1,v2], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = AppE "generate" - [] - [PrimAppE AddP - [PrimAppE (VLengthP (MetaTv $105)) - [VarE "v1"], - PrimAppE (VLengthP (MetaTv $106)) - [VarE "v2"]], - Ext (LambdaE [(i, MetaTv $107)] - (AppE "select" - [] - [VarE "v1", - VarE "v2", - VarE "i"]))], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (head, - FunDef {funName = "head", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - (TyVar u:a)), - funBody = AppE "nth" [] [VarE "vec",LitE 0], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printVec, - FunDef {funName = "printVec", - funArgs = [f,vec], - funTy = ForAll [u:a] - (ArrowTy [ArrowTy [TyVar u:a] - (ProdTy []), - VectorTy (TyVar u:a)] - (ProdTy [])), - funBody = LetE (wildcard_178, - [], - MetaTv $179, - PrimAppE PrintSym [LitSymE "["]) - (LetE (wildcard_176, - [], - MetaTv $177, - AppE "printVec_loop" - [] - [LitE 0, - PrimAppE (VLengthP (MetaTv $175)) - [VarE "vec"], - VarE "vec",VarE "f"]) - (LetE (wildcard_173, - [], - MetaTv $174, - PrimAppE PrintSym - [LitSymE "]"]) - (MkProdE []))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (alloc, - FunDef {funName = "alloc", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [IntTy] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (VAllocP (MetaTv $1)) - [VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (filter, - FunDef {funName = "filter", - funArgs = [f,vec], - funTy = ForAll [u:a] - (ArrowTy [ArrowTy [TyVar u:a] - BoolTy, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = LetE (idxs, - [], - VectorTy IntTy, - AppE "generate" - [] - [PrimAppE (VLengthP (MetaTv $231)) - [VarE "vec"], - Ext (LambdaE [(i, - MetaTv $232)] - (IfE (AppE "f" - [] - [AppE "nth" - [] - [VarE "vec", - VarE "i"]]) - (VarE "i") - (PrimAppE SubP - [LitE 0, - LitE 1])))]) - (LetE (num_ones, - [], - MetaTv $230, - AppE "foldl" - [] - [Ext (LambdaE [(acc, - IntTy), - (x, - IntTy)] - (IfE (PrimAppE EqIntP - [VarE "x", - PrimAppE SubP - [LitE 0, - LitE 1]]) - (VarE "acc") - (PrimAppE AddP - [VarE "acc", - LitE 1]))), - LitE 0,VarE "idxs"]) - (LetE (to, - [], - VectorTy (TyVar u:a), - PrimAppE (VAllocP (MetaTv $227)) - [VarE "num_ones"]) - (LetE (len_idxs, - [], - MetaTv $226, - PrimAppE (VLengthP (MetaTv $225)) - [VarE "idxs"]) - (AppE "filter_loop" - [] - [VarE "idxs", - LitE 0, - LitE 0, - VarE "len_idxs", - VarE "vec", - VarE "to"])))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (filter_loop, - FunDef {funName = "filter_loop", - funArgs = [idxs,write_at,start,end,from,to], - funTy = ForAll [u:a] - (ArrowTy [VectorTy IntTy,IntTy, - IntTy,IntTy, - VectorTy (TyVar u:a), - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = IfE (PrimAppE EqIntP - [VarE "start",VarE "end"]) - (VarE "to") - (LetE (idx, - [], - MetaTv $222, - AppE "nth" - [] - [VarE "idxs", - VarE "start"]) - (IfE (PrimAppE EqIntP - [VarE "idx", - PrimAppE SubP - [LitE 0, - LitE 1]]) - (AppE "filter_loop" - [] - [VarE "idxs", - VarE "write_at", - PrimAppE AddP - [VarE "start", - LitE 1], - VarE "end", - VarE "from", - VarE "to"]) - (LetE (elt, - [], - MetaTv $221, - AppE "nth" - [] - [VarE "from", - VarE "idx"]) - (LetE (to1, - [], - MetaTv $220, - PrimAppE (InplaceVUpdateP (MetaTv $219)) - [VarE "to", - VarE "write_at", - VarE "elt"]) - (AppE "filter_loop" - [] - [VarE "idxs", - PrimAppE AddP - [VarE "write_at", - LitE 1], - PrimAppE AddP - [VarE "start", - LitE 1], - VarE "end", - VarE "from", - VarE "to1"]))))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lcons, - FunDef {funName = "lcons", - funArgs = [x,vec], - funTy = ForAll [u:a] - (ArrowTy [TyVar u:a, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = LetE (y, [], MetaTv $212, VarE "vec") - (AppE "cons" - [] - [VarE "x",VarE "y"]), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (cons, - FunDef {funName = "cons", - funArgs = [x,vec], - funTy = ForAll [u:a] - (ArrowTy [TyVar u:a, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = LetE (len, - [], - MetaTv $209, - PrimAppE (VLengthP (MetaTv $208)) - [VarE "vec"]) - (LetE (vec2, - [], - VectorTy (TyVar u:a), - PrimAppE (VAllocP (MetaTv $207)) - [PrimAppE AddP - [VarE "len", - LitE 1]]) - (LetE (vec3, - [], - MetaTv $206, - AppE "generate_loop" - [] - [VarE "vec2", - LitE 1, - PrimAppE AddP - [VarE "len", - LitE 1], - Ext (LambdaE [(i, - MetaTv $205)] - (AppE "nth" - [] - [VarE "vec", - PrimAppE SubP - [VarE "i", - LitE 1]]))]) - (LetE (vec4, - [], - MetaTv $204, - PrimAppE (InplaceVUpdateP (MetaTv $203)) - [VarE "vec3", - LitE 0, - VarE "x"]) - (VarE "vec4")))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lsnoc, - FunDef {funName = "lsnoc", - funArgs = [vec,x], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - TyVar u:a] - (VectorTy (TyVar u:a))), - funBody = LetE (y, [], MetaTv $200, VarE "vec") - (AppE "snoc" - [] - [VarE "y",VarE "x"]), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (snoc, - FunDef {funName = "snoc", - funArgs = [vec,x], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - TyVar u:a] - (VectorTy (TyVar u:a))), - funBody = LetE (len, - [], - MetaTv $197, - PrimAppE (VLengthP (MetaTv $196)) - [VarE "vec"]) - (LetE (vec2, - [], - VectorTy (TyVar u:a), - PrimAppE (VAllocP (MetaTv $195)) - [PrimAppE AddP - [VarE "len", - LitE 1]]) - (LetE (vec3, - [], - MetaTv $194, - AppE "generate_loop" - [] - [VarE "vec2", - LitE 0, - VarE "len", - Ext (LambdaE [(i, - MetaTv $193)] - (AppE "nth" - [] - [VarE "vec", - VarE "i"]))]) - (LetE (vec4, - [], - MetaTv $192, - PrimAppE (InplaceVUpdateP (MetaTv $191)) - [VarE "vec3", - VarE "len", - VarE "x"]) - (VarE "vec4")))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printVec_loop, - FunDef {funName = "printVec_loop", - funArgs = [idx,end,vec,f], - funTy = ForAll [u:a] - (ArrowTy [IntTy,IntTy, - VectorTy (TyVar u:a), - ArrowTy [TyVar u:a] - (ProdTy [])] - (ProdTy [])), - funBody = IfE (PrimAppE EqIntP - [VarE "idx",VarE "end"]) - (MkProdE []) - (LetE (wildcard_187, - [], - MetaTv $188, - AppE "f" - [] - [PrimAppE (VNthP (MetaTv $186)) - [VarE "vec", - VarE "idx"]]) - (LetE (wildcard_184, - [], - MetaTv $185, - PrimAppE PrintSym - [LitSymE ","]) - (AppE "printVec_loop" - [] - [PrimAppE AddP - [VarE "idx", - LitE 1], - VarE "end", - VarE "vec", - VarE "f"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lifoldl, - FunDef {funName = "lifoldl", - funArgs = [f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:b,IntTy, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (TyVar u:b)), - funBody = LetE (x, [], MetaTv $170, VarE "vec") - (AppE "ifoldl" - [] - [VarE "f",VarE "acc", - VarE "x"]), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (ifoldl_loop, - FunDef {funName = "ifoldl_loop", - funArgs = [idx,end,f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [IntTy,IntTy, - ArrowTy [TyVar u:b,IntTy, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (TyVar u:b)), - funBody = IfE (PrimAppE EqIntP - [VarE "idx",VarE "end"]) - (VarE "acc") - (LetE (acc1, - [], - MetaTv $166, - AppE "f" - [] - [VarE "acc",VarE "idx", - PrimAppE (VNthP (MetaTv $165)) - [VarE "vec", - VarE "idx"]]) - (AppE "ifoldl_loop" - [] - [PrimAppE AddP - [VarE "idx", - LitE 1], - VarE "end",VarE "f", - VarE "acc1", - VarE "vec"])), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (ifoldl, - FunDef {funName = "ifoldl", - funArgs = [f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:b,IntTy, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (TyVar u:b)), - funBody = AppE "ifoldl_loop" - [] - [LitE 0, - PrimAppE (VLengthP (MetaTv $159)) - [VarE "vec"], - VarE "f",VarE "acc",VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lscanl, - FunDef {funName = "lscanl", - funArgs = [f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:b, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:b))), - funBody = LetE (x, [], MetaTv $155, VarE "vec") - (AppE "scanl" - [] - [VarE "f",VarE "acc", - VarE "x"]), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (scanl_loop, - FunDef {funName = "scanl_loop", - funArgs = [idx,end,f,acc,vec,result], - funTy = ForAll [u:a,u:b] - (ArrowTy [IntTy,IntTy, - ArrowTy [TyVar u:b, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a), - VectorTy (TyVar u:b)] - (VectorTy (TyVar u:b))), - funBody = IfE (PrimAppE EqIntP - [VarE "idx",VarE "end"]) - (VarE "result") - (LetE (acc1, - [], - MetaTv $151, - AppE "f" - [] - [VarE "acc", - PrimAppE (VNthP (MetaTv $150)) - [VarE "vec", - VarE "idx"]]) - (LetE (result', - [], - MetaTv $149, - PrimAppE (InplaceVUpdateP (MetaTv $148)) - [VarE "result", - VarE "idx", - VarE "acc1"]) - (AppE "scanl_loop" - [] - [PrimAppE AddP - [VarE "idx", - LitE 1], - VarE "end", - VarE "f", - VarE "acc1", - VarE "vec", - VarE "result'"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (scanl, - FunDef {funName = "scanl", - funArgs = [f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:b, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:b))), - funBody = LetE (len, - [], - MetaTv $141, - PrimAppE (VLengthP (MetaTv $140)) - [VarE "vec"]) - (LetE (result, - [], - VectorTy (TyVar u:b), - PrimAppE (VAllocP (MetaTv $139)) - [VarE "len"]) - (AppE "scanl_loop" - [] - [LitE 0,VarE "len", - VarE "f",VarE "acc", - VarE "vec", - VarE "result"])), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lfoldl, - FunDef {funName = "lfoldl", - funArgs = [f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:b, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (TyVar u:b)), - funBody = LetE (x, [], MetaTv $135, VarE "vec") - (AppE "foldl" - [] - [VarE "f",VarE "acc", - VarE "x"]), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (foldl_loop, - FunDef {funName = "foldl_loop", - funArgs = [idx,end,f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [IntTy,IntTy, - ArrowTy [TyVar u:b, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (TyVar u:b)), - funBody = IfE (PrimAppE EqIntP - [VarE "idx",VarE "end"]) - (VarE "acc") - (LetE (acc1, - [], - MetaTv $131, - AppE "f" - [] - [VarE "acc", - PrimAppE (VNthP (MetaTv $130)) - [VarE "vec", - VarE "idx"]]) - (AppE "foldl_loop" - [] - [PrimAppE AddP - [VarE "idx", - LitE 1], - VarE "end",VarE "f", - VarE "acc1", - VarE "vec"])), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (foldl, - FunDef {funName = "foldl", - funArgs = [f,acc,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:b, - TyVar u:a] - (TyVar u:b), - TyVar u:b, - VectorTy (TyVar u:a)] - (TyVar u:b)), - funBody = AppE "foldl_loop" - [] - [LitE 0, - PrimAppE (VLengthP (MetaTv $124)) - [VarE "vec"], - VarE "f",VarE "acc",VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (update, - FunDef {funName = "update", - funArgs = [vec,i,x], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - IntTy,TyVar u:a] - (VectorTy (TyVar u:a))), - funBody = AppE "generate" - [] - [AppE "length" [] [VarE "vec"], - Ext (LambdaE [(j, MetaTv $120)] - (IfE (PrimAppE EqIntP - [VarE "i", - VarE "j"]) - (VarE "x") - (PrimAppE (VNthP (MetaTv $119)) - [VarE "vec", - VarE "j"])))], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lmap, - FunDef {funName = "lmap", - funArgs = [f,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:a] - (TyVar u:b), - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:b))), - funBody = LetE (x, [], MetaTv $115, VarE "vec") - (AppE "map" [] [VarE "f",VarE "x"]), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (map, - FunDef {funName = "map", - funArgs = [f,vec], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:a] - (TyVar u:b), - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:b))), - funBody = AppE "generate" - [] - [PrimAppE (VLengthP (MetaTv $110)) - [VarE "vec"], - Ext (LambdaE [(i, MetaTv $112)] - (AppE "f" - [] - [PrimAppE (VNthP (MetaTv $111)) - [VarE "vec", - VarE "i"]]))], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lcopy, - FunDef {funName = "lcopy", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = AppE "copy" [] [VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (copy, - FunDef {funName = "copy", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = AppE "generate" - [] - [PrimAppE (VLengthP (MetaTv $93)) - [VarE "vec"], - Ext (LambdaE [(i, MetaTv $94)] - (AppE "nth" - [] - [VarE "vec", - VarE "i"]))], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (generate_loop, - FunDef {funName = "generate_loop", - funArgs = [vec,idx,end,f], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - IntTy,IntTy, - ArrowTy [IntTy] - (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = IfE (PrimAppE EqIntP - [VarE "idx",VarE "end"]) - (VarE "vec") - (LetE (vec1, - [], - MetaTv $86, - PrimAppE (InplaceVUpdateP (MetaTv $85)) - [VarE "vec", - VarE "idx", - AppE "f" - [] - [VarE "idx"]]) - (AppE "generate_loop" - [] - [VarE "vec1", - PrimAppE AddP - [VarE "idx", - LitE 1], - VarE "end",VarE "f"])), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (tail, - FunDef {funName = "tail", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = AppE "slice" - [] - [LitE 1, - PrimAppE SubP - [PrimAppE (VLengthP (MetaTv $80)) - [VarE "vec"], - LitE 1], - VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lsplitAt', - FunDef {funName = "lsplitAt'", - funArgs = [n,vec], - funTy = ForAll [u:a] - (ArrowTy [IntTy, - VectorTy (TyVar u:a)] - (ProdTy [IntTy, - VectorTy (TyVar u:a), - IntTy, - VectorTy (TyVar u:a)])), - funBody = LetE (tup74, - [], - MetaTv $75, - AppE "splitAt" - [] - [VarE "n",VarE "vec"]) - (LetE (x, - [], - MetaTv $77, - ProjE 0 (VarE "tup74")) - (LetE (y, - [], - MetaTv $76, - ProjE 1 (VarE "tup74")) - (MkProdE [PrimAppE (VLengthP (MetaTv $71)) - [VarE "x"], - VarE "x", - PrimAppE (VLengthP (MetaTv $73)) - [VarE "y"], - VarE "y"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (lsplitAt, - FunDef {funName = "lsplitAt", - funArgs = [n,vec], - funTy = ForAll [u:a] - (ArrowTy [IntTy, - VectorTy (TyVar u:a)] - (ProdTy [IntTy, - VectorTy (TyVar u:a), - IntTy, - VectorTy (TyVar u:a)])), - funBody = LetE (x, [], MetaTv $67, VarE "vec") - (AppE "lsplitAt'" - [] - [VarE "n",VarE "x"]), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (splitAt, - FunDef {funName = "splitAt", - funArgs = [n,vec], - funTy = ForAll [u:a] - (ArrowTy [IntTy, - VectorTy (TyVar u:a)] - (ProdTy [VectorTy (TyVar u:a), - VectorTy (TyVar u:a)])), - funBody = LetE (len, - [], - MetaTv $64, - PrimAppE (VLengthP (MetaTv $63)) - [VarE "vec"]) - (LetE (n', - [], - MetaTv $62, - AppE "maxInt" - [] - [VarE "n",LitE 0]) - (LetE (m, - [], - MetaTv $61, - AppE "minInt" - [] - [VarE "n'", - VarE "len"]) - (LetE (m', - [], - MetaTv $60, - AppE "maxInt" - [] - [LitE 0, - PrimAppE SubP - [VarE "len", - VarE "n'"]]) - (MkProdE [PrimAppE (VSliceP (MetaTv $58)) - [LitE 0, - VarE "m", - VarE "vec"], - PrimAppE (VSliceP (MetaTv $59)) - [VarE "m", - VarE "m'", - VarE "vec"]])))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (isEmpty, - FunDef {funName = "isEmpty", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - BoolTy), - funBody = PrimAppE EqIntP - [PrimAppE (VLengthP (MetaTv $51)) - [VarE "vec"], - LitE 0], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (inplaceUpdate, - FunDef {funName = "inplaceUpdate", - funArgs = [i,val,vec], - funTy = ForAll [u:a] - (ArrowTy [IntTy,TyVar u:a, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (InplaceVUpdateP (MetaTv $49)) - [VarE "vec",VarE "i", - VarE "val"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (inplaceSort, - FunDef {funName = "inplaceSort", - funArgs = [cmp,vec], - funTy = ForAll [u:a] - (ArrowTy [ArrowTy [TyVar u:a, - TyVar u:a] - IntTy, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (InplaceVSortP (MetaTv $45)) - [VarE "vec",VarE "cmp"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (flatten, - FunDef {funName = "flatten", - funArgs = [ls], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (VectorTy (TyVar u:a))] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (VConcatP (MetaTv $42)) - [VarE "ls"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (sort, - FunDef {funName = "sort", - funArgs = [cmp,vec], - funTy = ForAll [u:a] - (ArrowTy [ArrowTy [TyVar u:a, - TyVar u:a] - IntTy, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (VSortP (MetaTv $40)) - [VarE "vec",VarE "cmp"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (merge, - FunDef {funName = "merge", - funArgs = [vec1,vec2], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (VMergeP (MetaTv $37)) - [VarE "vec1",VarE "vec2"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (unsafeSlice, - FunDef {funName = "unsafeSlice", - funArgs = [i,n,vec], - funTy = ForAll [u:a] - (ArrowTy [IntTy,IntTy, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (VSliceP (MetaTv $34)) - [VarE "i",VarE "n",VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (slice, - FunDef {funName = "slice", - funArgs = [i,n,vec], - funTy = ForAll [u:a] - (ArrowTy [IntTy,IntTy, - VectorTy (TyVar u:a)] - (VectorTy (TyVar u:a))), - funBody = PrimAppE (VSliceP (MetaTv $30)) - [VarE "i",VarE "n",VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (nth2, - FunDef {funName = "nth2", - funArgs = [vec,i], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - IntTy] - (ProdTy [TyVar u:a, - VectorTy (TyVar u:a)])), - funBody = LetE (tup26, [], MetaTv $24, VarE "vec") - (LetE (vec1, - [], - MetaTv $24, - VarE "tup26") - (LetE (vec2, - [], - MetaTv $25, - VarE "tup26") - (MkProdE [PrimAppE (VNthP (MetaTv $23)) - [VarE "vec1", - VarE "i"], - VarE "vec2"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (nth1, - FunDef {funName = "nth1", - funArgs = [vec,i], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a), - IntTy] - (TyVar u:a)), - funBody = PrimAppE (VNthP (MetaTv $19)) - [VarE "vec",VarE "i"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (length2, - FunDef {funName = "length2", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - (ProdTy [IntTy, - VectorTy (TyVar u:a)])), - funBody = LetE (tup12, [], MetaTv $10, VarE "vec") - (LetE (vec1, - [], - MetaTv $10, - VarE "tup12") - (LetE (vec2, - [], - MetaTv $11, - VarE "tup12") - (MkProdE [PrimAppE (VLengthP (MetaTv $9)) - [VarE "vec1"], - VarE "vec2"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (length1, - FunDef {funName = "length1", - funArgs = [vec], - funTy = ForAll [u:a] - (ArrowTy [VectorTy (TyVar u:a)] - IntTy), - funBody = PrimAppE (VLengthP (MetaTv $6)) - [VarE "vec"], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing}) - [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 1 10 22, srcInfoPoints = [SrcSpan ".hs" 10 1 10 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 8 10 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], - ProgModule "Gibbon.Prim" - (Prog {ddefs = [], fundefs = [], mainExp = Nothing}) - [], - ProgModule "Gibbon.Prelude" - (Prog - {ddefs = [], - fundefs = [(maxInt, - FunDef {funName = "maxInt", - funArgs = [a,b], - funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), - funBody = IfE (PrimAppE GtP [VarE "a",VarE "b"]) - (VarE "a") - (VarE "b"), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (print_space, - FunDef {funName = "print_space", - funArgs = [wildcard_20], - funTy = ForAll [] - (ArrowTy [ProdTy []] (ProdTy [])), - funBody = PrimAppE PrintSym [LitSymE " "], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (print_newline, - FunDef {funName = "print_newline", - funArgs = [wildcard_18], - funTy = ForAll [] - (ArrowTy [ProdTy []] (ProdTy [])), - funBody = PrimAppE PrintSym [LitSymE "\n"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (print_check, - FunDef {funName = "print_check", - funArgs = [b], - funTy = ForAll [] (ArrowTy [BoolTy] (ProdTy [])), - funBody = IfE (VarE "b") - (LetE (wildcard_14, - [], - MetaTv $15, - PrimAppE PrintSym - [LitSymE "OK\n"]) - (MkProdE [])) - (LetE (wildcard_16, - [], - MetaTv $17, - PrimAppE PrintSym - [LitSymE "Err\n"]) - (MkProdE [])), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (compare_int, - FunDef {funName = "compare_int", - funArgs = [r1,r2], - funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), - funBody = IfE (PrimAppE LtP [VarE "r1",VarE "r2"]) - (PrimAppE SubP [LitE 0,LitE 1]) - (IfE (PrimAppE GtP - [VarE "r1",VarE "r2"]) - (LitE 1) - (LitE 0)), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (compare_float, - FunDef {funName = "compare_float", - funArgs = [r1,r2], - funTy = ForAll [] - (ArrowTy [FloatTy,FloatTy] IntTy), - funBody = IfE (PrimAppE FLtP [VarE "r1",VarE "r2"]) - (PrimAppE SubP [LitE 0,LitE 1]) - (IfE (PrimAppE FGtP - [VarE "r1",VarE "r2"]) - (LitE 1) - (LitE 0)), - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (float_abs, - FunDef {funName = "float_abs", - funArgs = [f], - funTy = ForAll [] (ArrowTy [FloatTy] FloatTy), - funBody = IfE (PrimAppE FLtP [VarE "f",FloatE 0.0]) - (PrimAppE FMulP - [VarE "f", - PrimAppE FSubP - [FloatE 0.0, - FloatE 1.0]]) - (VarE "f"), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (minFloat, - FunDef {funName = "minFloat", - funArgs = [a,b], - funTy = ForAll [] - (ArrowTy [FloatTy,FloatTy] FloatTy), - funBody = IfE (PrimAppE FLtP [VarE "a",VarE "b"]) - (VarE "a") - (VarE "b"), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (maxFloat, - FunDef {funName = "maxFloat", - funArgs = [a,b], - funTy = ForAll [] - (ArrowTy [FloatTy,FloatTy] FloatTy), - funBody = IfE (PrimAppE FGtP [VarE "a",VarE "b"]) - (VarE "a") - (VarE "b"), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (minInt, - FunDef {funName = "minInt", - funArgs = [a,b], - funTy = ForAll [] (ArrowTy [IntTy,IntTy] IntTy), - funBody = IfE (PrimAppE LtP [VarE "a",VarE "b"]) - (VarE "a") - (VarE "b"), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing}) - [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 12 1 12 19, srcInfoPoints = [SrcSpan ".hs" 12 1 12 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 12 8 12 19, srcInfoPoints = []}) "Gibbon.Prim", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], - ProgModule "Gibbon.PList" - (Prog - {ddefs = [(PList, - DDef {tyName = "PList", - tyArgs = [u:a], - dataCons = [("Nil", []), - ("Cons", - [(False, TyVar u:a), - (False, - PackedTy "PList" [TyVar u:a])])]})], - fundefs = [(is_empty_plist, - FunDef {funName = "is_empty_plist", - funArgs = [ls], - funTy = ForAll [u:a] - (ArrowTy [PackedTy "PList" - [TyVar u:a]] - BoolTy), - funBody = CaseE (VarE "ls") - [("Nil", [], PrimAppE MkTrue []), - ("Cons", - [(wildcard_1, MetaTv $3), - (wildcard_2, MetaTv $4)], - PrimAppE MkFalse [])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (zip_plist, - FunDef {funName = "zip_plist", - funArgs = [as,bs], - funTy = ForAll [u:a,u:b] - (ArrowTy [PackedTy "PList" - [TyVar u:a], - PackedTy "PList" - [TyVar u:b]] - (PackedTy "PList" - [ProdTy [TyVar u:a, - TyVar u:b]])), - funBody = CaseE (VarE "as") - [("Nil", - [], - DataConE (MetaTv $71) "Nil" []), - ("Cons", - [(z, MetaTv $76), - (zs, MetaTv $77)], - CaseE (VarE "bs") - [("Nil", - [], - DataConE (MetaTv $72) - "Nil" - []), - ("Cons", - [(y, MetaTv $74), - (ys, MetaTv $75)], - DataConE (MetaTv $73) - "Cons" - [MkProdE [VarE "z", - VarE "y"], - AppE "zip_plist" - [] - [VarE "zs", - VarE "ys"]])])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (splitAt_plist, - FunDef {funName = "splitAt_plist", - funArgs = [n,a], - funTy = ForAll [u:a] - (ArrowTy [IntTy, - PackedTy "PList" - [TyVar u:a]] - (ProdTy [PackedTy "PList" - [TyVar u:a], - PackedTy "PList" - [TyVar u:a]])), - funBody = IfE (PrimAppE EqIntP [VarE "n",LitE 0]) - (MkProdE [DataConE (MetaTv $59) - "Nil" - [], - VarE "a"]) - (CaseE (VarE "a") - [("Nil", - [], - MkProdE [DataConE (MetaTv $60) - "Nil" - [], - DataConE (MetaTv $61) - "Nil" - []]), - ("Cons", - [(x, MetaTv $67), - (xs, MetaTv $68)], - LetE (tup63, - [], - MetaTv $64, - AppE "splitAt_plist" - [] - [PrimAppE SubP - [VarE "n", - LitE 1], - VarE "xs"]) - (LetE (c, - [], - MetaTv $66, - ProjE 0 - (VarE "tup63")) - (LetE (d, - [], - MetaTv $65, - ProjE 1 - (VarE "tup63")) - (MkProdE [DataConE (MetaTv $62) - "Cons" - [VarE "x", - VarE "c"], - VarE "d"]))))]), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (map_plist, - FunDef {funName = "map_plist", - funArgs = [f,ls], - funTy = ForAll [u:a,u:b] - (ArrowTy [ArrowTy [TyVar u:a] - (TyVar u:b), - PackedTy "PList" - [TyVar u:a]] - (PackedTy "PList" - [TyVar u:b])), - funBody = CaseE (VarE "ls") - [("Nil", - [], - DataConE (MetaTv $53) "Nil" []), - ("Cons", - [(x, MetaTv $55), - (xs, MetaTv $56)], - DataConE (MetaTv $54) - "Cons" - [AppE "f" [] [VarE "x"], - AppE "map_plist" - [] - [VarE "f", - VarE "xs"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (reverse_plist, - FunDef {funName = "reverse_plist", - funArgs = [xs,acc], - funTy = ForAll [u:a] - (ArrowTy [PackedTy "PList" - [TyVar u:a], - PackedTy "PList" - [TyVar u:a]] - (PackedTy "PList" - [TyVar u:a])), - funBody = CaseE (VarE "xs") - [("Nil", [], VarE "acc"), - ("Cons", - [(z, MetaTv $49), - (zs, MetaTv $50)], - AppE "reverse_plist" - [] - [VarE "zs", - DataConE (MetaTv $48) - "Cons" - [VarE "z", - VarE "acc"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (drop_plist, - FunDef {funName = "drop_plist", - funArgs = [num,list], - funTy = ForAll [u:a] - (ArrowTy [IntTy, - PackedTy "PList" - [TyVar u:a]] - (PackedTy "PList" - [TyVar u:a])), - funBody = CaseE (VarE "list") - [("Nil", - [], - DataConE (MetaTv $42) "Nil" []), - ("Cons", - [(x, MetaTv $44), - (rst, MetaTv $45)], - IfE (PrimAppE LtEqP - [VarE "num", - LitE 0]) - (DataConE (MetaTv $43) - "Cons" - [VarE "x", - VarE "rst"]) - (AppE "drop_plist" - [] - [PrimAppE SubP - [VarE "num", - LitE 1], - VarE "rst"]))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (take_plist, - FunDef {funName = "take_plist", - funArgs = [n,a], - funTy = ForAll [u:a] - (ArrowTy [IntTy, - PackedTy "PList" - [TyVar u:a]] - (PackedTy "PList" - [TyVar u:a])), - funBody = IfE (PrimAppE EqIntP [VarE "n",LitE 0]) - (DataConE (MetaTv $35) "Nil" []) - (CaseE (VarE "a") - [("Nil", - [], - DataConE (MetaTv $36) - "Nil" - []), - ("Cons", - [(z, MetaTv $38), - (zs, MetaTv $39)], - DataConE (MetaTv $37) - "Cons" - [VarE "z", - AppE "take_plist" - [] - [PrimAppE SubP - [VarE "n", - LitE 1], - VarE "zs"]])]), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (filter_plist, - FunDef {funName = "filter_plist", - funArgs = [f,a], - funTy = ForAll [u:a] - (ArrowTy [ArrowTy [TyVar u:a] - BoolTy, - PackedTy "PList" - [TyVar u:a]] - (PackedTy "PList" - [TyVar u:a])), - funBody = CaseE (VarE "a") - [("Nil", - [], - DataConE (MetaTv $29) "Nil" []), - ("Cons", - [(z, MetaTv $31), - (zs, MetaTv $32)], - IfE (AppE "f" [] [VarE "z"]) - (DataConE (MetaTv $30) - "Cons" - [VarE "z", - AppE "filter_plist" - [] - [VarE "f", - VarE "zs"]]) - (AppE "filter_plist" - [] - [VarE "f", - VarE "zs"]))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (length_plist, - FunDef {funName = "length_plist", - funArgs = [a], - funTy = ForAll [u:a] - (ArrowTy [PackedTy "PList" - [TyVar u:a]] - IntTy), - funBody = CaseE (VarE "a") - [("Nil", [], LitE 0), - ("Cons", - [(x, MetaTv $25), - (xs, MetaTv $26)], - PrimAppE AddP - [LitE 1, - AppE "length_plist" - [] - [VarE "xs"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (nth_plist, - FunDef {funName = "nth_plist", - funArgs = [list,def,index,start], - funTy = ForAll [u:a] - (ArrowTy [PackedTy "PList" - [TyVar u:a], - TyVar u:a,IntTy,IntTy] - (TyVar u:a)), - funBody = CaseE (VarE "list") - [("Nil", [], VarE "def"), - ("Cons", - [(x, MetaTv $22), - (rst, MetaTv $23)], - IfE (PrimAppE EqIntP - [VarE "index", - VarE "start"]) - (VarE "x") - (AppE "nth_plist" - [] - [VarE "rst",VarE "def", - VarE "index", - PrimAppE AddP - [VarE "start", - LitE 1]]))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (elem_plist, - FunDef {funName = "elem_plist", - funArgs = [cmp,a,list], - funTy = ForAll [u:a] - (ArrowTy [ArrowTy [TyVar u:a, - TyVar u:a] - IntTy, - TyVar u:a, - PackedTy "PList" - [TyVar u:a]] - BoolTy), - funBody = CaseE (VarE "list") - [("Nil", [], PrimAppE MkFalse []), - ("Cons", - [(x, MetaTv $16), - (rst, MetaTv $17)], - IfE (PrimAppE EqIntP - [AppE "cmp" - [] - [VarE "x", - VarE "a"], - LitE 0]) - (PrimAppE MkTrue []) - (AppE "elem_plist" - [] - [VarE "cmp",VarE "a", - VarE "rst"]))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (tail_plist, - FunDef {funName = "tail_plist", - funArgs = [ls], - funTy = ForAll [u:a] - (ArrowTy [PackedTy "PList" - [TyVar u:a]] - (PackedTy "PList" - [TyVar u:a])), - funBody = CaseE (VarE "ls") - [("Cons", - [(wildcard_10, MetaTv $11), - (xs, MetaTv $12)], - VarE "xs")], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (head_plist, - FunDef {funName = "head_plist", - funArgs = [ls], - funTy = ForAll [u:a] - (ArrowTy [PackedTy "PList" - [TyVar u:a]] - (TyVar u:a)), - funBody = CaseE (VarE "ls") - [("Cons", - [(x, MetaTv $7), - (wildcard_6, MetaTv $8)], - VarE "x")], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing}) - [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 1 8 22, srcInfoPoints = [SrcSpan ".hs" 8 1 8 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 8 8 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}], - ProgModule "Basics" - (Prog - {ddefs = [(Inline, - DDef {tyName = "Inline", - tyArgs = [], - dataCons = [("Str", [(False, VectorTy CharTy)]), - ("Emph", - [(False, - PackedTy "PList" - [PackedTy "Inline" []])]), - ("Space", [])]}), - (Block, - DDef {tyName = "Block", - tyArgs = [], - dataCons = [("Plain", - [(False, - PackedTy "PList" - [PackedTy "Inline" []])]), - ("Null", [])]}), - (BlogHeader, - DDef {tyName = "BlogHeader", - tyArgs = [], - dataCons = [("Header", [(False, VectorTy CharTy)])]}), - (BlogId, - DDef {tyName = "BlogId", - tyArgs = [], - dataCons = [("ID", [(False, IntTy)])]}), - (BlogAuthor, - DDef {tyName = "BlogAuthor", - tyArgs = [], - dataCons = [("Author", [(False, VectorTy CharTy)])]}), - (BlogDate, - DDef {tyName = "BlogDate", - tyArgs = [], - dataCons = [("Date", [(False, VectorTy CharTy)])]}), - (BlogContent, - DDef {tyName = "BlogContent", - tyArgs = [], - dataCons = [("Content", - [(False, PackedTy "Block" [])])]}), - (BlogTags, - DDef {tyName = "BlogTags", - tyArgs = [], - dataCons = [("TagList", - [(False, - PackedTy "PList" - [VectorTy CharTy])])]}), - (Blog, - DDef {tyName = "Blog", - tyArgs = [], - dataCons = [("End", []), - ("Layout1", - [(False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" []), - (False, PackedTy "BlogContent" []), - (False, PackedTy "BlogTags" []), - (False, PackedTy "Blog" [])]), - ("Layout2", - [(False, PackedTy "BlogContent" []), - (False, PackedTy "BlogTags" []), - (False, PackedTy "Blog" []), - (False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" [])]), - ("Layout3", - [(False, PackedTy "BlogTags" []), - (False, PackedTy "Blog" []), - (False, PackedTy "BlogContent" []), - (False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" [])]), - ("Layout4", - [(False, PackedTy "BlogTags" []), - (False, PackedTy "BlogContent" []), - (False, PackedTy "Blog" []), - (False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" [])]), - ("Layout5", - [(False, PackedTy "Blog" []), - (False, PackedTy "BlogTags" []), - (False, PackedTy "BlogContent" []), - (False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" [])]), - ("Layout6", - [(False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" []), - (False, PackedTy "BlogContent" []), - (False, PackedTy "Blog" []), - (False, PackedTy "BlogTags" [])]), - ("Layout7", - [(False, PackedTy "Blog" []), - (False, PackedTy "BlogContent" []), - (False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" []), - (False, PackedTy "BlogTags" [])]), - ("Layout8", - [(False, PackedTy "BlogContent" []), - (False, PackedTy "Blog" []), - (False, PackedTy "BlogId" []), - (False, PackedTy "BlogAuthor" []), - (False, PackedTy "BlogDate" []), - (False, PackedTy "BlogHeader" []), - (False, PackedTy "BlogTags" [])])]})], - fundefs = [(emphasizeKeywordInBlock, - FunDef {funName = "emphasizeKeywordInBlock", - funArgs = [keyword,contentBlock], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "Block" []] - (PackedTy "Block" [])), - funBody = CaseE (VarE "contentBlock") - [("Plain", - [(list_inline, MetaTv $91)], - DataConE (MetaTv $90) - "Plain" - [AppE "emphasizeInlineListForKeyword" - [] - [VarE "keyword", - VarE "list_inline"]]), - ("Null", - [], - DataConE (MetaTv $92) - "Null" - [])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printBlog, - FunDef {funName = "printBlog", - funArgs = [blog], - funTy = ForAll [] - (ArrowTy [PackedTy "Blog" []] - (ProdTy [])), - funBody = CaseE (VarE "blog") - [("Layout1", - [(header, MetaTv $346), - (id, MetaTv $347), - (author, MetaTv $348), - (date, MetaTv $349), - (content, MetaTv $350), - (tags, MetaTv $351), - (rst, MetaTv $352)], - LetE (wildcard_344, - [], - MetaTv $345, - PrimAppE PrintSym - [LitSymE "Layout1 "]) - (LetE (wildcard_342, - [], - MetaTv $343, - AppE "printHeader" - [] - [VarE "header"]) - (LetE (wildcard_340, - [], - MetaTv $341, - AppE "printID" - [] - [VarE "id"]) - (LetE (wildcard_338, - [], - MetaTv $339, - AppE "printAuthor" - [] - [VarE "author"]) - (LetE (wildcard_336, - [], - MetaTv $337, - AppE "printDate" - [] - [VarE "date"]) - (LetE (wildcard_334, - [], - MetaTv $335, - AppE "printContent" - [] - [VarE "content"]) - (LetE (wildcard_332, - [], - MetaTv $333, - AppE "printTagList" - [] - [VarE "tags"]) - (LetE (wildcard_330, - [], - MetaTv $331, - AppE "printBlog" - [] - [VarE "rst"]) - (MkProdE [])))))))))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (getChar, - FunDef {funName = "getChar", - funArgs = [decimal], - funTy = ForAll [] (ArrowTy [IntTy] CharTy), - funBody = IfE (PrimAppE EqIntP - [VarE "decimal",LitE 0]) - (CharE 'a') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 1]) - (CharE 'b') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 2]) - (CharE 'c') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 3]) - (CharE 'd') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 4]) - (CharE 'e') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 5]) - (CharE 'f') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 6]) - (CharE 'g') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 7]) - (CharE 'h') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 8]) - (CharE 'i') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 9]) - (CharE 'j') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 10]) - (CharE 'k') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 11]) - (CharE 'l') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 12]) - (CharE 'm') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 13]) - (CharE 'n') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 14]) - (CharE 'o') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 15]) - (CharE 'p') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 16]) - (CharE 'q') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 17]) - (CharE 'r') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 18]) - (CharE 's') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 19]) - (CharE 't') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 20]) - (CharE 'u') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 21]) - (CharE 'v') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 22]) - (CharE 'w') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 23]) - (CharE 'x') - (IfE (PrimAppE EqIntP - [VarE "decimal", - LitE 24]) - (CharE 'y') - (CharE 'z'))))))))))))))))))))))))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printInline, - FunDef {funName = "printInline", - funArgs = [inline], - funTy = ForAll [] - (ArrowTy [PackedTy "Inline" []] - (ProdTy [])), - funBody = CaseE (VarE "inline") - [("Str", - [(text, MetaTv $394)], - LetE (wildcard_392, - [], - MetaTv $393, - PrimAppE PrintSym - [LitSymE "Str "]) - (LetE (wildcard_390, - [], - MetaTv $391, - AppE "printVec" - [] - [Ext (LambdaE [(i, - MetaTv $389)] - (PrimAppE PrintChar - [VarE "i"])), - VarE "text"]) - (MkProdE []))), - ("Emph", - [(plist, MetaTv $399)], - LetE (wildcard_397, - [], - MetaTv $398, - PrimAppE PrintSym - [LitSymE "Emph "]) - (LetE (wildcard_395, - [], - MetaTv $396, - AppE "printPlistInline" - [] - [VarE "plist"]) - (MkProdE []))), - ("Space", - [], - LetE (wildcard_400, - [], - MetaTv $401, - PrimAppE PrintSym - [LitSymE "Space "]) - (MkProdE []))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printPlistText, - FunDef {funName = "printPlistText", - funArgs = [list], - funTy = ForAll [] - (ArrowTy [PackedTy "PList" - [VectorTy CharTy]] - (ProdTy [])), - funBody = CaseE (VarE "list") - [("Cons", - [(x, MetaTv $384), - (rst, MetaTv $385)], - LetE (wildcard_382, - [], - MetaTv $383, - PrimAppE PrintSym - [LitSymE "PList ( Cons "]) - (LetE (wildcard_380, - [], - MetaTv $381, - AppE "printVec" - [] - [Ext (LambdaE [(i, - MetaTv $379)] - (PrimAppE PrintChar - [VarE "i"])), - VarE "x"]) - (LetE (wildcard_377, - [], - MetaTv $378, - AppE "printPlistText" - [] - [VarE "rst"]) - (LetE (wildcard_375, - [], - MetaTv $376, - PrimAppE PrintSym - [LitSymE " ) "]) - (MkProdE []))))), - ("Nil", - [], - LetE (wildcard_386, - [], - MetaTv $387, - PrimAppE PrintSym - [LitSymE "Nil"]) - (MkProdE []))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printPlistInline, - FunDef {funName = "printPlistInline", - funArgs = [list], - funTy = ForAll [] - (ArrowTy [PackedTy "PList" - [PackedTy "Inline" - []]] - (ProdTy [])), - funBody = CaseE (VarE "list") - [("Cons", - [(x, MetaTv $370), - (rst, MetaTv $371)], - LetE (wildcard_368, - [], - MetaTv $369, - PrimAppE PrintSym - [LitSymE "PList ( Cons "]) - (LetE (wildcard_366, - [], - MetaTv $367, - AppE "printInline" - [] - [VarE "x"]) - (LetE (wildcard_364, - [], - MetaTv $365, - AppE "printPlistInline" - [] - [VarE "rst"]) - (LetE (wildcard_362, - [], - MetaTv $363, - PrimAppE PrintSym - [LitSymE " ) "]) - (MkProdE []))))), - ("Nil", - [], - LetE (wildcard_372, - [], - MetaTv $373, - PrimAppE PrintSym - [LitSymE "Nil"]) - (MkProdE []))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printBlock, - FunDef {funName = "printBlock", - funArgs = [block], - funTy = ForAll [] - (ArrowTy [PackedTy "Block" []] - (ProdTy [])), - funBody = CaseE (VarE "block") - [("Plain", - [(plist, MetaTv $358)], - LetE (wildcard_356, - [], - MetaTv $357, - PrimAppE PrintSym - [LitSymE "Plain "]) - (LetE (wildcard_354, - [], - MetaTv $355, - AppE "printPlistInline" - [] - [VarE "plist"]) - (MkProdE []))), - ("Null", - [], - LetE (wildcard_359, - [], - MetaTv $360, - PrimAppE PrintSym - [LitSymE "Null"]) - (MkProdE []))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printID, - FunDef {funName = "printID", - funArgs = [id], - funTy = ForAll [] - (ArrowTy [PackedTy "BlogId" []] - (ProdTy [])), - funBody = CaseE (VarE "id") - [("ID", - [(val, MetaTv $328)], - LetE (wildcard_326, - [], - MetaTv $327, - PrimAppE PrintSym - [LitSymE "ID "]) - (LetE (wildcard_324, - [], - MetaTv $325, - PrimAppE PrintInt - [VarE "val"]) - (MkProdE [])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printHeader, - FunDef {funName = "printHeader", - funArgs = [header], - funTy = ForAll [] - (ArrowTy [PackedTy "BlogHeader" []] - (ProdTy [])), - funBody = CaseE (VarE "header") - [("Header", - [(str, MetaTv $322)], - LetE (wildcard_320, - [], - MetaTv $321, - PrimAppE PrintSym - [LitSymE "Header "]) - (LetE (wildcard_318, - [], - MetaTv $319, - AppE "printVec" - [] - [Ext (LambdaE [(i, - MetaTv $317)] - (PrimAppE PrintChar - [VarE "i"])), - VarE "str"]) - (MkProdE [])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printAuthor, - FunDef {funName = "printAuthor", - funArgs = [date], - funTy = ForAll [] - (ArrowTy [PackedTy "BlogAuthor" []] - (ProdTy [])), - funBody = CaseE (VarE "date") - [("Author", - [(str, MetaTv $315)], - LetE (wildcard_313, - [], - MetaTv $314, - PrimAppE PrintSym - [LitSymE "Author "]) - (LetE (wildcard_311, - [], - MetaTv $312, - AppE "printVec" - [] - [Ext (LambdaE [(i, - MetaTv $310)] - (PrimAppE PrintChar - [VarE "i"])), - VarE "str"]) - (MkProdE [])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printDate, - FunDef {funName = "printDate", - funArgs = [date], - funTy = ForAll [] - (ArrowTy [PackedTy "BlogDate" []] - (ProdTy [])), - funBody = CaseE (VarE "date") - [("Date", - [(str, MetaTv $308)], - LetE (wildcard_306, - [], - MetaTv $307, - PrimAppE PrintSym - [LitSymE "Date "]) - (LetE (wildcard_304, - [], - MetaTv $305, - AppE "printVec" - [] - [Ext (LambdaE [(i, - MetaTv $303)] - (PrimAppE PrintChar - [VarE "i"])), - VarE "str"]) - (MkProdE [])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printTagList, - FunDef {funName = "printTagList", - funArgs = [tags], - funTy = ForAll [] - (ArrowTy [PackedTy "BlogTags" []] - (ProdTy [])), - funBody = CaseE (VarE "tags") - [("TagList", - [(plist, MetaTv $301)], - LetE (wildcard_299, - [], - MetaTv $300, - PrimAppE PrintSym - [LitSymE "TagList "]) - (LetE (wildcard_297, - [], - MetaTv $298, - AppE "printPlistText" - [] - [VarE "plist"]) - (MkProdE [])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printContent, - FunDef {funName = "printContent", - funArgs = [content], - funTy = ForAll [] - (ArrowTy [PackedTy "BlogContent" []] - (ProdTy [])), - funBody = CaseE (VarE "content") - [("Content", - [(block, MetaTv $295)], - LetE (wildcard_293, - [], - MetaTv $294, - PrimAppE PrintSym - [LitSymE "Content "]) - (LetE (wildcard_291, - [], - MetaTv $292, - AppE "printBlock" - [] - [VarE "block"]) - (MkProdE [])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (blogLength, - FunDef {funName = "blogLength", - funArgs = [blog], - funTy = ForAll [] - (ArrowTy [PackedTy "Blog" []] - IntTy), - funBody = CaseE (VarE "blog") - [("End", [], LitE 0), - ("Layout1", - [(a, MetaTv $234), - (b, MetaTv $235), - (c, MetaTv $236), - (d, MetaTv $237), - (e, MetaTv $238), - (f, MetaTv $239), - (rst, MetaTv $240)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]]), - ("Layout2", - [(a, MetaTv $241), - (b, MetaTv $242), - (rst, MetaTv $243), - (c, MetaTv $244), - (d, MetaTv $245), - (e, MetaTv $246), - (f, MetaTv $247)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]]), - ("Layout3", - [(a, MetaTv $248), - (rst, MetaTv $249), - (b, MetaTv $250), - (c, MetaTv $251), - (d, MetaTv $252), - (e, MetaTv $253), - (f, MetaTv $254)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]]), - ("Layout4", - [(a, MetaTv $255), - (b, MetaTv $256), - (rst, MetaTv $257), - (d, MetaTv $258), - (e, MetaTv $259), - (f, MetaTv $260), - (g, MetaTv $261)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]]), - ("Layout5", - [(rst, MetaTv $262), - (a, MetaTv $263), - (b, MetaTv $264), - (c, MetaTv $265), - (d, MetaTv $266), - (e, MetaTv $267), - (f, MetaTv $268)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]]), - ("Layout6", - [(a, MetaTv $269), - (b, MetaTv $270), - (c, MetaTv $271), - (d, MetaTv $272), - (e, MetaTv $273), - (rst, MetaTv $274), - (f, MetaTv $275)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]]), - ("Layout7", - [(rst, MetaTv $276), - (a, MetaTv $277), - (b, MetaTv $278), - (c, MetaTv $279), - (d, MetaTv $280), - (e, MetaTv $281), - (f, MetaTv $282)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]]), - ("Layout8", - [(a, MetaTv $283), - (rst, MetaTv $284), - (b, MetaTv $285), - (c, MetaTv $286), - (d, MetaTv $287), - (e, MetaTv $288), - (f, MetaTv $289)], - PrimAppE AddP - [LitE 1, - AppE "blogLength" - [] - [VarE "rst"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkBlockList, - FunDef {funName = "mkBlockList", - funArgs = [length,base], - funTy = ForAll [] - (ArrowTy [IntTy,IntTy] - (PackedTy "PList" - [PackedTy "Block" - []])), - funBody = IfE (PrimAppE LtEqP - [VarE "length",LitE 0]) - (DataConE (MetaTv $224) "Nil" []) - (IfE (PrimAppE EqIntP - [VarE "base",LitE 0]) - (LetE (item, - [], - MetaTv $228, - DataConE (MetaTv $227) - "Plain" - [AppE "mkInlineList" - [] - [LitE 1000, - LitE 1]]) - (LetE (rst, - [], - MetaTv $226, - AppE "mkBlockList" - [] - [PrimAppE SubP - [VarE "length", - LitE 1], - VarE "base"]) - (DataConE (MetaTv $225) - "Cons" - [VarE "item", - VarE "rst"]))) - (LetE (item, - [], - MetaTv $232, - DataConE (MetaTv $231) - "Null" - []) - (LetE (rst, - [], - MetaTv $230, - AppE "mkBlockList" - [] - [PrimAppE SubP - [VarE "length", - LitE 1], - VarE "base"]) - (DataConE (MetaTv $229) - "Cons" - [VarE "item", - VarE "rst"])))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkSomeTags, - FunDef {funName = "mkSomeTags", - funArgs = [len], - funTy = ForAll [] - (ArrowTy [IntTy] - (PackedTy "PList" - [VectorTy CharTy])), - funBody = IfE (PrimAppE LtEqP [VarE "len",LitE 0]) - (DataConE (MetaTv $217) "Nil" []) - (LetE (word, - [], - MetaTv $221, - LetE (vec220, - [], - VectorTy CharTy, - PrimAppE (VAllocP CharTy) - [LitE 1]) - (LetE (_, - [], - VectorTy CharTy, - PrimAppE (InplaceVUpdateP CharTy) - [VarE "vec220", - LitE 0, - CharE 'a']) - (VarE "vec220"))) - (LetE (rst, - [], - MetaTv $219, - AppE "mkSomeTags" - [] - [PrimAppE SubP - [VarE "len", - LitE 1]]) - (DataConE (MetaTv $218) - "Cons" - [VarE "word", - VarE "rst"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkRandomInlineList, - FunDef {funName = "mkRandomInlineList", - funArgs = [len], - funTy = ForAll [] - (ArrowTy [IntTy] - (PackedTy "PList" - [PackedTy "Inline" - []])), - funBody = IfE (PrimAppE LtEqP [VarE "len",LitE 0]) - (DataConE (MetaTv $211) "Nil" []) - (LetE (word, - [], - MetaTv $215, - DataConE (MetaTv $214) - "Str" - [AppE "getRandomString" - [] - [LitE 1]]) - (LetE (rst, - [], - MetaTv $213, - AppE "mkRandomInlineList" - [] - [PrimAppE SubP - [VarE "len", - LitE 1]]) - (DataConE (MetaTv $212) - "Cons" - [VarE "word", - VarE "rst"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkInlineList', - FunDef {funName = "mkInlineList'", - funArgs = [length,index,words], - funTy = ForAll [] - (ArrowTy [IntTy,IntTy, - VectorTy (VectorTy CharTy)] - (PackedTy "PList" - [PackedTy "Inline" - []])), - funBody = IfE (PrimAppE GtEqP - [VarE "index", - VarE "length"]) - (DataConE (MetaTv $205) "Nil" []) - (LetE (item, - [], - MetaTv $209, - DataConE (MetaTv $208) - "Str" - [AppE "nth" - [] - [VarE "words", - VarE "index"]]) - (LetE (rst, - [], - MetaTv $207, - AppE "mkInlineList'" - [] - [VarE "length", - PrimAppE AddP - [VarE "index", - LitE 1], - VarE "words"]) - (DataConE (MetaTv $206) - "Cons" - [VarE "item", - VarE "rst"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkInlineList, - FunDef {funName = "mkInlineList", - funArgs = [length,base], - funTy = ForAll [] - (ArrowTy [IntTy,IntTy] - (PackedTy "PList" - [PackedTy "Inline" - []])), - funBody = IfE (PrimAppE LtEqP - [VarE "length",LitE 0]) - (DataConE (MetaTv $194) "Nil" []) - (IfE (PrimAppE EqIntP - [VarE "base",LitE 0]) - (LetE (item, - [], - MetaTv $198, - DataConE (MetaTv $197) - "Emph" - [AppE "mkInlineList" - [] - [LitE 100, - LitE 1]]) - (LetE (rst, - [], - MetaTv $196, - AppE "mkInlineList" - [] - [PrimAppE SubP - [VarE "length", - LitE 1], - VarE "base"]) - (DataConE (MetaTv $195) - "Cons" - [VarE "item", - VarE "rst"]))) - (LetE (item, - [], - MetaTv $201, - AppE "mkInlineBaseCase" - [] - [PrimAppE ModP - [PrimAppE RandP - [], - LitE 4]]) - (LetE (rst, - [], - MetaTv $200, - AppE "mkInlineList" - [] - [PrimAppE SubP - [VarE "length", - LitE 1], - VarE "base"]) - (DataConE (MetaTv $199) - "Cons" - [VarE "item", - VarE "rst"])))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkInlineBaseCase, - FunDef {funName = "mkInlineBaseCase", - funArgs = [option], - funTy = ForAll [] - (ArrowTy [IntTy] - (PackedTy "Inline" [])), - funBody = IfE (PrimAppE EqIntP - [VarE "option",LitE 0]) - (DataConE (MetaTv $190) - "Str" - [AppE "getRandomString" - [] - [LitE 5]]) - (DataConE (MetaTv $191) "Space" []), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkContentFromText, - FunDef {funName = "mkContentFromText", - funArgs = [f], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy] - (PackedTy "BlogContent" - [])), - funBody = LetE (block, - [], - MetaTv $188, - AppE "fileToContent" - [] - [VarE "f", - AppE "singleton" - [] - [AppE "nth" - [] - [VarE "f", - LitE 0]], - DataConE (MetaTv $186) - "Nil" - [], - LitE 1, - PrimAppE (VLengthP (MetaTv $187)) - [VarE "f"]]) - (LetE (content, - [], - MetaTv $185, - AppE "mkBlogContent" - [] - [VarE "block"]) - (VarE "content")), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkTagsFromText, - FunDef {funName = "mkTagsFromText", - funArgs = [f'], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy] - (PackedTy "BlogTags" [])), - funBody = LetE (tags, - [], - MetaTv $183, - AppE "fileToTags" - [] - [VarE "f'", - AppE "singleton" - [] - [AppE "nth" - [] - [VarE "f'", - LitE 0]], - LitE 1, - PrimAppE (VLengthP (MetaTv $182)) - [VarE "f'"]]) - (LetE (tags', - [], - MetaTv $181, - DataConE (MetaTv $180) - "TagList" - [VarE "tags"]) - (VarE "tags'")), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (fileToTags, - FunDef {funName = "fileToTags", - funArgs = [file,word,index,max_len], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - VectorTy CharTy,IntTy, - IntTy] - (PackedTy "PList" - [VectorTy CharTy])), - funBody = IfE (PrimAppE GtEqP - [VarE "index", - VarE "max_len"]) - (DataConE (MetaTv $174) "Nil" []) - (LetE (character, - [], - CharTy, - AppE "nth" - [] - [VarE "file", - VarE "index"]) - (LetE (isSpace, - [], - MetaTv $178, - IfE (PrimAppE EqCharP - [VarE "character", - AppE "head" - [] - [LetE (vec177, - [], - VectorTy CharTy, - PrimAppE (VAllocP CharTy) - [LitE 1]) - (LetE (_, - [], - VectorTy CharTy, - PrimAppE (InplaceVUpdateP CharTy) - [VarE "vec177", - LitE 0, - CharE ' ']) - (VarE "vec177"))]]) - (PrimAppE MkTrue []) - (PrimAppE MkFalse - [])) - (LetE (char_vec, - [], - MetaTv $176, - AppE "singleton" - [] - [VarE "character"]) - (IfE (VarE "isSpace") - (DataConE (MetaTv $175) - "Cons" - [VarE "word", - AppE "fileToTags" - [] - [VarE "file", - AppE "singleton" - [] - [AppE "nth" - [] - [VarE "file", - PrimAppE AddP - [VarE "index", - LitE 1]]], - PrimAppE AddP - [VarE "index", - LitE 2], - VarE "max_len"]]) - (AppE "fileToTags" - [] - [VarE "file", - AppE "append" - [] - [VarE "word", - VarE "char_vec"], - PrimAppE AddP - [VarE "index", - LitE 1], - VarE "max_len"]))))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (printWordList, - FunDef {funName = "printWordList", - funArgs = [vec,start,end], - funTy = ForAll [] - (ArrowTy [VectorTy (VectorTy CharTy), - IntTy,IntTy] - (ProdTy [])), - funBody = IfE (PrimAppE LtP - [VarE "start",VarE "end"]) - (LetE (element, - [], - MetaTv $169, - AppE "nth" - [] - [VarE "vec", - VarE "start"]) - (LetE (wildcard_167, - [], - MetaTv $168, - AppE "printVec" - [] - [Ext (LambdaE [(i, - MetaTv $166)] - (PrimAppE PrintChar - [VarE "i"])), - VarE "element"]) - (AppE "printWordList" - [] - [VarE "vec", - PrimAppE AddP - [VarE "start", - LitE 1], - VarE "end"]))) - (MkProdE []), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (fileToContent', - FunDef {funName = "fileToContent'", - funArgs = [file,word,running_list,index,max_len], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - VectorTy CharTy, - VectorTy (VectorTy CharTy), - IntTy,IntTy] - (VectorTy (VectorTy CharTy))), - funBody = IfE (PrimAppE GtEqP - [VarE "index", - VarE "max_len"]) - (AppE "append" - [] - [VarE "running_list", - PrimAppE (VAllocP (MetaTv $158)) - [LitE 0]]) - (LetE (character, - [], - CharTy, - AppE "nth" - [] - [VarE "file", - VarE "index"]) - (LetE (isSpace, - [], - MetaTv $162, - IfE (PrimAppE EqCharP - [VarE "character", - AppE "head" - [] - [LetE (vec161, - [], - VectorTy CharTy, - PrimAppE (VAllocP CharTy) - [LitE 1]) - (LetE (_, - [], - VectorTy CharTy, - PrimAppE (InplaceVUpdateP CharTy) - [VarE "vec161", - LitE 0, - CharE ' ']) - (VarE "vec161"))]]) - (PrimAppE MkTrue []) - (PrimAppE MkFalse - [])) - (LetE (char_vec, - [], - MetaTv $160, - AppE "singleton" - [] - [VarE "character"]) - (IfE (VarE "isSpace") - (AppE "fileToContent'" - [] - [VarE "file", - AppE "singleton" - [] - [AppE "nth" - [] - [VarE "file", - PrimAppE AddP - [VarE "index", - LitE 1]]], - AppE "append" - [] - [VarE "running_list", - AppE "generate" - [] - [LitE 1, - Ext (LambdaE [(i, - MetaTv $159)] - (VarE "word"))]], - PrimAppE AddP - [VarE "index", - LitE 2], - VarE "max_len"]) - (AppE "fileToContent'" - [] - [VarE "file", - AppE "append" - [] - [VarE "word", - VarE "char_vec"], - VarE "running_list", - PrimAppE AddP - [VarE "index", - LitE 1], - VarE "max_len"]))))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (fileToContent, - FunDef {funName = "fileToContent", - funArgs = [file,word,plist_inline,index,max_len], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - VectorTy CharTy, - PackedTy "PList" - [PackedTy "Inline" - []], - IntTy,IntTy] - (PackedTy "Block" [])), - funBody = IfE (PrimAppE GtEqP - [VarE "index", - VarE "max_len"]) - (DataConE (MetaTv $147) - "Plain" - [VarE "plist_inline"]) - (LetE (character, - [], - CharTy, - AppE "nth" - [] - [VarE "file", - VarE "index"]) - (LetE (isSpace, - [], - MetaTv $152, - IfE (PrimAppE EqCharP - [VarE "character", - AppE "head" - [] - [LetE (vec151, - [], - VectorTy CharTy, - PrimAppE (VAllocP CharTy) - [LitE 1]) - (LetE (_, - [], - VectorTy CharTy, - PrimAppE (InplaceVUpdateP CharTy) - [VarE "vec151", - LitE 0, - CharE ' ']) - (VarE "vec151"))]]) - (PrimAppE MkTrue []) - (PrimAppE MkFalse - [])) - (LetE (char_vec, - [], - MetaTv $150, - AppE "singleton" - [] - [VarE "character"]) - (IfE (VarE "isSpace") - (AppE "fileToContent" - [] - [VarE "file", - AppE "singleton" - [] - [AppE "nth" - [] - [VarE "file", - PrimAppE AddP - [VarE "index", - LitE 1]]], - DataConE (MetaTv $148) - "Cons" - [DataConE (MetaTv $149) - "Str" - [VarE "word"], - VarE "plist_inline"], - PrimAppE AddP - [VarE "index", - LitE 2], - VarE "max_len"]) - (AppE "fileToContent" - [] - [VarE "file", - AppE "append" - [] - [VarE "word", - VarE "char_vec"], - VarE "plist_inline", - PrimAppE AddP - [VarE "index", - LitE 1], - VarE "max_len"]))))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (searchBlogContent, - FunDef {funName = "searchBlogContent", - funArgs = [keyword,content], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "BlogContent" []] - BoolTy), - funBody = CaseE (VarE "content") - [("Content", - [(block, MetaTv $141)], - AppE "isKeywordPresentInBlock" - [] - [VarE "keyword", - VarE "block"])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (emphasizeBlogContent, - FunDef {funName = "emphasizeBlogContent", - funArgs = [keyword,oldContent], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "BlogContent" []] - (PackedTy "BlogContent" - [])), - funBody = CaseE (VarE "oldContent") - [("Content", - [(block, MetaTv $138)], - DataConE (MetaTv $137) - "Content" - [AppE "emphasizeKeywordInBlock" - [] - [VarE "keyword", - VarE "block"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (emphasizeBlogContent', - FunDef {funName = "emphasizeBlogContent'", - funArgs = [keyword,oldContent], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "BlogContent" []] - (PackedTy "BlogContent" - [])), - funBody = CaseE (VarE "oldContent") - [("Content", - [(block, MetaTv $134)], - DataConE (MetaTv $133) - "Content" - [AppE "emphasizeKeywordInBlock" - [] - [VarE "keyword", - VarE "block"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (insertBlogTags, - FunDef {funName = "insertBlogTags", - funArgs = [keyword,tags], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "BlogTags" []] - (PackedTy "BlogTags" [])), - funBody = CaseE (VarE "tags") - [("TagList", - [(list, MetaTv $130)], - DataConE (MetaTv $129) - "TagList" - [AppE "insertTagList" - [] - [VarE "keyword", - VarE "list"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (deleteBlogTags, - FunDef {funName = "deleteBlogTags", - funArgs = [keyword,tags], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "BlogTags" []] - (PackedTy "BlogTags" [])), - funBody = CaseE (VarE "tags") - [("TagList", - [(list, MetaTv $126)], - DataConE (MetaTv $125) - "TagList" - [AppE "deleteTagList" - [] - [VarE "keyword", - VarE "list"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (searchBlogTags, - FunDef {funName = "searchBlogTags", - funArgs = [keyword,tags], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "BlogTags" []] - BoolTy), - funBody = CaseE (VarE "tags") - [("TagList", - [(list, MetaTv $122)], - AppE "searchTagList" - [] - [VarE "keyword", - VarE "list"])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (emphasizeKeywordInBlockList, - FunDef {funName = "emphasizeKeywordInBlockList", - funArgs = [keyword,block_list], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "PList" - [PackedTy "Block" - []]] - (PackedTy "PList" - [PackedTy "Block" - []])), - funBody = CaseE (VarE "block_list") - [("Nil", - [], - DataConE (MetaTv $114) "Nil" []), - ("Cons", - [(block, MetaTv $118), - (rst, MetaTv $119)], - LetE (newBlock, - [], - MetaTv $117, - AppE "emphasizeKeywordInBlock" - [] - [VarE "keyword", - VarE "block"]) - (LetE (rst', - [], - MetaTv $116, - AppE "emphasizeKeywordInBlockList" - [] - [VarE "keyword", - VarE "rst"]) - (DataConE (MetaTv $115) - "Cons" - [VarE "newBlock", - VarE "rst'"])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (emphasizeInlineListForKeyword, - FunDef {funName = "emphasizeInlineListForKeyword", - funArgs = [keyword,inline_list], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "PList" - [PackedTy "Inline" - []]] - (PackedTy "PList" - [PackedTy "Inline" - []])), - funBody = CaseE (VarE "inline_list") - [("Nil", - [], - DataConE (MetaTv $106) "Nil" []), - ("Cons", - [(inline, MetaTv $110), - (rst, MetaTv $111)], - LetE (newinline, - [], - MetaTv $109, - AppE "emphasizeKeywordInline" - [] - [VarE "keyword", - VarE "inline"]) - (LetE (rst', - [], - MetaTv $108, - AppE "emphasizeInlineListForKeyword" - [] - [VarE "keyword", - VarE "rst"]) - (DataConE (MetaTv $107) - "Cons" - [VarE "newinline", - VarE "rst'"])))], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (emphasizeKeywordInline, - FunDef {funName = "emphasizeKeywordInline", - funArgs = [keyword,inline], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "Inline" []] - (PackedTy "Inline" [])), - funBody = CaseE (VarE "inline") - [("Str", - [(text, MetaTv $100)], - LetE (isSame, - [], - MetaTv $99, - AppE "compareWord" - [] - [VarE "keyword", - VarE "text"]) - (IfE (VarE "isSame") - (LetE (newlist, - [], - PackedTy "PList" - [PackedTy "Inline" - []], - DataConE (MetaTv $96) - "Cons" - [Ext (CopyPacked (MetaTv $97) - (VarE "inline")), - DataConE (MetaTv $98) - "Nil" - []]) - (DataConE (MetaTv $95) - "Emph" - [VarE "newlist"])) - (VarE "inline"))), - ("Emph", - [(list_inline, MetaTv $102)], - DataConE (MetaTv $101) - "Emph" - [AppE "emphasizeInlineListForKeyword" - [] - [VarE "keyword", - VarE "list_inline"]]), - ("Space", - [], - DataConE (MetaTv $103) - "Space" - [])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (searchInlineListForKeyword, - FunDef {funName = "searchInlineListForKeyword", - funArgs = [keyword,inline_list], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "PList" - [PackedTy "Inline" - []]] - BoolTy), - funBody = CaseE (VarE "inline_list") - [("Nil", [], PrimAppE MkFalse []), - ("Cons", - [(inline, MetaTv $86), - (rst, MetaTv $87)], - PrimAppE OrP - [AppE "isKeywordPresentInline" - [] - [VarE "keyword", - VarE "inline"], - AppE "searchInlineListForKeyword" - [] - [VarE "keyword", - VarE "rst"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (searchBlockListForKeyword, - FunDef {funName = "searchBlockListForKeyword", - funArgs = [keyword,block_list], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "PList" - [PackedTy "Block" - []]] - BoolTy), - funBody = CaseE (VarE "block_list") - [("Nil", [], PrimAppE MkFalse []), - ("Cons", - [(block, MetaTv $82), - (rst, MetaTv $83)], - PrimAppE OrP - [AppE "isKeywordPresentInBlock" - [] - [VarE "keyword", - VarE "block"], - AppE "searchBlockListForKeyword" - [] - [VarE "keyword", - VarE "rst"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (isKeywordPresentInline, - FunDef {funName = "isKeywordPresentInline", - funArgs = [keyword,inline], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "Inline" []] - BoolTy), - funBody = CaseE (VarE "inline") - [("Str", - [(text, MetaTv $78)], - AppE "compareWord" - [] - [VarE "keyword", - VarE "text"]), - ("Emph", - [(list_inline, MetaTv $79)], - AppE "searchInlineListForKeyword" - [] - [VarE "keyword", - VarE "list_inline"]), - ("Space", - [], - PrimAppE MkFalse [])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (isKeywordPresentInBlock, - FunDef {funName = "isKeywordPresentInBlock", - funArgs = [keyword,contentBlock], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "Block" []] - BoolTy), - funBody = CaseE (VarE "contentBlock") - [("Plain", - [(list_inline, MetaTv $75)], - AppE "searchInlineListForKeyword" - [] - [VarE "keyword", - VarE "list_inline"]), - ("Null", - [], - PrimAppE MkFalse [])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (insertTagList, - FunDef {funName = "insertTagList", - funArgs = [keyword,taglist], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "PList" - [VectorTy CharTy]] - (PackedTy "PList" - [VectorTy CharTy])), - funBody = CaseE (VarE "taglist") - [("Nil", - [], - DataConE (MetaTv $69) - "Cons" - [VarE "keyword", - DataConE (MetaTv $70) - "Nil" - []]), - ("Cons", - [(word, MetaTv $71), - (rst, MetaTv $72)], - AppE "insertTagList" - [] - [VarE "keyword", - VarE "rst"])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (deleteTagList, - FunDef {funName = "deleteTagList", - funArgs = [keyword,taglist], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "PList" - [VectorTy CharTy]] - (PackedTy "PList" - [VectorTy CharTy])), - funBody = CaseE (VarE "taglist") - [("Nil", - [], - DataConE (MetaTv $63) "Nil" []), - ("Cons", - [(word, MetaTv $65), - (rst, MetaTv $66)], - IfE (AppE "compareWord" - [] - [VarE "keyword", - VarE "word"]) - (AppE "deleteTagList" - [] - [VarE "keyword", - VarE "rst"]) - (DataConE (MetaTv $64) - "Cons" - [VarE "word", - AppE "deleteTagList" - [] - [VarE "keyword", - VarE "rst"]]))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (searchTagList, - FunDef {funName = "searchTagList", - funArgs = [keyword,taglist], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "PList" - [VectorTy CharTy]] - BoolTy), - funBody = CaseE (VarE "taglist") - [("Nil", [], PrimAppE MkFalse []), - ("Cons", - [(word, MetaTv $59), - (rst, MetaTv $60)], - PrimAppE OrP - [AppE "compareWord" - [] - [VarE "keyword", - VarE "word"], - AppE "searchTagList" - [] - [VarE "keyword", - VarE "rst"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = Inline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (cmp, - FunDef {funName = "cmp", - funArgs = [start,end,word1,word2], - funTy = ForAll [] - (ArrowTy [IntTy,IntTy, - VectorTy CharTy, - VectorTy CharTy] - BoolTy), - funBody = IfE (PrimAppE LtP - [VarE "start",VarE "end"]) - (LetE (a, - [], - MetaTv $56, - AppE "nth" - [] - [VarE "word1", - VarE "start"]) - (LetE (b, - [], - MetaTv $55, - AppE "nth" - [] - [VarE "word2", - VarE "start"]) - (LetE (eq, - [], - MetaTv $54, - IfE (PrimAppE EqCharP - [VarE "a", - VarE "b"]) - (PrimAppE MkTrue - []) - (PrimAppE MkFalse - [])) - (LetE (recurse, - [], - MetaTv $53, - AppE "cmp" - [] - [PrimAppE AddP - [VarE "start", - LitE 1], - VarE "end", - VarE "word1", - VarE "word2"]) - (PrimAppE AndP - [VarE "eq", - VarE "recurse"]))))) - (PrimAppE MkTrue []), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (compareWord, - FunDef {funName = "compareWord", - funArgs = [word1,word2], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - VectorTy CharTy] - BoolTy), - funBody = LetE (len1, - [], - MetaTv $48, - AppE "length" [] [VarE "word1"]) - (LetE (len2, - [], - MetaTv $47, - AppE "length" - [] - [VarE "word2"]) - (LetE (compare_len, - [], - MetaTv $46, - IfE (PrimAppE EqIntP - [VarE "len1", - VarE "len2"]) - (PrimAppE MkTrue - []) - (PrimAppE MkFalse - [])) - (IfE (VarE "compare_len") - (AppE "cmp" - [] - [LitE 0, - VarE "len1", - VarE "word1", - VarE "word2"]) - (PrimAppE MkFalse - [])))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (checkBlogID, - FunDef {funName = "checkBlogID", - funArgs = [id,val], - funTy = ForAll [] - (ArrowTy [PackedTy "BlogId" [], - IntTy] - BoolTy), - funBody = CaseE (VarE "id") - [("ID", - [(x, MetaTv $43)], - IfE (PrimAppE EqIntP - [VarE "x", - VarE "val"]) - (PrimAppE MkTrue []) - (PrimAppE MkFalse []))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkListFiles, - FunDef {funName = "mkListFiles", - funArgs = [f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,len], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy,IntTy] - (PackedTy "PList" - [VectorTy CharTy])), - funBody = IfE (PrimAppE LtP [VarE "len",LitE 0]) - (DataConE (MetaTv $37) "Nil" []) - (LetE (f, - [], - MetaTv $40, - AppE "getFile" - [] - [VarE "f1",VarE "f2", - VarE "f3",VarE "f4", - VarE "f5",VarE "f6", - VarE "f7",VarE "f8", - VarE "f9",VarE "f10", - VarE "len"]) - (LetE (rst, - [], - MetaTv $39, - AppE "mkListFiles" - [] - [VarE "f1", - VarE "f2", - VarE "f3", - VarE "f4", - VarE "f5", - VarE "f6", - VarE "f7", - VarE "f8", - VarE "f9", - VarE "f10", - PrimAppE SubP - [VarE "len", - LitE 1]]) - (DataConE (MetaTv $38) - "Cons" - [VarE "f", - VarE "rst"]))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (getFile, - FunDef {funName = "getFile", - funArgs = [f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,select], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy, - VectorTy CharTy,IntTy] - (VectorTy CharTy)), - funBody = IfE (PrimAppE EqIntP - [VarE "select",LitE 0]) - (VarE "f1") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 1]) - (VarE "f2") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 2]) - (VarE "f3") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 3]) - (VarE "f4") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 4]) - (VarE "f5") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 5]) - (VarE "f6") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 6]) - (VarE "f7") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 7]) - (VarE "f8") - (IfE (PrimAppE EqIntP - [VarE "select", - LitE 8]) - (VarE "f9") - (VarE "f10"))))))))), - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkBlogTags, - FunDef {funName = "mkBlogTags", - funArgs = [taglist], - funTy = ForAll [] - (ArrowTy [PackedTy "PList" - [VectorTy CharTy]] - (PackedTy "BlogTags" [])), - funBody = DataConE (MetaTv $14) - "TagList" - [VarE "taglist"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkBlogContent, - FunDef {funName = "mkBlogContent", - funArgs = [block], - funTy = ForAll [] - (ArrowTy [PackedTy "Block" []] - (PackedTy "BlogContent" - [])), - funBody = DataConE (MetaTv $12) - "Content" - [VarE "block"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkBlogDate, - FunDef {funName = "mkBlogDate", - funArgs = [text], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy] - (PackedTy "BlogDate" [])), - funBody = DataConE (MetaTv $10) - "Date" - [VarE "text"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkBlogAuthor, - FunDef {funName = "mkBlogAuthor", - funArgs = [text], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy] - (PackedTy "BlogAuthor" - [])), - funBody = DataConE (MetaTv $8) - "Author" - [VarE "text"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkBlogID, - FunDef {funName = "mkBlogID", - funArgs = [val], - funTy = ForAll [] - (ArrowTy [IntTy] - (PackedTy "BlogId" [])), - funBody = DataConE (MetaTv $6) "ID" [VarE "val"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkBlogHeader, - FunDef {funName = "mkBlogHeader", - funArgs = [text], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy] - (PackedTy "BlogHeader" - [])), - funBody = DataConE (MetaTv $4) - "Header" - [VarE "text"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (getRandomString, - FunDef {funName = "getRandomString", - funArgs = [length], - funTy = ForAll [] - (ArrowTy [IntTy] (VectorTy CharTy)), - funBody = AppE "generate" - [] - [VarE "length",VarE "mkChar"], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}}), - (mkChar, - FunDef {funName = "mkChar", - funArgs = [val], - funTy = ForAll [] (ArrowTy [IntTy] CharTy), - funBody = AppE "getChar" - [] - [PrimAppE ModP - [PrimAppE RandP [], - LitE 26]], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing}) - [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 1 4 22, srcInfoPoints = [SrcSpan ".hs" 4 1 4 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 8 4 22, srcInfoPoints = []}) "Gibbon.Prelude", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, - ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 1 5 20, srcInfoPoints = [SrcSpan ".hs" 5 1 5 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 8 5 20, srcInfoPoints = []}) "Gibbon.PList", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, - ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 1 6 21, srcInfoPoints = [SrcSpan ".hs" 6 1 6 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 8 6 21, srcInfoPoints = []}) "Gibbon.Vector", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}]] - (ProgModule "Main" - (Prog - {ddefs = [], - fundefs = [(emphKeywordInContent, - FunDef {funName = "emphKeywordInContent", - funArgs = [keyword,blogs], - funTy = ForAll [] - (ArrowTy [VectorTy CharTy, - PackedTy "Blog" []] - (PackedTy "Blog" [])), - funBody = CaseE (VarE "blogs") - [("End", - [], - DataConE (MetaTv $2) "End" []), - ("Layout1", - [(header, MetaTv $8), - (id, MetaTv $9), - (author, MetaTv $10), - (date, MetaTv $11), - (content, MetaTv $12), - (tags, MetaTv $13), - (rst, MetaTv $14)], - LetE (newContent, - [], - MetaTv $7, - CaseE (VarE "content") - [("Content", - [(block, - MetaTv $6)], - DataConE (MetaTv $5) - "Content" - [AppE "emphasizeKeywordInBlock" - [] - [VarE "keyword", - VarE "block"]])]) - (LetE (newRst, - [], - MetaTv $4, - AppE "emphKeywordInContent" - [] - [VarE "keyword", - VarE "rst"]) - (DataConE (MetaTv $3) - "Layout1" - [VarE "header", - VarE "id", - VarE "author", - VarE "date", - VarE "newContent", - VarE "tags", - VarE "newRst"])))], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Just (LetE (blogs, - [], - MetaTv $17, - AppE "mkBlogs_layout1" [] [LitE 2]) - (LetE (keyword, - [], - VectorTy CharTy, - LetE (vec16, - [], - VectorTy CharTy, - PrimAppE (VAllocP CharTy) [LitE 1]) - (LetE (_, - [], - VectorTy CharTy, - PrimAppE (InplaceVUpdateP CharTy) - [VarE "vec16",LitE 0, - CharE 'a']) - (VarE "vec16"))) - (LetE (newblgs, - [], - MetaTv $15, - AppE "emphKeywordInContent" - [] - [VarE "keyword",VarE "blogs"]) - (AppE "printBlog" - [] - [VarE "newblgs"]))), - MetaTv $18)}) - [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 14, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Basics", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}, - ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 1 3 23, srcInfoPoints = [SrcSpan ".hs" 3 1 3 7]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 8 3 23, srcInfoPoints = []}) "GenerateLayout1", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}]) - -Typechecked: -================================================================================ -data Inline130 = Str156 Vector Char | - Emph157 (Packed PList72 [(Packed Inline130 [])]) | - Space158 -data Block131 = Plain154 (Packed PList72 [(Packed Inline130 [])]) | - Null155 -data BlogHeader132 = Header153 Vector Char -data BlogId133 = ID152 Int -data BlogAuthor134 = Author151 Vector Char -data BlogDate135 = Date150 Vector Char -data BlogContent136 = Content149 (Packed Block131 []) -data BlogTags137 = TagList148 (Packed PList72 [Vector Char]) -data Blog138 = End139 | - Layout1140 (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogContent136 []) (Packed BlogTags137 []) (Packed Blog138 []) | - Layout2141 (Packed BlogContent136 []) (Packed BlogTags137 []) (Packed Blog138 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | - Layout3142 (Packed BlogTags137 []) (Packed Blog138 []) (Packed BlogContent136 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | - Layout4143 (Packed BlogTags137 []) (Packed BlogContent136 []) (Packed Blog138 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | - Layout5144 (Packed Blog138 []) (Packed BlogTags137 []) (Packed BlogContent136 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) | - Layout6145 (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogContent136 []) (Packed Blog138 []) (Packed BlogTags137 []) | - Layout7146 (Packed Blog138 []) (Packed BlogContent136 []) (Packed BlogHeader132 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogTags137 []) | - Layout8147 (Packed BlogContent136 []) (Packed Blog138 []) (Packed BlogId133 []) (Packed BlogAuthor134 []) (Packed BlogDate135 []) (Packed BlogHeader132 []) (Packed BlogTags137 []) -data PList72 b:a164 = Nil73 | - Cons74 b:a164 (Packed PList72 [b:a164]) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlogs_layout11 :: forall. (Int -> (Packed Blog138 [])) -mkBlogs_layout11 length165 = - if <=(length165, 0) - then (End139 ()) - else let header166 :: (Packed BlogHeader132 []) = (Header153 () (getRandomString128 [] 5)) in - let id167 :: (Packed BlogId133 []) = (ID152 () 10 - length165 mod 10) in - let author168 :: (Packed BlogAuthor134 []) = (Author151 () (getRandomString128 [] 5)) in - let date169 :: (Packed BlogDate135 []) = (Date150 () (getRandomString128 [] 5)) in - let content170 :: (Packed BlogContent136 []) = (Content149 () (Plain154 () (mkRandomInlineList91 [] 50))) in - let tags171 :: (Packed BlogTags137 []) = (TagList148 () (mkSomeTags90 [] 10)) in - let rst172 :: (Packed Blog138 []) = (mkBlogs_layout11 [] length165 - 1) in - (Layout1140 () header166 id167 author168 date169 content170 tags171 rst172) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -emphKeywordInContent0 :: forall. (Vector Char -> (Packed Blog138 []) -> (Packed Blog138 [])) -emphKeywordInContent0 keyword173 blogs174 = - case blogs174 of - End139 -> - (End139 ()) - Layout1140 header175::(Packed BlogHeader132 []) id176::(Packed BlogId133 []) author177::(Packed BlogAuthor134 []) date178::(Packed BlogDate135 []) content179::(Packed BlogContent136 []) tags180::(Packed BlogTags137 []) rst181::(Packed Blog138 []) -> - let newContent183 :: (Packed BlogContent136 []) = case content179 of - Content149 block182::(Packed Block131 []) -> - (Content149 () (emphasizeKeywordInBlock75 [] keyword173 block182)) in - let newRst184 :: (Packed Blog138 []) = (emphKeywordInContent0 [] keyword173 rst181) in - (Layout1140 () header175 id176 author177 date178 newContent183 tags180 newRst184) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printBlog76 :: forall. ((Packed Blog138 []) -> ()) -printBlog76 blog185 = - case blog185 of - Layout1140 header186::(Packed BlogHeader132 []) id187::(Packed BlogId133 []) author188::(Packed BlogAuthor134 []) date189::(Packed BlogDate135 []) content190::(Packed BlogContent136 []) tags191::(Packed BlogTags137 []) rst192::(Packed Blog138 []) -> - let wildcard_344193 :: () = printsym("Layout1 ") in - let wildcard_342194 :: () = (printHeader83 [] header186) in - let wildcard_340195 :: () = (printID82 [] id187) in - let wildcard_338196 :: () = (printAuthor84 [] author188) in - let wildcard_336197 :: () = (printDate85 [] date189) in - let wildcard_334198 :: () = (printContent87 [] content190) in - let wildcard_332199 :: () = (printTagList86 [] tags191) in - let wildcard_330200 :: () = (printBlog76 [] rst192) in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -emphasizeKeywordInBlock75 :: forall. (Vector Char -> (Packed Block131 []) -> (Packed Block131 [])) -emphasizeKeywordInBlock75 keyword201 contentBlock202 = - case contentBlock202 of - Plain154 list_inline203::(Packed PList72 [(Packed Inline130 [])]) -> - (Plain154 () (emphasizeInlineListForKeyword108 [] keyword201 list_inline203)) - Null155 -> - (Null155 ()) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -getChar77 :: forall. (Int -> Char) -getChar77 decimal204 = - if decimal204 == 0 - then 'a' - else if decimal204 == 1 - then 'b' - else if decimal204 == 2 - then 'c' - else if decimal204 == 3 - then 'd' - else if decimal204 == 4 - then 'e' - else if decimal204 == 5 - then 'f' - else if decimal204 == 6 - then 'g' - else if decimal204 == 7 - then 'h' - else if decimal204 == 8 - then 'i' - else if decimal204 == 9 - then 'j' - else if decimal204 == 10 - then 'k' - else if decimal204 == 11 - then 'l' - else if decimal204 == 12 - then 'm' - else if decimal204 == 13 - then 'n' - else if decimal204 == 14 - then 'o' - else if decimal204 == 15 - then 'p' - else if decimal204 == 16 - then 'q' - else if decimal204 == 17 - then 'r' - else if decimal204 == 18 - then 's' - else if decimal204 == 19 - then 't' - else if decimal204 == 20 - then 'u' - else if decimal204 == 21 - then 'v' - else if decimal204 == 22 - then 'w' - else if decimal204 == 23 - then 'x' - else if decimal204 == 24 - then 'y' - else 'z' - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printInline78 :: forall. ((Packed Inline130 []) -> ()) -printInline78 inline205 = - case inline205 of - Str156 text206::Vector Char -> - let wildcard_392207 :: () = printsym("Str ") in - let wildcard_390209 :: () = (printVec9 [Char] (\(i208 :: Char) -> - printchar(i208)) text206) in - () - Emph157 plist210::(Packed PList72 [(Packed Inline130 [])]) -> - let wildcard_397211 :: () = printsym("Emph ") in - let wildcard_395212 :: () = (printPlistInline80 [] plist210) in - () - Space158 -> - let wildcard_400213 :: () = printsym("Space ") in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printPlistText79 :: forall. ((Packed PList72 [Vector Char]) -> ()) -printPlistText79 list214 = - case list214 of - Cons74 x215::Vector Char rst216::(Packed PList72 [Vector Char]) -> - let wildcard_382217 :: () = printsym("PList ( Cons ") in - let wildcard_380219 :: () = (printVec9 [Char] (\(i218 :: Char) -> - printchar(i218)) x215) in - let wildcard_377220 :: () = (printPlistText79 [] rst216) in - let wildcard_375221 :: () = printsym(" ) ") in - () - Nil73 -> - let wildcard_386222 :: () = printsym("Nil") in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printPlistInline80 :: forall. ((Packed PList72 [(Packed Inline130 [])]) -> ()) -printPlistInline80 list223 = - case list223 of - Cons74 x224::(Packed Inline130 []) rst225::(Packed PList72 [(Packed Inline130 [])]) -> - let wildcard_368226 :: () = printsym("PList ( Cons ") in - let wildcard_366227 :: () = (printInline78 [] x224) in - let wildcard_364228 :: () = (printPlistInline80 [] rst225) in - let wildcard_362229 :: () = printsym(" ) ") in - () - Nil73 -> - let wildcard_372230 :: () = printsym("Nil") in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printBlock81 :: forall. ((Packed Block131 []) -> ()) -printBlock81 block231 = - case block231 of - Plain154 plist232::(Packed PList72 [(Packed Inline130 [])]) -> - let wildcard_356233 :: () = printsym("Plain ") in - let wildcard_354234 :: () = (printPlistInline80 [] plist232) in - () - Null155 -> - let wildcard_359235 :: () = printsym("Null") in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printID82 :: forall. ((Packed BlogId133 []) -> ()) -printID82 id236 = - case id236 of - ID152 val237::Int -> - let wildcard_326238 :: () = printsym("ID ") in - let wildcard_324239 :: () = printint(val237) in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printHeader83 :: forall. ((Packed BlogHeader132 []) -> ()) -printHeader83 header240 = - case header240 of - Header153 str241::Vector Char -> - let wildcard_320242 :: () = printsym("Header ") in - let wildcard_318244 :: () = (printVec9 [Char] (\(i243 :: Char) -> - printchar(i243)) str241) in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printAuthor84 :: forall. ((Packed BlogAuthor134 []) -> ()) -printAuthor84 date245 = - case date245 of - Author151 str246::Vector Char -> - let wildcard_313247 :: () = printsym("Author ") in - let wildcard_311249 :: () = (printVec9 [Char] (\(i248 :: Char) -> - printchar(i248)) str246) in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printDate85 :: forall. ((Packed BlogDate135 []) -> ()) -printDate85 date250 = - case date250 of - Date150 str251::Vector Char -> - let wildcard_306252 :: () = printsym("Date ") in - let wildcard_304254 :: () = (printVec9 [Char] (\(i253 :: Char) -> - printchar(i253)) str251) in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printTagList86 :: forall. ((Packed BlogTags137 []) -> ()) -printTagList86 tags255 = - case tags255 of - TagList148 plist256::(Packed PList72 [Vector Char]) -> - let wildcard_299257 :: () = printsym("TagList ") in - let wildcard_297258 :: () = (printPlistText79 [] plist256) in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printContent87 :: forall. ((Packed BlogContent136 []) -> ()) -printContent87 content259 = - case content259 of - Content149 block260::(Packed Block131 []) -> - let wildcard_293261 :: () = printsym("Content ") in - let wildcard_291262 :: () = (printBlock81 [] block260) in - () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -blogLength88 :: forall. ((Packed Blog138 []) -> Int) -blogLength88 blog263 = - case blog263 of - End139 -> - 0 - Layout1140 a264::(Packed BlogHeader132 []) b265::(Packed BlogId133 []) c266::(Packed BlogAuthor134 []) d267::(Packed BlogDate135 []) e268::(Packed BlogContent136 []) f269::(Packed BlogTags137 []) rst270::(Packed Blog138 []) -> - 1 + (blogLength88 [] rst270) - Layout2141 a271::(Packed BlogContent136 []) b272::(Packed BlogTags137 []) rst273::(Packed Blog138 []) c274::(Packed BlogHeader132 []) d275::(Packed BlogId133 []) e276::(Packed BlogAuthor134 []) f277::(Packed BlogDate135 []) -> - 1 + (blogLength88 [] rst273) - Layout3142 a278::(Packed BlogTags137 []) rst279::(Packed Blog138 []) b280::(Packed BlogContent136 []) c281::(Packed BlogHeader132 []) d282::(Packed BlogId133 []) e283::(Packed BlogAuthor134 []) f284::(Packed BlogDate135 []) -> - 1 + (blogLength88 [] rst279) - Layout4143 a285::(Packed BlogTags137 []) b286::(Packed BlogContent136 []) rst287::(Packed Blog138 []) d288::(Packed BlogHeader132 []) e289::(Packed BlogId133 []) f290::(Packed BlogAuthor134 []) g291::(Packed BlogDate135 []) -> - 1 + (blogLength88 [] rst287) - Layout5144 rst292::(Packed Blog138 []) a293::(Packed BlogTags137 []) b294::(Packed BlogContent136 []) c295::(Packed BlogHeader132 []) d296::(Packed BlogId133 []) e297::(Packed BlogAuthor134 []) f298::(Packed BlogDate135 []) -> - 1 + (blogLength88 [] rst292) - Layout6145 a299::(Packed BlogHeader132 []) b300::(Packed BlogId133 []) c301::(Packed BlogAuthor134 []) d302::(Packed BlogDate135 []) e303::(Packed BlogContent136 []) rst304::(Packed Blog138 []) f305::(Packed BlogTags137 []) -> - 1 + (blogLength88 [] rst304) - Layout7146 rst306::(Packed Blog138 []) a307::(Packed BlogContent136 []) b308::(Packed BlogHeader132 []) c309::(Packed BlogId133 []) d310::(Packed BlogAuthor134 []) e311::(Packed BlogDate135 []) f312::(Packed BlogTags137 []) -> - 1 + (blogLength88 [] rst306) - Layout8147 a313::(Packed BlogContent136 []) rst314::(Packed Blog138 []) b315::(Packed BlogId133 []) c316::(Packed BlogAuthor134 []) d317::(Packed BlogDate135 []) e318::(Packed BlogHeader132 []) f319::(Packed BlogTags137 []) -> - 1 + (blogLength88 [] rst314) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlockList89 :: forall. (Int -> Int -> (Packed PList72 [(Packed Block131 [])])) -mkBlockList89 length320 base321 = - if <=(length320, 0) - then (Nil73 ((Packed Block131 []))) - else if base321 == 0 - then let item322 :: (Packed Block131 []) = (Plain154 () (mkInlineList93 [] 1000 1)) in - let rst323 :: (Packed PList72 [(Packed Block131 [])]) = (mkBlockList89 [] length320 - 1 base321) in - (Cons74 ((Packed Block131 [])) item322 rst323) - else let item324 :: (Packed Block131 []) = (Null155 ()) in - let rst325 :: (Packed PList72 [(Packed Block131 [])]) = (mkBlockList89 [] length320 - 1 base321) in - (Cons74 ((Packed Block131 [])) item324 rst325) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkSomeTags90 :: forall. (Int -> (Packed PList72 [Vector Char])) -mkSomeTags90 len326 = - if <=(len326, 0) - then (Nil73 (Vector Char)) - else let word329 :: Vector Char = let vec220327 :: Vector Char = (valloc :: [Char])(1) in - let _328 :: Vector Char = inplacevupdate(vec220327, 0, 'a') in - vec220327 in - let rst330 :: (Packed PList72 [Vector Char]) = (mkSomeTags90 [] len326 - 1) in - (Cons74 (Vector Char) word329 rst330) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkRandomInlineList91 :: forall. (Int -> (Packed PList72 [(Packed Inline130 [])])) -mkRandomInlineList91 len331 = - if <=(len331, 0) - then (Nil73 ((Packed Inline130 []))) - else let word332 :: (Packed Inline130 []) = (Str156 () (getRandomString128 [] 1)) in - let rst333 :: (Packed PList72 [(Packed Inline130 [])]) = (mkRandomInlineList91 [] len331 - 1) in - (Cons74 ((Packed Inline130 [])) word332 rst333) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkInlineList_92 :: forall. (Int -> Int -> Vector Vector Char -> (Packed PList72 [(Packed Inline130 [])])) -mkInlineList_92 length334 index335 words336 = - if >=(index335, length334) - then (Nil73 ((Packed Inline130 []))) - else let item337 :: (Packed Inline130 []) = (Str156 () (nth5 [Vector Char] words336 index335)) in - let rst338 :: (Packed PList72 [(Packed Inline130 [])]) = (mkInlineList_92 [] length334 index335 + 1 words336) in - (Cons74 ((Packed Inline130 [])) item337 rst338) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkInlineList93 :: forall. (Int -> Int -> (Packed PList72 [(Packed Inline130 [])])) -mkInlineList93 length339 base340 = - if <=(length339, 0) - then (Nil73 ((Packed Inline130 []))) - else if base340 == 0 - then let item341 :: (Packed Inline130 []) = (Emph157 () (mkInlineList93 [] 100 1)) in - let rst342 :: (Packed PList72 [(Packed Inline130 [])]) = (mkInlineList93 [] length339 - 1 base340) in - (Cons74 ((Packed Inline130 [])) item341 rst342) - else let item343 :: (Packed Inline130 []) = (mkInlineBaseCase94 [] rand() mod 4) in - let rst344 :: (Packed PList72 [(Packed Inline130 [])]) = (mkInlineList93 [] length339 - 1 base340) in - (Cons74 ((Packed Inline130 [])) item343 rst344) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkInlineBaseCase94 :: forall. (Int -> (Packed Inline130 [])) -mkInlineBaseCase94 option345 = - if option345 == 0 - then (Str156 () (getRandomString128 [] 5)) - else (Space158 ()) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkContentFromText95 :: forall. (Vector Char -> (Packed BlogContent136 [])) -mkContentFromText95 f346 = - let block347 :: (Packed Block131 []) = (fileToContent100 [] f346 (singleton6 [Char] (nth5 [Char] f346 0)) (Nil73 ((Packed Inline130 []))) 1 vlength(f346)) in - let content348 :: (Packed BlogContent136 []) = (mkBlogContent123 [] block347) in - content348 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkTagsFromText96 :: forall. (Vector Char -> (Packed BlogTags137 [])) -mkTagsFromText96 f_349 = - let tags350 :: (Packed PList72 [Vector Char]) = (fileToTags97 [] f_349 (singleton6 [Char] (nth5 [Char] f_349 0)) 1 vlength(f_349)) in - let tags_351 :: (Packed BlogTags137 []) = (TagList148 () tags350) in - tags_351 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -fileToTags97 :: forall. (Vector Char -> Vector Char -> Int -> Int -> (Packed PList72 [Vector Char])) -fileToTags97 file352 word353 index354 max_len355 = - if >=(index354, max_len355) - then (Nil73 (Vector Char)) - else let character356 :: Char = (nth5 [Char] file352 index354) in - let isSpace359 :: Bool = if *==*(character356, (head8 [Char] let vec177357 :: Vector Char = (valloc :: [Char])(1) in - let _358 :: Vector Char = inplacevupdate(vec177357, 0, ' ') in - vec177357)) - then True - else False in - let char_vec360 :: Vector Char = (singleton6 [Char] character356) in - if isSpace359 - then (Cons74 (Vector Char) word353 (fileToTags97 [] file352 (singleton6 [Char] (nth5 [Char] file352 index354 + 1)) index354 + 2 max_len355)) - else (fileToTags97 [] file352 (append7 [Char] word353 char_vec360) index354 + 1 max_len355) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printWordList98 :: forall. (Vector Vector Char -> Int -> Int -> ()) -printWordList98 vec361 start362 end363 = - if start362 < end363 - then let element364 :: Vector Char = (nth5 [Vector Char] vec361 start362) in - let wildcard_167366 :: () = (printVec9 [Char] (\(i365 :: Char) -> - printchar(i365)) element364) in - (printWordList98 [] vec361 start362 + 1 end363) - else () - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -fileToContent_99 :: forall. (Vector Char -> Vector Char -> Vector Vector Char -> Int -> Int -> Vector Vector Char) -fileToContent_99 file367 word368 running_list369 index370 max_len371 = - if >=(index370, max_len371) - then (append7 [Vector Char] running_list369 (valloc :: [Vector Char])(0)) - else let character372 :: Char = (nth5 [Char] file367 index370) in - let isSpace375 :: Bool = if *==*(character372, (head8 [Char] let vec161373 :: Vector Char = (valloc :: [Char])(1) in - let _374 :: Vector Char = inplacevupdate(vec161373, 0, ' ') in - vec161373)) - then True - else False in - let char_vec376 :: Vector Char = (singleton6 [Char] character372) in - if isSpace375 - then (fileToContent_99 [] file367 (singleton6 [Char] (nth5 [Char] file367 index370 + 1)) (append7 [Vector Char] running_list369 (generate2 [Vector Char] 1 (\(i377 :: Int) -> - word368))) index370 + 2 max_len371) - else (fileToContent_99 [] file367 (append7 [Char] word368 char_vec376) running_list369 index370 + 1 max_len371) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -fileToContent100 :: forall. (Vector Char -> Vector Char -> (Packed PList72 [(Packed Inline130 [])]) -> Int -> Int -> (Packed Block131 [])) -fileToContent100 file378 word379 plist_inline380 index381 max_len382 = - if >=(index381, max_len382) - then (Plain154 () plist_inline380) - else let character383 :: Char = (nth5 [Char] file378 index381) in - let isSpace386 :: Bool = if *==*(character383, (head8 [Char] let vec151384 :: Vector Char = (valloc :: [Char])(1) in - let _385 :: Vector Char = inplacevupdate(vec151384, 0, ' ') in - vec151384)) - then True - else False in - let char_vec387 :: Vector Char = (singleton6 [Char] character383) in - if isSpace386 - then (fileToContent100 [] file378 (singleton6 [Char] (nth5 [Char] file378 index381 + 1)) (Cons74 ((Packed Inline130 [])) (Str156 () word379) plist_inline380) index381 + 2 max_len382) - else (fileToContent100 [] file378 (append7 [Char] word379 char_vec387) plist_inline380 index381 + 1 max_len382) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -searchBlogContent101 :: forall. (Vector Char -> (Packed BlogContent136 []) -> Bool) -searchBlogContent101 keyword388 content389 = - case content389 of - Content149 block390::(Packed Block131 []) -> - (isKeywordPresentInBlock113 [] keyword388 block390) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -emphasizeBlogContent102 :: forall. (Vector Char -> (Packed BlogContent136 []) -> (Packed BlogContent136 [])) -emphasizeBlogContent102 keyword391 oldContent392 = - case oldContent392 of - Content149 block393::(Packed Block131 []) -> - (Content149 () (emphasizeKeywordInBlock75 [] keyword391 block393)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -emphasizeBlogContent_103 :: forall. (Vector Char -> (Packed BlogContent136 []) -> (Packed BlogContent136 [])) -emphasizeBlogContent_103 keyword394 oldContent395 = - case oldContent395 of - Content149 block396::(Packed Block131 []) -> - (Content149 () (emphasizeKeywordInBlock75 [] keyword394 block396)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -insertBlogTags104 :: forall. (Vector Char -> (Packed BlogTags137 []) -> (Packed BlogTags137 [])) -insertBlogTags104 keyword397 tags398 = - case tags398 of - TagList148 list399::(Packed PList72 [Vector Char]) -> - (TagList148 () (insertTagList114 [] keyword397 list399)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -deleteBlogTags105 :: forall. (Vector Char -> (Packed BlogTags137 []) -> (Packed BlogTags137 [])) -deleteBlogTags105 keyword400 tags401 = - case tags401 of - TagList148 list402::(Packed PList72 [Vector Char]) -> - (TagList148 () (deleteTagList115 [] keyword400 list402)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -searchBlogTags106 :: forall. (Vector Char -> (Packed BlogTags137 []) -> Bool) -searchBlogTags106 keyword403 tags404 = - case tags404 of - TagList148 list405::(Packed PList72 [Vector Char]) -> - (searchTagList116 [] keyword403 list405) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -emphasizeKeywordInBlockList107 :: forall. (Vector Char -> (Packed PList72 [(Packed Block131 [])]) -> (Packed PList72 [(Packed Block131 [])])) -emphasizeKeywordInBlockList107 keyword406 block_list407 = - case block_list407 of - Nil73 -> - (Nil73 ((Packed Block131 []))) - Cons74 block408::(Packed Block131 []) rst409::(Packed PList72 [(Packed Block131 [])]) -> - let newBlock410 :: (Packed Block131 []) = (emphasizeKeywordInBlock75 [] keyword406 block408) in - let rst_411 :: (Packed PList72 [(Packed Block131 [])]) = (emphasizeKeywordInBlockList107 [] keyword406 rst409) in - (Cons74 ((Packed Block131 [])) newBlock410 rst_411) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -emphasizeInlineListForKeyword108 :: forall. (Vector Char -> (Packed PList72 [(Packed Inline130 [])]) -> (Packed PList72 [(Packed Inline130 [])])) -emphasizeInlineListForKeyword108 keyword412 inline_list413 = - case inline_list413 of - Nil73 -> - (Nil73 ((Packed Inline130 []))) - Cons74 inline414::(Packed Inline130 []) rst415::(Packed PList72 [(Packed Inline130 [])]) -> - let newinline416 :: (Packed Inline130 []) = (emphasizeKeywordInline109 [] keyword412 inline414) in - let rst_417 :: (Packed PList72 [(Packed Inline130 [])]) = (emphasizeInlineListForKeyword108 [] keyword412 rst415) in - (Cons74 ((Packed Inline130 [])) newinline416 rst_417) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -emphasizeKeywordInline109 :: forall. (Vector Char -> (Packed Inline130 []) -> (Packed Inline130 [])) -emphasizeKeywordInline109 keyword418 inline419 = - case inline419 of - Str156 text420::Vector Char -> - let isSame421 :: Bool = (compareWord118 [] keyword418 text420) in - if isSame421 - then let newlist422 :: (Packed PList72 [(Packed Inline130 [])]) = (Cons74 ((Packed Inline130 [])) copyPacked (inline419::(Packed Inline130 [])) (Nil73 ((Packed Inline130 [])))) in - (Emph157 () newlist422) - else inline419 - Emph157 list_inline423::(Packed PList72 [(Packed Inline130 [])]) -> - (Emph157 () (emphasizeInlineListForKeyword108 [] keyword418 list_inline423)) - Space158 -> - (Space158 ()) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -searchInlineListForKeyword110 :: forall. (Vector Char -> (Packed PList72 [(Packed Inline130 [])]) -> Bool) -searchInlineListForKeyword110 keyword424 inline_list425 = - case inline_list425 of - Nil73 -> - False - Cons74 inline426::(Packed Inline130 []) rst427::(Packed PList72 [(Packed Inline130 [])]) -> - ||((isKeywordPresentInline112 [] keyword424 inline426), (searchInlineListForKeyword110 [] keyword424 rst427)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -searchBlockListForKeyword111 :: forall. (Vector Char -> (Packed PList72 [(Packed Block131 [])]) -> Bool) -searchBlockListForKeyword111 keyword428 block_list429 = - case block_list429 of - Nil73 -> - False - Cons74 block430::(Packed Block131 []) rst431::(Packed PList72 [(Packed Block131 [])]) -> - ||((isKeywordPresentInBlock113 [] keyword428 block430), (searchBlockListForKeyword111 [] keyword428 rst431)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -isKeywordPresentInline112 :: forall. (Vector Char -> (Packed Inline130 []) -> Bool) -isKeywordPresentInline112 keyword432 inline433 = - case inline433 of - Str156 text434::Vector Char -> - (compareWord118 [] keyword432 text434) - Emph157 list_inline435::(Packed PList72 [(Packed Inline130 [])]) -> - (searchInlineListForKeyword110 [] keyword432 list_inline435) - Space158 -> - False - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -isKeywordPresentInBlock113 :: forall. (Vector Char -> (Packed Block131 []) -> Bool) -isKeywordPresentInBlock113 keyword436 contentBlock437 = - case contentBlock437 of - Plain154 list_inline438::(Packed PList72 [(Packed Inline130 [])]) -> - (searchInlineListForKeyword110 [] keyword436 list_inline438) - Null155 -> - False - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -insertTagList114 :: forall. (Vector Char -> (Packed PList72 [Vector Char]) -> (Packed PList72 [Vector Char])) -insertTagList114 keyword439 taglist440 = - case taglist440 of - Nil73 -> - (Cons74 (Vector Char) keyword439 (Nil73 (Vector Char))) - Cons74 word441::Vector Char rst442::(Packed PList72 [Vector Char]) -> - (insertTagList114 [] keyword439 rst442) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -deleteTagList115 :: forall. (Vector Char -> (Packed PList72 [Vector Char]) -> (Packed PList72 [Vector Char])) -deleteTagList115 keyword443 taglist444 = - case taglist444 of - Nil73 -> - (Nil73 (Vector Char)) - Cons74 word445::Vector Char rst446::(Packed PList72 [Vector Char]) -> - if (compareWord118 [] keyword443 word445) - then (deleteTagList115 [] keyword443 rst446) - else (Cons74 (Vector Char) word445 (deleteTagList115 [] keyword443 rst446)) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -searchTagList116 :: forall. (Vector Char -> (Packed PList72 [Vector Char]) -> Bool) -searchTagList116 keyword447 taglist448 = - case taglist448 of - Nil73 -> - False - Cons74 word449::Vector Char rst450::(Packed PList72 [Vector Char]) -> - ||((compareWord118 [] keyword447 word449), (searchTagList116 [] keyword447 rst450)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -cmp117 :: forall. (Int -> Int -> Vector Char -> Vector Char -> Bool) -cmp117 start451 end452 word1453 word2454 = - if start451 < end452 - then let a455 :: Char = (nth5 [Char] word1453 start451) in - let b456 :: Char = (nth5 [Char] word2454 start451) in - let eq457 :: Bool = if *==*(a455, b456) - then True - else False in - let recurse458 :: Bool = (cmp117 [] start451 + 1 end452 word1453 word2454) in - &&(eq457, recurse458) - else True - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -compareWord118 :: forall. (Vector Char -> Vector Char -> Bool) -compareWord118 word1459 word2460 = - let len1461 :: Int = (length3 [Char] word1459) in - let len2462 :: Int = (length3 [Char] word2460) in - let compare_len463 :: Bool = if len1461 == len2462 - then True - else False in - if compare_len463 - then (cmp117 [] 0 len1461 word1459 word2460) - else False - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -checkBlogID119 :: forall. ((Packed BlogId133 []) -> Int -> Bool) -checkBlogID119 id464 val465 = - case id464 of - ID152 x466::Int -> - if x466 == val465 - then True - else False - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkListFiles120 :: forall. (Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Int -> (Packed PList72 [Vector Char])) -mkListFiles120 f1467 f2468 f3469 f4470 f5471 f6472 f7473 f8474 f9475 f10476 len477 = - if len477 < 0 - then (Nil73 (Vector Char)) - else let f478 :: Vector Char = (getFile121 [] f1467 f2468 f3469 f4470 f5471 f6472 f7473 f8474 f9475 f10476 len477) in - let rst479 :: (Packed PList72 [Vector Char]) = (mkListFiles120 [] f1467 f2468 f3469 f4470 f5471 f6472 f7473 f8474 f9475 f10476 len477 - 1) in - (Cons74 (Vector Char) f478 rst479) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -getFile121 :: forall. (Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Vector Char -> Int -> Vector Char) -getFile121 f1480 f2481 f3482 f4483 f5484 f6485 f7486 f8487 f9488 f10489 select490 = - if select490 == 0 - then f1480 - else if select490 == 1 - then f2481 - else if select490 == 2 - then f3482 - else if select490 == 3 - then f4483 - else if select490 == 4 - then f5484 - else if select490 == 5 - then f6485 - else if select490 == 6 - then f7486 - else if select490 == 7 - then f8487 - else if select490 == 8 - then f9488 - else f10489 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlogTags122 :: forall. ((Packed PList72 [Vector Char]) -> (Packed BlogTags137 [])) -mkBlogTags122 taglist491 = - (TagList148 () taglist491) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlogContent123 :: forall. ((Packed Block131 []) -> (Packed BlogContent136 [])) -mkBlogContent123 block492 = - (Content149 () block492) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlogDate124 :: forall. (Vector Char -> (Packed BlogDate135 [])) -mkBlogDate124 text493 = - (Date150 () text493) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlogAuthor125 :: forall. (Vector Char -> (Packed BlogAuthor134 [])) -mkBlogAuthor125 text494 = - (Author151 () text494) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlogID126 :: forall. (Int -> (Packed BlogId133 [])) -mkBlogID126 val495 = - (ID152 () val495) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkBlogHeader127 :: forall. (Vector Char -> (Packed BlogHeader132 [])) -mkBlogHeader127 text496 = - (Header153 () text496) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -getRandomString128 :: forall. (Int -> Vector Char) -getRandomString128 length497 = - (generate2 [Char] length497 (fn:mkChar129 [])) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -mkChar129 :: forall. (Int -> Char) -mkChar129 val498 = - (getChar77 [] rand() mod 26) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -is_empty_plist59 :: forall b:a500. ((Packed PList72 [b:a500]) -> Bool) -is_empty_plist59 ls499 = - case ls499 of - Nil73 -> - True - Cons74 wildcard_1501::b:a500 wildcard_2502::(Packed PList72 [b:a500]) -> - False - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -zip_plist60 :: forall b:a505 b:b506. ((Packed PList72 [b:a505]) -> (Packed PList72 [b:b506]) -> (Packed PList72 [(b:a505,b:b506)])) -zip_plist60 as503 bs504 = - case as503 of - Nil73 -> - (Nil73 ((b:a505,b:b506))) - Cons74 z507::b:a505 zs508::(Packed PList72 [b:a505]) -> - case bs504 of - Nil73 -> - (Nil73 ((b:a505,b:b506))) - Cons74 y509::b:b506 ys510::(Packed PList72 [b:b506]) -> - (Cons74 ((b:a505,b:b506)) (z507, y509) (zip_plist60 [b:a505,b:b506] zs508 ys510)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -splitAt_plist61 :: forall b:a513. (Int -> (Packed PList72 [b:a513]) -> ((Packed PList72 [b:a513]),(Packed PList72 [b:a513]))) -splitAt_plist61 n511 a512 = - if n511 == 0 - then ((Nil73 (b:a513)), a512) - else case a512 of - Nil73 -> - ((Nil73 (b:a513)), (Nil73 (b:a513))) - Cons74 x514::b:a513 xs515::(Packed PList72 [b:a513]) -> - let tup63516 :: ((Packed PList72 [b:a513]),(Packed PList72 [b:a513])) = (splitAt_plist61 [b:a513] n511 - 1 xs515) in - let c517 :: (Packed PList72 [b:a513]) = (#0 tup63516) in - let d518 :: (Packed PList72 [b:a513]) = (#1 tup63516) in - ((Cons74 (b:a513) x514 c517), d518) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -map_plist62 :: forall b:a521 b:b522. ((b:a521 -> b:b522) -> (Packed PList72 [b:a521]) -> (Packed PList72 [b:b522])) -map_plist62 f519 ls520 = - case ls520 of - Nil73 -> - (Nil73 (b:b522)) - Cons74 x523::b:a521 xs524::(Packed PList72 [b:a521]) -> - (Cons74 (b:b522) (f519 [] x523) (map_plist62 [b:a521,b:b522] (fn:f519 []) xs524)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -reverse_plist63 :: forall b:a527. ((Packed PList72 [b:a527]) -> (Packed PList72 [b:a527]) -> (Packed PList72 [b:a527])) -reverse_plist63 xs525 acc526 = - case xs525 of - Nil73 -> - acc526 - Cons74 z528::b:a527 zs529::(Packed PList72 [b:a527]) -> - (reverse_plist63 [b:a527] zs529 (Cons74 (b:a527) z528 acc526)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -drop_plist64 :: forall b:a532. (Int -> (Packed PList72 [b:a532]) -> (Packed PList72 [b:a532])) -drop_plist64 num530 list531 = - case list531 of - Nil73 -> - (Nil73 (b:a532)) - Cons74 x533::b:a532 rst534::(Packed PList72 [b:a532]) -> - if <=(num530, 0) - then (Cons74 (b:a532) x533 rst534) - else (drop_plist64 [b:a532] num530 - 1 rst534) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -take_plist65 :: forall b:a537. (Int -> (Packed PList72 [b:a537]) -> (Packed PList72 [b:a537])) -take_plist65 n535 a536 = - if n535 == 0 - then (Nil73 (b:a537)) - else case a536 of - Nil73 -> - (Nil73 (b:a537)) - Cons74 z538::b:a537 zs539::(Packed PList72 [b:a537]) -> - (Cons74 (b:a537) z538 (take_plist65 [b:a537] n535 - 1 zs539)) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -filter_plist66 :: forall b:a542. ((b:a542 -> Bool) -> (Packed PList72 [b:a542]) -> (Packed PList72 [b:a542])) -filter_plist66 f540 a541 = - case a541 of - Nil73 -> - (Nil73 (b:a542)) - Cons74 z543::b:a542 zs544::(Packed PList72 [b:a542]) -> - if (f540 [] z543) - then (Cons74 (b:a542) z543 (filter_plist66 [b:a542] (fn:f540 []) zs544)) - else (filter_plist66 [b:a542] (fn:f540 []) zs544) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -length_plist67 :: forall b:a546. ((Packed PList72 [b:a546]) -> Int) -length_plist67 a545 = - case a545 of - Nil73 -> - 0 - Cons74 x547::b:a546 xs548::(Packed PList72 [b:a546]) -> - 1 + (length_plist67 [b:a546] xs548) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -nth_plist68 :: forall b:a553. ((Packed PList72 [b:a553]) -> b:a553 -> Int -> Int -> b:a553) -nth_plist68 list549 def550 index551 start552 = - case list549 of - Nil73 -> - def550 - Cons74 x554::b:a553 rst555::(Packed PList72 [b:a553]) -> - if index551 == start552 - then x554 - else (nth_plist68 [b:a553] rst555 def550 index551 start552 + 1) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -elem_plist69 :: forall b:a559. ((b:a559 -> b:a559 -> Int) -> b:a559 -> (Packed PList72 [b:a559]) -> Bool) -elem_plist69 cmp556 a557 list558 = - case list558 of - Nil73 -> - False - Cons74 x560::b:a559 rst561::(Packed PList72 [b:a559]) -> - if (cmp556 [] x560 a557) == 0 - then True - else (elem_plist69 [b:a559] (fn:cmp556 []) a557 rst561) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -tail_plist70 :: forall b:a563. ((Packed PList72 [b:a563]) -> (Packed PList72 [b:a563])) -tail_plist70 ls562 = - case ls562 of - Cons74 wildcard_10564::b:a563 xs565::(Packed PList72 [b:a563]) -> - xs565 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -head_plist71 :: forall b:a567. ((Packed PList72 [b:a567]) -> b:a567) -head_plist71 ls566 = - case ls566 of - Cons74 x568::b:a567 wildcard_6569::(Packed PList72 [b:a567]) -> - x568 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -maxInt49 :: forall. (Int -> Int -> Int) -maxInt49 a570 b571 = - if a570 > b571 - then a570 - else b571 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -print_space50 :: forall. (() -> ()) -print_space50 wildcard_20572 = - printsym(" ") - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -print_newline51 :: forall. (() -> ()) -print_newline51 wildcard_18573 = - printsym(" -") - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -print_check52 :: forall. (Bool -> ()) -print_check52 b574 = - if b574 - then let wildcard_14575 :: () = printsym("OK -") in - () - else let wildcard_16576 :: () = printsym("Err -") in - () - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -compare_int53 :: forall. (Int -> Int -> Int) -compare_int53 r1577 r2578 = - if r1577 < r2578 - then 0 - 1 - else if r1577 > r2578 - then 1 - else 0 - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -compare_float54 :: forall. (Float -> Float -> Int) -compare_float54 r1579 r2580 = - if .<.(r1579, r2580) - then 0 - 1 - else if .>.(r1579, r2580) - then 1 - else 0 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -float_abs55 :: forall. (Float -> Float) -float_abs55 f581 = - if .<.(f581, 0.0) - then .*.(f581, .-.(0.0, 1.0)) - else f581 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -minFloat56 :: forall. (Float -> Float -> Float) -minFloat56 a582 b583 = - if .<.(a582, b583) - then a582 - else b583 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -maxFloat57 :: forall. (Float -> Float -> Float) -maxFloat57 a584 b585 = - if .>.(a584, b585) - then a584 - else b585 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -minInt58 :: forall. (Int -> Int -> Int) -minInt58 a586 b587 = - if a586 < b587 - then a586 - else b587 - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -generate2 :: forall b:a590. (Int -> (Int -> b:a590) -> Vector b:a590) -generate2 n588 f589 = - let n_591 :: Int = (maxInt49 [] n588 0) in - let vec592 :: Vector b:a590 = (valloc :: [b:a590])(n_591) in - let vec1593 :: Vector b:a590 = (generate_loop32 [b:a590] vec592 0 n_591 (fn:f589 [])) in - vec1593 - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -length3 :: forall b:a595. (Vector b:a595 -> Int) -length3 vec594 = - vlength(vec594) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -select4 :: forall b:a599. (Vector b:a599 -> Vector b:a599 -> Int -> b:a599) -select4 v1596 v2597 i598 = - let len600 :: Int = vlength(v1596) in - if i598 < len600 - then vnth(v1596, i598) - else vnth(v2597, i598 - len600) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -nth5 :: forall b:a603. (Vector b:a603 -> Int -> b:a603) -nth5 vec601 i602 = - vnth(vec601, i602) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -singleton6 :: forall b:a605. (b:a605 -> Vector b:a605) -singleton6 x604 = - let vec606 :: Vector b:a605 = (valloc :: [b:a605])(1) in - let vec2607 :: Vector b:a605 = inplacevupdate(vec606, 0, x604) in - vec2607 - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -append7 :: forall b:a610. (Vector b:a610 -> Vector b:a610 -> Vector b:a610) -append7 v1608 v2609 = - (generate2 [b:a610] vlength(v1608) + vlength(v2609) (\(i611 :: Int) -> - (select4 [b:a610] v1608 v2609 i611))) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -head8 :: forall b:a613. (Vector b:a613 -> b:a613) -head8 vec612 = - (nth5 [b:a613] vec612 0) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printVec9 :: forall b:a616. ((b:a616 -> ()) -> Vector b:a616 -> ()) -printVec9 f614 vec615 = - let wildcard_178617 :: () = printsym("[") in - let wildcard_176618 :: () = (printVec_loop17 [b:a616] 0 vlength(vec615) vec615 (fn:f614 [])) in - let wildcard_173619 :: () = printsym("]") in - () - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -alloc10 :: forall b:a621. (Int -> Vector b:a621) -alloc10 vec620 = - (valloc :: [b:a621])(vec620) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -filter11 :: forall b:a624. ((b:a624 -> Bool) -> Vector b:a624 -> Vector b:a624) -filter11 f622 vec623 = - let idxs626 :: Vector Int = (generate2 [Int] vlength(vec623) (\(i625 :: Int) -> - if (f622 [] (nth5 [b:a624] vec623 i625)) - then i625 - else 0 - 1)) in - let num_ones629 :: Int = (foldl26 [Int,Int] (\(acc628 :: Int, x627 :: Int) -> - if x627 == 0 - 1 - then acc628 - else acc628 + 1) 0 idxs626) in - let to630 :: Vector b:a624 = (valloc :: [b:a624])(num_ones629) in - let len_idxs631 :: Int = vlength(idxs626) in - (filter_loop12 [b:a624] idxs626 0 0 len_idxs631 vec623 to630) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -filter_loop12 :: forall b:a638. (Vector Int -> Int -> Int -> Int -> Vector b:a638 -> Vector b:a638 -> Vector b:a638) -filter_loop12 idxs632 write_at633 start634 end635 from636 to637 = - if start634 == end635 - then to637 - else let idx639 :: Int = (nth5 [Int] idxs632 start634) in - if idx639 == 0 - 1 - then (filter_loop12 [b:a638] idxs632 write_at633 start634 + 1 end635 from636 to637) - else let elt640 :: b:a638 = (nth5 [b:a638] from636 idx639) in - let to1641 :: Vector b:a638 = inplacevupdate(to637, write_at633, elt640) in - (filter_loop12 [b:a638] idxs632 write_at633 + 1 start634 + 1 end635 from636 to1641) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lcons13 :: forall b:a644. (b:a644 -> Vector b:a644 -> Vector b:a644) -lcons13 x642 vec643 = - let y645 :: Vector b:a644 = vec643 in - (cons14 [b:a644] x642 y645) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -cons14 :: forall b:a648. (b:a648 -> Vector b:a648 -> Vector b:a648) -cons14 x646 vec647 = - let len649 :: Int = vlength(vec647) in - let vec2650 :: Vector b:a648 = (valloc :: [b:a648])(len649 + 1) in - let vec3652 :: Vector b:a648 = (generate_loop32 [b:a648] vec2650 1 len649 + 1 (\(i651 :: Int) -> - (nth5 [b:a648] vec647 i651 - 1))) in - let vec4653 :: Vector b:a648 = inplacevupdate(vec3652, 0, x646) in - vec4653 - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lsnoc15 :: forall b:a656. (Vector b:a656 -> b:a656 -> Vector b:a656) -lsnoc15 vec654 x655 = - let y657 :: Vector b:a656 = vec654 in - (snoc16 [b:a656] y657 x655) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -snoc16 :: forall b:a660. (Vector b:a660 -> b:a660 -> Vector b:a660) -snoc16 vec658 x659 = - let len661 :: Int = vlength(vec658) in - let vec2662 :: Vector b:a660 = (valloc :: [b:a660])(len661 + 1) in - let vec3664 :: Vector b:a660 = (generate_loop32 [b:a660] vec2662 0 len661 (\(i663 :: Int) -> - (nth5 [b:a660] vec658 i663))) in - let vec4665 :: Vector b:a660 = inplacevupdate(vec3664, len661, x659) in - vec4665 - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -printVec_loop17 :: forall b:a670. (Int -> Int -> Vector b:a670 -> (b:a670 -> ()) -> ()) -printVec_loop17 idx666 end667 vec668 f669 = - if idx666 == end667 - then () - else let wildcard_187671 :: () = (f669 [] vnth(vec668, idx666)) in - let wildcard_184672 :: () = printsym(",") in - (printVec_loop17 [b:a670] idx666 + 1 end667 vec668 (fn:f669 [])) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lifoldl18 :: forall b:a676 b:b677. ((b:b677 -> Int -> b:a676 -> b:b677) -> b:b677 -> Vector b:a676 -> b:b677) -lifoldl18 f673 acc674 vec675 = - let x678 :: Vector b:a676 = vec675 in - (ifoldl20 [b:a676,b:b677] (fn:f673 []) acc674 x678) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -ifoldl_loop19 :: forall b:a684 b:b685. (Int -> Int -> (b:b685 -> Int -> b:a684 -> b:b685) -> b:b685 -> Vector b:a684 -> b:b685) -ifoldl_loop19 idx679 end680 f681 acc682 vec683 = - if idx679 == end680 - then acc682 - else let acc1686 :: b:b685 = (f681 [] acc682 idx679 vnth(vec683, idx679)) in - (ifoldl_loop19 [b:a684,b:b685] idx679 + 1 end680 (fn:f681 []) acc1686 vec683) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -ifoldl20 :: forall b:a690 b:b691. ((b:b691 -> Int -> b:a690 -> b:b691) -> b:b691 -> Vector b:a690 -> b:b691) -ifoldl20 f687 acc688 vec689 = - (ifoldl_loop19 [b:a690,b:b691] 0 vlength(vec689) (fn:f687 []) acc688 vec689) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lscanl21 :: forall b:a695 b:b696. ((b:b696 -> b:a695 -> b:b696) -> b:b696 -> Vector b:a695 -> Vector b:b696) -lscanl21 f692 acc693 vec694 = - let x697 :: Vector b:a695 = vec694 in - (scanl23 [b:a695,b:b696] (fn:f692 []) acc693 x697) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -scanl_loop22 :: forall b:a704 b:b705. (Int -> Int -> (b:b705 -> b:a704 -> b:b705) -> b:b705 -> Vector b:a704 -> Vector b:b705 -> Vector b:b705) -scanl_loop22 idx698 end699 f700 acc701 vec702 result703 = - if idx698 == end699 - then result703 - else let acc1706 :: b:b705 = (f700 [] acc701 vnth(vec702, idx698)) in - let result_707 :: Vector b:b705 = inplacevupdate(result703, idx698, acc1706) in - (scanl_loop22 [b:a704,b:b705] idx698 + 1 end699 (fn:f700 []) acc1706 vec702 result_707) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -scanl23 :: forall b:a711 b:b712. ((b:b712 -> b:a711 -> b:b712) -> b:b712 -> Vector b:a711 -> Vector b:b712) -scanl23 f708 acc709 vec710 = - let len713 :: Int = vlength(vec710) in - let result714 :: Vector b:b712 = (valloc :: [b:b712])(len713) in - (scanl_loop22 [b:a711,b:b712] 0 len713 (fn:f708 []) acc709 vec710 result714) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lfoldl24 :: forall b:a718 b:b719. ((b:b719 -> b:a718 -> b:b719) -> b:b719 -> Vector b:a718 -> b:b719) -lfoldl24 f715 acc716 vec717 = - let x720 :: Vector b:a718 = vec717 in - (foldl26 [b:a718,b:b719] (fn:f715 []) acc716 x720) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -foldl_loop25 :: forall b:a726 b:b727. (Int -> Int -> (b:b727 -> b:a726 -> b:b727) -> b:b727 -> Vector b:a726 -> b:b727) -foldl_loop25 idx721 end722 f723 acc724 vec725 = - if idx721 == end722 - then acc724 - else let acc1728 :: b:b727 = (f723 [] acc724 vnth(vec725, idx721)) in - (foldl_loop25 [b:a726,b:b727] idx721 + 1 end722 (fn:f723 []) acc1728 vec725) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -foldl26 :: forall b:a732 b:b733. ((b:b733 -> b:a732 -> b:b733) -> b:b733 -> Vector b:a732 -> b:b733) -foldl26 f729 acc730 vec731 = - (foldl_loop25 [b:a732,b:b733] 0 vlength(vec731) (fn:f729 []) acc730 vec731) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -update27 :: forall b:a737. (Vector b:a737 -> Int -> b:a737 -> Vector b:a737) -update27 vec734 i735 x736 = - (generate2 [b:a737] (length3 [b:a737] vec734) (\(j738 :: Int) -> - if i735 == j738 - then x736 - else vnth(vec734, j738))) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lmap28 :: forall b:a741 b:b742. ((b:a741 -> b:b742) -> Vector b:a741 -> Vector b:b742) -lmap28 f739 vec740 = - let x743 :: Vector b:a741 = vec740 in - (map29 [b:a741,b:b742] (fn:f739 []) x743) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -map29 :: forall b:a746 b:b747. ((b:a746 -> b:b747) -> Vector b:a746 -> Vector b:b747) -map29 f744 vec745 = - (generate2 [b:b747] vlength(vec745) (\(i748 :: Int) -> - (f744 [] vnth(vec745, i748)))) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lcopy30 :: forall b:a750. (Vector b:a750 -> Vector b:a750) -lcopy30 vec749 = - (copy31 [b:a750] vec749) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -copy31 :: forall b:a752. (Vector b:a752 -> Vector b:a752) -copy31 vec751 = - (generate2 [b:a752] vlength(vec751) (\(i753 :: Int) -> - (nth5 [b:a752] vec751 i753))) - -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -generate_loop32 :: forall b:a758. (Vector b:a758 -> Int -> Int -> (Int -> b:a758) -> Vector b:a758) -generate_loop32 vec754 idx755 end756 f757 = - if idx755 == end756 - then vec754 - else let vec1759 :: Vector b:a758 = inplacevupdate(vec754, idx755, (f757 [] idx755)) in - (generate_loop32 [b:a758] vec1759 idx755 + 1 end756 (fn:f757 [])) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -tail33 :: forall b:a761. (Vector b:a761 -> Vector b:a761) -tail33 vec760 = - (slice44 [b:a761] 1 vlength(vec760) - 1 vec760) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lsplitAt_34 :: forall b:a764. (Int -> Vector b:a764 -> (Int,Vector b:a764,Int,Vector b:a764)) -lsplitAt_34 n762 vec763 = - let tup74765 :: (Vector b:a764,Vector b:a764) = (splitAt36 [b:a764] n762 vec763) in - let x766 :: Vector b:a764 = (#0 tup74765) in - let y767 :: Vector b:a764 = (#1 tup74765) in - (vlength(x766), x766, vlength(y767), y767) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -lsplitAt35 :: forall b:a770. (Int -> Vector b:a770 -> (Int,Vector b:a770,Int,Vector b:a770)) -lsplitAt35 n768 vec769 = - let x771 :: Vector b:a770 = vec769 in - (lsplitAt_34 [b:a770] n768 x771) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -splitAt36 :: forall b:a774. (Int -> Vector b:a774 -> (Vector b:a774,Vector b:a774)) -splitAt36 n772 vec773 = - let len775 :: Int = vlength(vec773) in - let n_776 :: Int = (maxInt49 [] n772 0) in - let m777 :: Int = (minInt58 [] n_776 len775) in - let m_778 :: Int = (maxInt49 [] 0 len775 - n_776) in - (vslice(0, m777, vec773), vslice(m777, m_778, vec773)) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -isEmpty37 :: forall b:a780. (Vector b:a780 -> Bool) -isEmpty37 vec779 = - vlength(vec779) == 0 - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -inplaceUpdate38 :: forall b:a784. (Int -> b:a784 -> Vector b:a784 -> Vector b:a784) -inplaceUpdate38 i781 val782 vec783 = - inplacevupdate(vec783, i781, val782) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -inplaceSort39 :: forall b:a787. ((b:a787 -> b:a787 -> Int) -> Vector b:a787 -> Vector b:a787) -inplaceSort39 cmp785 vec786 = - inplacevsort(vec786, (fn:cmp785 [])) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -flatten40 :: forall b:a789. (Vector Vector b:a789 -> Vector b:a789) -flatten40 ls788 = - vconcat(ls788) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -sort41 :: forall b:a792. ((b:a792 -> b:a792 -> Int) -> Vector b:a792 -> Vector b:a792) -sort41 cmp790 vec791 = - vsort(vec791, (fn:cmp790 [])) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -merge42 :: forall b:a795. (Vector b:a795 -> Vector b:a795 -> Vector b:a795) -merge42 vec1793 vec2794 = - vmerge(vec1793, vec2794) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -unsafeSlice43 :: forall b:a799. (Int -> Int -> Vector b:a799 -> Vector b:a799) -unsafeSlice43 i796 n797 vec798 = - vslice(i796, n797, vec798) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -slice44 :: forall b:a803. (Int -> Int -> Vector b:a803 -> Vector b:a803) -slice44 i800 n801 vec802 = - vslice(i800, n801, vec802) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -nth245 :: forall b:a806. (Vector b:a806 -> Int -> (b:a806,Vector b:a806)) -nth245 vec804 i805 = - let tup26807 :: Vector b:a806 = vec804 in - let vec1808 :: Vector b:a806 = tup26807 in - let vec2809 :: Vector b:a806 = tup26807 in - (vnth(vec1808, i805), vec2809) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -nth146 :: forall b:a812. (Vector b:a812 -> Int -> b:a812) -nth146 vec810 i811 = - vnth(vec810, i811) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -length247 :: forall b:a814. (Vector b:a814 -> (Int,Vector b:a814)) -length247 vec813 = - let tup12815 :: Vector b:a814 = vec813 in - let vec1816 :: Vector b:a814 = tup12815 in - let vec2817 :: Vector b:a814 = tup12815 in - (vlength(vec1816), vec2817) - -{meta: FunMeta {funRec = NotRec, funInline = Inline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -length148 :: forall b:a819. (Vector b:a819 -> Int) -length148 vec818 = - vlength(vec818) - -gibbon_main :: () -gibbon_main = let blogs159 :: (Packed Blog138 []) = (mkBlogs_layout11 [] 2) in - let keyword162 :: Vector Char = let vec16160 :: Vector Char = (valloc :: [Char])(1) in - let _161 :: Vector Char = inplacevupdate(vec16160, 0, 'a') in - vec16160 in - let newblgs163 :: (Packed Blog138 []) = (emphKeywordInContent0 [] keyword162 blogs159) in - (printBlog76 [] newblgs163) -Layout1 Header [,,,,,]ID Author [,,,,,]Date [,,,,,]Content Plain PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Emph PList ( Cons Str [,]Nil ) PList ( Cons Str [,]PList ( Cons Emph PList ( Cons Str [,]Nil ) Nil ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) TagList PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]Nil ) ) ) ) ) ) ) ) ) ) Layout1 Header [,,,,,]ID Author [,,,,,]Date [,,,,,]Content Plain PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]PList ( Cons Str [,]Nil ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) TagList PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]PList ( Cons [,]Nil ) ) ) ) ) ) ) ) ) ) gibbon: lookup3: key "End139" not found in list: - [("Layout1140",[(Var "header186",PackedTy "BlogHeader132" []),(Var "id187",PackedTy "BlogId133" []),(Var "author188",PackedTy "BlogAuthor134" []),(Var "date189",PackedTy "BlogDate135" []),(Var "content190",PackedTy "BlogContent136" []),(Var "tags191",PackedTy "BlogTags137" []),(Var "rst192",PackedTy "Blog138" [])],LetE (Var "wildcard_344193",[],ProdTy [],PrimAppE PrintSym [LitSymE (Var "Layout1 ")]) (LetE (Var "wildcard_342194",[],ProdTy [],AppE (Var "printHeader83") [] [VarE (Var "header186")]) (LetE (Var "wildcard_340195",[],ProdTy [],AppE (Var "printID82") [] [VarE (Var "id187")]) (LetE (Var "wildcard_338196",[],ProdTy [],AppE (Var "printAuthor84") [] [VarE (Var "author188")]) (LetE (Var "wildcard_336197",[],ProdTy [],AppE (Var "printDate85") [] [VarE (Var "date189")]) (LetE (Var "wildcard_334198",[],ProdTy [],AppE (Var "printContent87") [] [VarE (Var "content190")]) (LetE (Var "wildcard_332199",[],ProdTy [],AppE (Var "printTagList86") [] [VarE (Var "tags191")]) (LetE (Var "wildcard_330200",[],ProdTy [],AppE (Var "printBlog76") [] [VarE (Var "rst192")]) (MkProdE [])))))))))] +gibbon: haskell-src-exts failed: Parse error: ;, at .hs:593:21 CallStack (from HasCallStack): - error, called at src/Gibbon/Common.hs:363:12 in gibbon-0.3-inplace:Gibbon.Common - lookup3, called at src/Gibbon/L1/Interp.hs:124:42 in gibbon-0.3-inplace:Gibbon.L1.Interp + error, called at src/Gibbon/HaskellFrontend.hs:115:7 in gibbon-0.3-inplace:Gibbon.HaskellFrontend diff --git a/gibbon-compiler/src/Gibbon/L1/Interp.hs b/gibbon-compiler/src/Gibbon/L1/Interp.hs index b9d45b8ec..f414b7e9e 100644 --- a/gibbon-compiler/src/Gibbon/L1/Interp.hs +++ b/gibbon-compiler/src/Gibbon/L1/Interp.hs @@ -120,8 +120,16 @@ interp rc valenv ddefs fenv = go valenv v <- go env x1 case v of VPacked k ls2 -> do + let lookup3' :: (Eq k, Show k, Show a, Show b) => k -> [(k,a,b)] -> (k,a,b) + lookup3' k ls = go ls + where + --go [] = error$ "lookup3: key "++show k++" not found in list:\n "++L.take 80 (show ls) + go [] = error$ "lookup3: key "++show k++" not found in list:\n "++ (show alts) + go ((k1,a1,b1):r) + | k1 == k = (k1,a1,b1) + | otherwise = go r let vs = L.map fst prs - (_,prs,rhs) = lookup3 k alts + (_,prs,rhs) = lookup3' k alts env' = M.union (M.fromList (zip vs ls2)) env go env' rhs _ -> error$ "L1.Interp: type error, expected data constructor, got: "++ndoc v++ From 24b33bab5780fbea15f08793fab821c135d503f6 Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 23:13:20 -0500 Subject: [PATCH 59/68] removing interp changes --- gibbon-compiler/ir.log | 5 ----- gibbon-compiler/src/Gibbon/L1/Interp.hs | 10 +--------- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 gibbon-compiler/ir.log diff --git a/gibbon-compiler/ir.log b/gibbon-compiler/ir.log deleted file mode 100644 index 53b20d9c2..000000000 --- a/gibbon-compiler/ir.log +++ /dev/null @@ -1,5 +0,0 @@ - ! Responding to env Var: GIBBON_DEBUG=4 - ! We set DEBUG based on command-line verbose arg: 4 -gibbon: haskell-src-exts failed: Parse error: ;, at .hs:593:21 -CallStack (from HasCallStack): - error, called at src/Gibbon/HaskellFrontend.hs:115:7 in gibbon-0.3-inplace:Gibbon.HaskellFrontend diff --git a/gibbon-compiler/src/Gibbon/L1/Interp.hs b/gibbon-compiler/src/Gibbon/L1/Interp.hs index f414b7e9e..b9d45b8ec 100644 --- a/gibbon-compiler/src/Gibbon/L1/Interp.hs +++ b/gibbon-compiler/src/Gibbon/L1/Interp.hs @@ -120,16 +120,8 @@ interp rc valenv ddefs fenv = go valenv v <- go env x1 case v of VPacked k ls2 -> do - let lookup3' :: (Eq k, Show k, Show a, Show b) => k -> [(k,a,b)] -> (k,a,b) - lookup3' k ls = go ls - where - --go [] = error$ "lookup3: key "++show k++" not found in list:\n "++L.take 80 (show ls) - go [] = error$ "lookup3: key "++show k++" not found in list:\n "++ (show alts) - go ((k1,a1,b1):r) - | k1 == k = (k1,a1,b1) - | otherwise = go r let vs = L.map fst prs - (_,prs,rhs) = lookup3' k alts + (_,prs,rhs) = lookup3 k alts env' = M.union (M.fromList (zip vs ls2)) env go env' rhs _ -> error$ "L1.Interp: type error, expected data constructor, got: "++ndoc v++ From 55373d2a05774dffbbfcdc8c4313345d93d0d468 Mon Sep 17 00:00:00 2001 From: timmy Date: Tue, 20 Feb 2024 23:21:00 -0500 Subject: [PATCH 60/68] handling _default in freshBundle CaseE --- gibbon-compiler/.gitignore | 1 + gibbon-compiler/IR.log | 3 --- gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs | 4 +++- 3 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 gibbon-compiler/IR.log diff --git a/gibbon-compiler/.gitignore b/gibbon-compiler/.gitignore index 02f2565fa..b30392163 100644 --- a/gibbon-compiler/.gitignore +++ b/gibbon-compiler/.gitignore @@ -32,3 +32,4 @@ demo/*.c demo/*.exe gibbon-compiler/examples/parallel/data/*.txt *.log.hs +*.log diff --git a/gibbon-compiler/IR.log b/gibbon-compiler/IR.log deleted file mode 100644 index 359ac2ee4..000000000 --- a/gibbon-compiler/IR.log +++ /dev/null @@ -1,3 +0,0 @@ - ! Responding to env Var: GIBBON_DEBUG=4 - ! We set DEBUG based on command-line verbose arg: 4 -gibbon: /home/timmy/git/gibbon/gibbon-compiler/./examples/addone.hs: openFile: does not exist (No such file or directory) diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs index 4600fb89d..3ee82b41c 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -177,7 +177,9 @@ findFreshInExp exp defenv funenv constrenv = CaseE e mp -> do e' <- findFreshInExp e defenv funenv constrenv mp' <- mapM (\(c,prs,ae) -> do - let c' = (fromVar (findFreshedName (toVar c) constrenv)) + let c' = case c of + "_default" -> c + _ -> (fromVar (findFreshedName (toVar c) constrenv)) ae' <- findFreshInExp ae defenv funenv constrenv return (c', prs, ae')) mp return $ CaseE e' mp' From 138730456a4117571000218f5407f8c7b96b0b3a Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 21 Feb 2024 00:01:19 -0500 Subject: [PATCH 61/68] fixed more test cases --- gibbon-compiler/examples/test_164.ans | 2 +- gibbon-compiler/examples/test_191.ans | 2 +- gibbon-compiler/examples/test_printpacked.ans | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gibbon-compiler/examples/test_164.ans b/gibbon-compiler/examples/test_164.ans index ab1492349..31fcf7728 100644 --- a/gibbon-compiler/examples/test_164.ans +++ b/gibbon-compiler/examples/test_164.ans @@ -1 +1 @@ -(Cons_v_46 3 (Cons_v_46 5 (Cons_v_46 7 (Nil_v_46)))) +(Cons19_v50 3 (Cons19_v50 5 (Cons19_v50 7 (Nil18_v50)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/test_191.ans b/gibbon-compiler/examples/test_191.ans index 1828a9fee..18f4f2b04 100644 --- a/gibbon-compiler/examples/test_191.ans +++ b/gibbon-compiler/examples/test_191.ans @@ -1 +1 @@ -(Cons 12 ->i (I 2) (Cons 12 ->i (I 1) (Nil)))'#() +(Cons26 12 ->i (I28 2) (Cons26 12 ->i (I28 1) (Nil27)))'#() \ No newline at end of file diff --git a/gibbon-compiler/examples/test_printpacked.ans b/gibbon-compiler/examples/test_printpacked.ans index 07209292f..55c61c8f0 100644 --- a/gibbon-compiler/examples/test_printpacked.ans +++ b/gibbon-compiler/examples/test_printpacked.ans @@ -1,4 +1,4 @@ -(Node (Node (Leaf 1)(Leaf 1))(Node (Leaf 1)(Leaf 1))) - ->i (Node (Node (Leaf 1)(Leaf 1))(Node (Leaf 1)(Leaf 1))) +(Node32 (Node32 (Leaf31 1)(Leaf31 1))(Node32 (Leaf31 1)(Leaf31 1))) + ->i (Node32 (Node32 (Leaf31 1)(Leaf31 1))(Node32 (Leaf31 1)(Leaf31 1))) 1 '#() \ No newline at end of file From 1d9fed959c82e01401541f252d887f4e3022b1f4 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 21 Feb 2024 00:13:50 -0500 Subject: [PATCH 62/68] fixing manyFuncs --- .../examples/layout_bench/Basics.hs | 18 +++++++++ .../examples/layout_bench/manyFuncs.hs | 38 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/gibbon-compiler/examples/layout_bench/Basics.hs b/gibbon-compiler/examples/layout_bench/Basics.hs index aefd8179b..e74bb0d11 100644 --- a/gibbon-compiler/examples/layout_bench/Basics.hs +++ b/gibbon-compiler/examples/layout_bench/Basics.hs @@ -599,6 +599,24 @@ printBlog blog = case blog of _ = printTagList tags _ = printBlog rst in () + Layout2 content tags rst header id author date -> let _ = printsym (quote "Layout2 ") + _ = printHeader header + _ = printID id + _ = printAuthor author + _ = printDate date + _ = printContent content + _ = printTagList tags + _ = printBlog rst + in () + Layout4 tags content rst header id author date -> let _ = printsym (quote "Layout4 ") + _ = printHeader header + _ = printID id + _ = printAuthor author + _ = printDate date + _ = printContent content + _ = printTagList tags + _ = printBlog rst + in () diff --git a/gibbon-compiler/examples/layout_bench/manyFuncs.hs b/gibbon-compiler/examples/layout_bench/manyFuncs.hs index 37b964542..0354a3ee7 100644 --- a/gibbon-compiler/examples/layout_bench/manyFuncs.hs +++ b/gibbon-compiler/examples/layout_bench/manyFuncs.hs @@ -12,6 +12,14 @@ emphKeywordInContent keyword blogs = Content block -> Content (emphasizeKeywordInBlock keyword block) newRst = emphKeywordInContent keyword rst in Layout1 header id author date newContent tags newRst + Layout2 content tags rst header id author date -> let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout2 content tags newRst header id author date + Layout4 tags content rst header id author date -> let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInContent keyword rst + in Layout4 tags content newRst header id author date @@ -23,6 +31,17 @@ filterByKeywordInTagList keyword blogs = case blogs of let newRst = filterByKeywordInTagList keyword rst in Layout4 tags content newRst header id author date else filterByKeywordInTagList keyword rst + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout4 tags content newRst header id author date + else filterByKeywordInTagList keyword rst + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + in if present then + let newRst = filterByKeywordInTagList keyword rst + in Layout4 tags content newRst header id author date + else filterByKeywordInTagList keyword rst + emphKeywordInTag :: Text -> Blog -> Blog @@ -37,6 +56,25 @@ emphKeywordInTag keyword blogs = case blogs of else let newRst = emphKeywordInTag keyword rst in Layout1 header id author date content tags newRst + Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags + in if (present) + then let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout2 content tags newRst header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout2 content tags newRst header id author date + Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags + in if (present) + then let newContent = case content of + Content block -> Content (emphasizeKeywordInBlock keyword block) + newRst = emphKeywordInTag keyword rst + in Layout4 tags content newRst header id author date + else + let newRst = emphKeywordInTag keyword rst + in Layout4 tags content newRst header id author date + -- main function From 4330552f691ecbd80766698529fd91dd3fcd4909 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 21 Feb 2024 02:03:30 -0500 Subject: [PATCH 63/68] solve layout constrs error --- .../examples/layout_bench/layout1ContentSearchRunPipeline.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs index ffe96a369..80d8d6d10 100644 --- a/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs +++ b/gibbon-compiler/examples/layout_bench/layout1ContentSearchRunPipeline.hs @@ -18,5 +18,4 @@ gibbon_main = keyword :: Vector Char keyword = "a" newblgs = emphKeywordInContent keyword blogs - --in printPacked newblgs in printBlog newblgs From bbaa2d765ea04b2f7639abeb6c2c5047481b46ef Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 21 Feb 2024 02:34:43 -0500 Subject: [PATCH 64/68] removed some tests missing from main --- gibbon-compiler/tests/test-gibbon-examples.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gibbon-compiler/tests/test-gibbon-examples.yaml b/gibbon-compiler/tests/test-gibbon-examples.yaml index 6ec2dc3e9..f2df09f15 100644 --- a/gibbon-compiler/tests/test-gibbon-examples.yaml +++ b/gibbon-compiler/tests/test-gibbon-examples.yaml @@ -916,18 +916,18 @@ tests: dir: examples/layout_bench answer-file: examples/layout_bench/layout1ContentSearchRunPipeline.ans failing: [interp1,pointer,gibbon1, gibbon3] - run-modes: ["gibbon2"] + run-modes: [] - name: manyFuncs.hs test-flags: ["--no-gc", "--opt-layout-local", "--opt-layout-use-solver"] dir: examples/layout_bench answer-file: examples/layout_bench/manyFuncsLocal.ans - failing: [interp1,pointer,gibbon1, gibbon3] - run-modes: ["gibbon2"] + failing: [interp1,pointer,gibbon1, gibbon3, gibbon2] + run-modes: [] - name: manyFuncs.hs test-flags: ["--no-gc", "--opt-layout-global", "--opt-layout-use-solver"] dir: examples/layout_bench answer-file: examples/layout_bench/manyFuncsGlobal.ans - failing: [interp1,pointer,gibbon1, gibbon3] - run-modes: ["gibbon2"] + failing: [interp1,pointer,gibbon1, gibbon3, gibbon2] + run-modes: [] From 0d17d3a55896ea439202010107270273a388b3ee Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 21 Feb 2024 02:47:47 -0500 Subject: [PATCH 65/68] test cases pass --- gibbon-compiler/solve_ilp_-34.py | 22 +++++++++++++++++++ gibbon-compiler/solve_ilp_-49.py | 22 +++++++++++++++++++ gibbon-compiler/solve_ilp_14.py | 22 +++++++++++++++++++ .../tests/test-gibbon-examples.yaml | 20 ----------------- 4 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 gibbon-compiler/solve_ilp_-34.py create mode 100644 gibbon-compiler/solve_ilp_-49.py create mode 100644 gibbon-compiler/solve_ilp_14.py diff --git a/gibbon-compiler/solve_ilp_-34.py b/gibbon-compiler/solve_ilp_-34.py new file mode 100644 index 000000000..25e74d77b --- /dev/null +++ b/gibbon-compiler/solve_ilp_-34.py @@ -0,0 +1,22 @@ +from docplex.mp.model import Model +model_2 = Model() +x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") +x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") +cost3 = model_2.integer_var(name="cost3") +x_minus_y11 = (x_00 - x_11) +cost5 = (x_minus_y11 == -1) +cost6 = (x_minus_y11 <= -1) +cost7 = (x_minus_y11 == 1) +cost8 = (x_minus_y11 >= 1) +cost9 = (x_minus_y11 != -1) +cost10 = (x_minus_y11 != 1) +model_2.add(cost5 <= (cost3 == 0)) +model_2.add((cost6 & cost9) <= (cost3 == 100)) +model_2.add(cost7 <= (cost3 == 200)) +model_2.add((cost8 & cost10) <= (cost3 == 300)) +min4 = cost3 * 50 +model_2.add(x_00 != x_11) +model_2.minimize(min4 + 0) +soln12 = model_2.solve() +print("({},{})".format(0, soln12.get_value(x_00))) +print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/solve_ilp_-49.py b/gibbon-compiler/solve_ilp_-49.py new file mode 100644 index 000000000..25e74d77b --- /dev/null +++ b/gibbon-compiler/solve_ilp_-49.py @@ -0,0 +1,22 @@ +from docplex.mp.model import Model +model_2 = Model() +x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") +x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") +cost3 = model_2.integer_var(name="cost3") +x_minus_y11 = (x_00 - x_11) +cost5 = (x_minus_y11 == -1) +cost6 = (x_minus_y11 <= -1) +cost7 = (x_minus_y11 == 1) +cost8 = (x_minus_y11 >= 1) +cost9 = (x_minus_y11 != -1) +cost10 = (x_minus_y11 != 1) +model_2.add(cost5 <= (cost3 == 0)) +model_2.add((cost6 & cost9) <= (cost3 == 100)) +model_2.add(cost7 <= (cost3 == 200)) +model_2.add((cost8 & cost10) <= (cost3 == 300)) +min4 = cost3 * 50 +model_2.add(x_00 != x_11) +model_2.minimize(min4 + 0) +soln12 = model_2.solve() +print("({},{})".format(0, soln12.get_value(x_00))) +print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/solve_ilp_14.py b/gibbon-compiler/solve_ilp_14.py new file mode 100644 index 000000000..25e74d77b --- /dev/null +++ b/gibbon-compiler/solve_ilp_14.py @@ -0,0 +1,22 @@ +from docplex.mp.model import Model +model_2 = Model() +x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") +x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") +cost3 = model_2.integer_var(name="cost3") +x_minus_y11 = (x_00 - x_11) +cost5 = (x_minus_y11 == -1) +cost6 = (x_minus_y11 <= -1) +cost7 = (x_minus_y11 == 1) +cost8 = (x_minus_y11 >= 1) +cost9 = (x_minus_y11 != -1) +cost10 = (x_minus_y11 != 1) +model_2.add(cost5 <= (cost3 == 0)) +model_2.add((cost6 & cost9) <= (cost3 == 100)) +model_2.add(cost7 <= (cost3 == 200)) +model_2.add((cost8 & cost10) <= (cost3 == 300)) +min4 = cost3 * 50 +model_2.add(x_00 != x_11) +model_2.minimize(min4 + 0) +soln12 = model_2.solve() +print("({},{})".format(0, soln12.get_value(x_00))) +print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/tests/test-gibbon-examples.yaml b/gibbon-compiler/tests/test-gibbon-examples.yaml index f2df09f15..8d3a234d2 100644 --- a/gibbon-compiler/tests/test-gibbon-examples.yaml +++ b/gibbon-compiler/tests/test-gibbon-examples.yaml @@ -911,23 +911,3 @@ tests: failing: [] run-modes: ["gibbon2", "gibbon3", "pointer"] - - name: layout1ContentSearchRunPipeline.hs - test-flags: ["--no-gc", "--opt-layout-local", "--opt-layout-use-solver"] - dir: examples/layout_bench - answer-file: examples/layout_bench/layout1ContentSearchRunPipeline.ans - failing: [interp1,pointer,gibbon1, gibbon3] - run-modes: [] - - - name: manyFuncs.hs - test-flags: ["--no-gc", "--opt-layout-local", "--opt-layout-use-solver"] - dir: examples/layout_bench - answer-file: examples/layout_bench/manyFuncsLocal.ans - failing: [interp1,pointer,gibbon1, gibbon3, gibbon2] - run-modes: [] - - - name: manyFuncs.hs - test-flags: ["--no-gc", "--opt-layout-global", "--opt-layout-use-solver"] - dir: examples/layout_bench - answer-file: examples/layout_bench/manyFuncsGlobal.ans - failing: [interp1,pointer,gibbon1, gibbon3, gibbon2] - run-modes: [] From 97eff1d05d6e5ff913a9a2d035982fbf0628ce69 Mon Sep 17 00:00:00 2001 From: timmy Date: Wed, 28 Feb 2024 12:58:29 -0500 Subject: [PATCH 66/68] adressed comments and added more robust descriptions to all new modules --- gibbon-compiler/src/Gibbon/Bundler.hs | 10 ++++---- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 14 ++--------- gibbon-compiler/src/Gibbon/Language/Syntax.hs | 1 - .../src/Gibbon/Passes/FreshBundle.hs | 24 ++++++++++--------- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/gibbon-compiler/src/Gibbon/Bundler.hs b/gibbon-compiler/src/Gibbon/Bundler.hs index 7d014a5c9..0b2bf056d 100644 --- a/gibbon-compiler/src/Gibbon/Bundler.hs +++ b/gibbon-compiler/src/Gibbon/Bundler.hs @@ -1,16 +1,16 @@ - +-- | Union all the modules in a program bundle in to a single program module Gibbon.Bundler (bundleModules) where import qualified Data.Foldable as F import qualified Data.Set as S import Gibbon.L0.Syntax as L0 import Gibbon.Common import Data.Map as M -import Data.List as L -import Language.Haskell.Exts (ImportDecl) --- main bundler, takes a list of modules and the main module +-- | Main bundler, runs all imported modules through a union that combines +-- their function defintions and data definitions with main's +-- Names should be globally unique at this point bundleModules :: ProgBundle0 -> PassM Prog0 bundleModules bundle = do let (ProgBundle modules main) = bundle @@ -18,7 +18,7 @@ bundleModules bundle = do let (defs, funs) = F.foldr _bundleModule (main_defs, main_funs) modules return $ Prog defs funs main_exp --- main bundle fold +-- | Bundle fold function -- builds the full program by folding definitons and functions into the main _bundleModule :: ProgModule0 -> (DDefs0, FunDefs0) -> (DDefs0, FunDefs0) _bundleModule (ProgModule mod_name (Prog {ddefs, fundefs}) _) (defs1, funs1) = diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index ea687d5e5..6549869b2 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -191,6 +191,7 @@ type TopTyEnv = TyEnv TyScheme type TypeSynEnv = M.Map TyCon Ty0 +-- | Merge a list of modules into a program bundle mergeBundle :: ProgBundle0 -> [ProgModule0] -> [ProgModule0] mergeBundle (ProgBundle x main) bundle = foldr (\v acc -> if already_has v then acc else acc ++ [v]) bundle (x ++ [main]) @@ -200,11 +201,9 @@ mergeBundle (ProgBundle x main) bundle = already_has (ProgModule name _ _) = L.elem name already_imported -------------------------------------------------------------------------------- --- recursively desugars modules and their imports +-- | Recursively desugars modules and their imports -- stacks into a ProgBundle: a bundle of modules and their main module -- each module contains information about it's name, functions & definitions, and import metadata -------------------------------------------------------------------------------- desugarModule :: Config @@ -260,21 +259,12 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports acc) funs'' (M.keys userOrderings') - --let bundle = foldr (\(ProgBundle imported_bundle imported_mainmodule) acc -> case of acc ++ imported_bundle ++ [imported_mainmodule]) [] imported_progs' let bundle = foldr mergeBundle [] imported_progs' pure $ ProgBundle bundle (ProgModule modname (Prog defs funs''' main) imports) pure prog where init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) modname = moduleName head_mb - import_names = (map (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ _ _) -> importName) imports) - aliases = M.fromList (map - (\(ImportDecl _ (ModuleName _ importName) _ _ _ _ aliased _) -> - case aliased of - Just (ModuleName _ importAs) -> ((toVar importName), (toVar importAs)) - Nothing -> ((toVar importName), (toVar importName)) - ) - imports) coalese_constraints :: [(Var, M.Map DataCon [UserOrdering])] -> [(Var, M.Map DataCon [UserOrdering])] diff --git a/gibbon-compiler/src/Gibbon/Language/Syntax.hs b/gibbon-compiler/src/Gibbon/Language/Syntax.hs index bed7bf63d..0c619a131 100644 --- a/gibbon-compiler/src/Gibbon/Language/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/Language/Syntax.hs @@ -319,7 +319,6 @@ data FunMeta = FunMeta { funRec :: FunRec , funInline :: FunInline - --, funModule :: String -- Whether the transitive closure of this function can trigger GC. , funCanTriggerGC :: Bool , funOptLayout :: FunOptimizeLayout diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs index 3ee82b41c..5564e567f 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -1,26 +1,25 @@ {-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} {-# HLINT ignore "Fuse foldr/map" #-} + -- | Create unique names for functions and data types across all modules + -- replace all references with their unique counters parts + -- includes parsing import headers and resolving imported names module Gibbon.Passes.FreshBundle (freshBundleNames) where import qualified Data.Map as M import qualified Data.List as L import Gibbon.Common import Gibbon.L0.Syntax -import Language.Haskell.Exts (Name, ImportDecl (ImportDecl), SrcSpanInfo, name, ImportSpec (..), CName) -import Data.Maybe (fromJust) +import Language.Haskell.Exts (Name, ImportDecl (ImportDecl), SrcSpanInfo, ImportSpec (..), CName, ModuleName (ModuleName)) import Language.Haskell.Exts.Syntax (CName(..)) import Language.Haskell.Exts (Name(..)) import Language.Haskell.Exts (ImportSpecList(..)) -import Language.Haskell.Exts (ModuleName(..), Module, eList) import GHC.Stack (HasCallStack) type VarEnv = M.Map Var Var -------------------------------------------------------------------------------- --- exported fresh bundle pass --- replaces all references with new, globally unique names (data types, functions, constructors) -------------------------------------------------------------------------------- + -- | Go through all the modules and create a global environment of uniques + -- run through each of the modules again and replace references with their unique counterparts, including imported references freshBundleNames :: ProgBundle0 -> PassM ProgBundle0 freshBundleNames bundle = do -- build global map of uniques @@ -38,14 +37,14 @@ freshBundleNames bundle = do -- helper functions ----------------------------------------------------------- --- update the keys +-- | Update the function and data type keys in each module freshModuleKeys :: ProgModule0 -> VarEnv -> VarEnv -> PassM ProgModule0 freshModuleKeys (ProgModule name (Prog defs funs main) imports) uniquedefenv uniquefunenv = do let funs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquefunenv) funs let defs' = M.mapKeys (\k -> findFreshedName (varAppend (toVar (name ++ ".")) k) uniquedefenv) defs pure $ ProgModule name (Prog defs' funs' main) imports --- find the imported module based off an import declarations +-- | Find the imported module from the import header findImportedModule :: ImportDecl SrcSpanInfo -> M.Map String ProgModule0 -> ProgModule0 findImportedModule mod modmap = do let (ImportDecl _ (ModuleName _ name) _ _ _ _ _ _) = mod @@ -53,7 +52,7 @@ findImportedModule mod modmap = do Just found -> found Nothing -> error $ "Could not find module " ++ name ++ " in imported modules: " ++ (show (M.keys modmap)) --- transform names to their unique counterparts +-- | Transform all references to their unique counterparts freshModule :: ProgModule0 -> ProgBundle0 -> VarEnv -> VarEnv -> VarEnv -> PassM ProgModule0 freshModule (ProgModule modname (Prog defs funs main) imports) (ProgBundle bundle _) uniquedefenv uniquefunenv uniqueconstrenv = do @@ -80,6 +79,7 @@ freshModule (ProgModule modname (Prog defs funs main) imports) (ProgBundle bundl foldr (\(d, f, c) (dacc, facc, cacc) -> (M.union d dacc, M.union f facc, M.union c cacc)) (defenv', funenv', constrenv') $ map (\i -> getImportedEnv (findImportedModule i modmap) i uniquedefenv uniquefunenv uniqueconstrenv) imports +-- | Transform references in data definitions to uniques freshDDef :: HasCallStack => DDef Ty0 -> VarEnv -> VarEnv -> PassM (DDef Ty0) freshDDef DDef{tyName,tyArgs,dataCons} defenv constrenv = do let dataCons' = L.map (\(dataCon, vs) -> (fromVar (findFreshedName (toVar dataCon) constrenv), vs)) dataCons @@ -87,6 +87,7 @@ freshDDef DDef{tyName,tyArgs,dataCons} defenv constrenv = do let tyName' = findFreshedName tyName defenv pure $ DDef tyName' tyArgs dataCons'' +-- | Transform references in function definitions to uniques freshFun :: FunDef Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM (FunDef Exp0) freshFun (FunDef nam nargs funty bod meta) defenv funenv constrenv = do @@ -134,6 +135,7 @@ findFreshInDataCons (con, tys) defenv = let tys' = L.map (\(boxed, ty) -> (boxed, (findFreshInTy ty defenv))) tys (con, tys') +-- | Find unique names in expressions findFreshInExp :: Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM Exp0 findFreshInExp exp defenv funenv constrenv = case exp of @@ -240,7 +242,7 @@ findFreshInExp exp defenv funenv constrenv = LinearExt a -> do return $ Ext $ LinearExt a --- parse import header and map legal references to unique names +-- | Parse import header and map references to unique names getImportedEnv :: ProgModule0 -> ImportDecl SrcSpanInfo -> VarEnv -> VarEnv -> VarEnv -> (VarEnv, VarEnv, VarEnv) getImportedEnv (ProgModule _ (Prog defs funs _) _) imp uniquedefenv uniquefunenv uniqueconstrenv = do let ImportDecl _ (ModuleName _ impname) qual _ _ _ as specs = imp From ecac58906cf0e3daa61cb98bc030cdaf2846d93b Mon Sep 17 00:00:00 2001 From: timmy Date: Fri, 8 Mar 2024 11:54:09 -0500 Subject: [PATCH 67/68] merged in main --- gibbon-compiler/examples/poly/Poly1.ans | 2 +- gibbon-compiler/examples/test_153.ans | 2 +- gibbon-compiler/examples/test_164.ans | 2 +- gibbon-compiler/examples/test_166.ans | 2 +- gibbon-compiler/src/Gibbon/Bundler.hs | 2 +- gibbon-compiler/src/Gibbon/HaskellFrontend.hs | 183 ++---------------- gibbon-compiler/src/Gibbon/L0/Syntax.hs | 2 - gibbon-compiler/src/Gibbon/Language/Syntax.hs | 9 +- .../src/Gibbon/Passes/FreshBundle.hs | 30 +-- gibbon-compiler/src/Gibbon/Pretty.hs | 2 +- 10 files changed, 38 insertions(+), 198 deletions(-) diff --git a/gibbon-compiler/examples/poly/Poly1.ans b/gibbon-compiler/examples/poly/Poly1.ans index 49fb2c177..e179b89d9 100644 --- a/gibbon-compiler/examples/poly/Poly1.ans +++ b/gibbon-compiler/examples/poly/Poly1.ans @@ -1 +1 @@ -'#(10 #t 11 #f 2 4 (Nothing99_v323) (Right98_v342 20) (Right98_v334 1) 12 #f 0 3 (Cons96_v329 1 (Cons96_v329 2 (Nil95_v329))) (Cons96_v329 1 (Cons96_v329 2 (Nil95_v329))) (Right98_v334 1) (Cons96_v329 11 (Cons96_v329 12 (Nil95_v329)))) \ No newline at end of file +'#(10 #t 11 #f 2 4 (Nothing99_v434) (Right98_v453 20) (Right98_v445 1) 12 #f 0 3 (Cons96_v440 1 (Cons96_v440 2 (Nil95_v440))) (Cons96_v440 1 (Cons96_v440 2 (Nil95_v440))) (Right98_v445 1) (Cons96_v440 11 (Cons96_v440 12 (Nil95_v440)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/test_153.ans b/gibbon-compiler/examples/test_153.ans index 3bbd24cf0..7af4c5f73 100644 --- a/gibbon-compiler/examples/test_153.ans +++ b/gibbon-compiler/examples/test_153.ans @@ -1 +1 @@ -'#((A6_v15 2 3) (B5_v16 4 5)) \ No newline at end of file +'#('#(2 3) (B5_v17 4 5)) diff --git a/gibbon-compiler/examples/test_164.ans b/gibbon-compiler/examples/test_164.ans index 31fcf7728..6af50b27f 100644 --- a/gibbon-compiler/examples/test_164.ans +++ b/gibbon-compiler/examples/test_164.ans @@ -1 +1 @@ -(Cons19_v50 3 (Cons19_v50 5 (Cons19_v50 7 (Nil18_v50)))) \ No newline at end of file +(Cons19_v68 3 (Cons19_v68 5 (Cons19_v68 7 (Nil18_v68)))) \ No newline at end of file diff --git a/gibbon-compiler/examples/test_166.ans b/gibbon-compiler/examples/test_166.ans index 663746e89..fcb3ff9e2 100644 --- a/gibbon-compiler/examples/test_166.ans +++ b/gibbon-compiler/examples/test_166.ans @@ -1 +1 @@ -(Node16_v61 10 10 10 10 10 10 10 10 (Cell15_v61 5 5 5 5 5 5 5 5) (Cell15_v61 2 2 2 2 2 2 2 2)) +(Node16_v86 10 10 10 10 10 10 10 10 (Cell15_v86 5 5 5 5 5 5 5 5) (Cell15_v86 2 2 2 2 2 2 2 2)) \ No newline at end of file diff --git a/gibbon-compiler/src/Gibbon/Bundler.hs b/gibbon-compiler/src/Gibbon/Bundler.hs index 0b2bf056d..2fdcf0276 100644 --- a/gibbon-compiler/src/Gibbon/Bundler.hs +++ b/gibbon-compiler/src/Gibbon/Bundler.hs @@ -14,7 +14,7 @@ import Data.Map as M bundleModules :: ProgBundle0 -> PassM Prog0 bundleModules bundle = do let (ProgBundle modules main) = bundle - let (ProgModule main_name (Prog main_defs main_funs main_exp) main_imports) = main + let (ProgModule _ (Prog main_defs main_funs main_exp) _) = main let (defs, funs) = F.foldr _bundleModule (main_defs, main_funs) modules return $ Prog defs funs main_exp diff --git a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs index 229946e13..e98c90233 100644 --- a/gibbon-compiler/src/Gibbon/HaskellFrontend.hs +++ b/gibbon-compiler/src/Gibbon/HaskellFrontend.hs @@ -14,7 +14,7 @@ module Gibbon.HaskellFrontend import Control.Monad import Data.Foldable ( foldrM, foldl' ) -import Data.Maybe (catMaybes, isJust) +import Data.Maybe (catMaybes) import qualified Data.Map as M import qualified Data.Set as S import Data.IORef @@ -23,7 +23,8 @@ import Language.Haskell.Exts.Parser import Language.Haskell.Exts.Syntax as H import Language.Haskell.Exts.Pretty import Language.Haskell.Exts.SrcLoc -import Language.Haskell.Exts.CPP +import Language.Haskell.Exts.CPP + ( parseFileContentsWithCommentsAndCPP, defaultCpphsOptions ) import System.Environment ( getEnvironment ) import System.Directory import System.FilePath @@ -34,9 +35,8 @@ import System.IO import Gibbon.L0.Syntax as L0 import Gibbon.Common import Gibbon.DynFlags -import Gibbon.L0.Syntax as L0 -import Data.List as L +import qualified Data.List as L import Prelude as P import qualified Control.Applicative as L @@ -200,179 +200,28 @@ desugarModule :: -> Module SrcSpanInfo -> String -> IO (PassM ProgBundle0) -desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) mod_name = do +desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports decls) imported_name = do let type_syns = foldl collectTypeSynonyms M.empty decls funtys = foldr (collectTopTy type_syns) M.empty decls imported_progs :: [PassM ProgBundle0] <- - mapM (processImport cfg pstate_ref (modname : import_route) dir) imports + mapM (processImport cfg pstate_ref (modname : import_route) dir) imports let prog = do imported_progs' <- mapM id imported_progs toplevels <- catMaybes <$> mapM (collectTopLevel type_syns funtys) decls let (defs,_vars,funs,inlines,main) = foldr classify init_acc toplevels funs' = foldr (\v acc -> M.update (\fn@(FunDef{funMeta}) -> Just (fn { funMeta = funMeta { funInline = Inline }})) v acc) funs inlines - imported_progs' <- mapM id imported_progs - let (defs0,funs0) = - foldr - (\Prog{ddefs,fundefs} (defs1,funs1) -> - let ddef_names1 = M.keysSet defs1 - ddef_names2 = M.keysSet ddefs - fn_names1 = M.keysSet funs1 - fn_names2 = M.keysSet fundefs - em1 = S.intersection ddef_names1 ddef_names2 - em2 = S.intersection fn_names1 fn_names2 - conflicts1 = foldr - (\d acc -> - if (ddefs M.! d) /= (defs1 M.! d) - then d : acc - else acc) - [] - em1 - conflicts2 = foldr - (\f acc -> - if (fundefs M.! f) /= (funs1 M.! f) - then dbgTraceIt (sdoc ((fundefs M.! f), (funs1 M.! f))) (f : acc) - else acc) - [] - em2 - in case (conflicts1, conflicts2) of - ([], []) -> (M.union ddefs defs1, M.union fundefs funs1) - (_x:_xs,_) -> error $ "Conflicting definitions of " ++ show conflicts1 ++ " found in " ++ mod_name - (_,_x:_xs) -> error $ "Conflicting definitions of " ++ show (S.toList em2) ++ " found in " ++ mod_name) - (defs, funs') - imported_progs' - pure (Prog defs0 funs0 main) - - let (defs, _vars, funs, inlines, main, optimizeDcons, userOrderings) = - foldr classify init_acc toplevels - userOrderings' = M.fromList $ coalese_constraints userOrderings - funs' = - foldr - (\v acc -> - M.update - (\fn@(FunDef {funMeta}) -> - Just (fn {funMeta = funMeta {funInline = Inline}})) - v - acc) - funs - inlines - funs'' = - foldr - (\v acc -> - M.update - (\fn -> Just (addLayoutMetaData fn optimizeDcons)) - v - acc) - funs' - (P.map fst (S.toList optimizeDcons)) - funs''' = - foldr - (\k acc -> - M.update - (\fn@(FunDef {funName, funMeta}) -> - Just - (fn - { funMeta = - funMeta - { userConstraintsDataCon = - M.lookup funName userOrderings' - } - })) - k - acc) - funs'' - (M.keys userOrderings') - imported_progs' <- mapM id imported_progs - let (defs0, funs0) = - foldr - (\Prog {ddefs, fundefs} (defs1, funs1) -> - let ddef_names1 = M.keysSet defs1 - ddef_names2 = M.keysSet ddefs - fn_names1 = M.keysSet funs1 - fn_names2 = M.keysSet fundefs - em1 = S.intersection ddef_names1 ddef_names2 - em2 = S.intersection fn_names1 fn_names2 - conflicts1 = - foldr - (\d acc -> - if (ddefs M.! d) /= (defs1 M.! d) - then d : acc - else acc) - [] - em1 - conflicts2 = - foldr - (\f acc -> - if (fundefs M.! f) /= (funs1 M.! f) - then dbgTraceIt - (sdoc ((fundefs M.! f), (funs1 M.! f))) - (f : acc) - else acc) - [] - em2 - in case (conflicts1, conflicts2) of - ([], []) -> - (M.union ddefs defs1, M.union fundefs funs1) - (_x:_xs, _) -> - error $ - "Conflicting definitions of " ++ - show conflicts1 ++ " found in " ++ mod_name - (_, _x:_xs) -> - error $ - "Conflicting definitions of " ++ - show (S.toList em2) ++ " found in " ++ mod_name) - (defs, funs''') - imported_progs' - pure (Prog defs0 funs0 main) --dbgTraceIt (sdoc funs) dbgTraceIt "\n" dbgTraceIt (sdoc funs''') dbgTraceIt (sdoc userOrderings') dbgTraceIt "\n" dbgTraceIt (sdoc userOrderings) + let bundle = foldr mergeBundle [] imported_progs' + pure $ ProgBundle bundle (ProgModule modname (Prog defs funs' main) imports) pure prog where - init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing, S.empty, []) + init_acc = (M.empty, M.empty, M.empty, S.empty, Nothing) modname = moduleName head_mb - coalese_constraints :: - [(Var, M.Map DataCon [UserOrdering])] - -> [(Var, M.Map DataCon [UserOrdering])] - coalese_constraints constrs = - case constrs of - [] -> [] - (var, map):xs -> - let same_func_constrs = - P.concatMap - (\(a, b) -> - if (var == a) - then [(a, b)] - else []) - xs - maps_to_merge = P.concatMap (M.toList . snd) same_func_constrs - merged_maps = coalses_dconMap (maps_to_merge ++ M.toList map) - xs' = deleteMany same_func_constrs xs - in [(var, M.fromList merged_maps)] ++ (coalese_constraints xs') - coalses_dconMap :: - [(DataCon, [UserOrdering])] -> [(DataCon, [UserOrdering])] - coalses_dconMap dconOrdrs = - case dconOrdrs of - [] -> [] - (dcon, orderings):xs -> - let same_dcons = - P.concatMap - (\(a, b) -> - if (dcon == a) - then [(a, b)] - else []) - xs - same_orderings = (P.concatMap snd same_dcons) ++ orderings - xs' = deleteMany same_dcons xs - in [(dcon, same_orderings)] ++ coalses_dconMap xs' - deleteOne :: Eq x => (x, y) -> [(x, y)] -> [(x, y)] - deleteOne _ [] = [] -- Nothing to delete - deleteOne (a, b) ((c, d):ys) - | a == c = ys -- Drop exactly one matching item - deleteOne x (y:ys) = y : deleteOne x ys -- Drop one, but not this one (doesn't match). - deleteMany :: Eq x => [(x, y)] -> [(x, y)] -> [(x, y)] - deleteMany [] = id -- Nothing to delete - deleteMany (x:xs) = deleteMany xs . deleteOne x -- Delete one, then the rest. moduleName :: Maybe (ModuleHead a) -> String - moduleName Nothing = mod_name + moduleName Nothing = if imported_name == "Main" then imported_name + else error "Imported module does not have a module declaration" moduleName (Just (ModuleHead _ mod_name1 _warnings _exports)) = - mnameToStr mod_name1 + if imported_name == (mnameToStr mod_name1) || imported_name == "Main" then (mnameToStr mod_name1) + else error "Imported module does not match it's module declaration" classify thing (defs,vars,funs,inlines,main) = case thing of @@ -382,9 +231,9 @@ desugarModule cfg pstate_ref import_route dir (Module _ head_mb _pragmas imports case main of Nothing -> (defs, vars, funs, inlines, m) Just _ -> error $ "A module cannot have two main expressions." - ++ show mod_name + ++ show modname HInline v -> (defs,vars,funs,S.insert v inlines,main) -desugarModule _ _ _ _ m = error $ "desugarModule: " ++ prettyPrint m +desugarModule _ _ _ _ m _ = error $ "desugarModule: " ++ prettyPrint m stdlibModules :: [String] stdlibModules = @@ -405,7 +254,7 @@ processImport :: -> FilePath -> ImportDecl a -> IO (PassM ProgBundle0) -processImport cfg pstate_ref import_route dir decl@ImportDecl {..} +processImport cfg pstate_ref import_route dir ImportDecl {..} -- When compiling with Gibbon, we should *NOT* inline things defined in Gibbon.Prim. | mod_name == "Gibbon.Prim" = do (ParseState imported') <- readIORef pstate_ref diff --git a/gibbon-compiler/src/Gibbon/L0/Syntax.hs b/gibbon-compiler/src/Gibbon/L0/Syntax.hs index 837c34c47..e7848b663 100644 --- a/gibbon-compiler/src/Gibbon/L0/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/L0/Syntax.hs @@ -25,8 +25,6 @@ import qualified Data.Map as M import Gibbon.Common as C import Gibbon.Language hiding (UrTy(..)) -import Language.Haskell.Exts.SrcLoc -import Language.Haskell.Exts (ImportDecl) -------------------------------------------------------------------------------- diff --git a/gibbon-compiler/src/Gibbon/Language/Syntax.hs b/gibbon-compiler/src/Gibbon/Language/Syntax.hs index 8cac7d5f6..d08688fe0 100644 --- a/gibbon-compiler/src/Gibbon/Language/Syntax.hs +++ b/gibbon-compiler/src/Gibbon/Language/Syntax.hs @@ -14,7 +14,6 @@ {-# LANGUAGE InstanceSigs #-} module Gibbon.Language.Syntax - ( -- * Datatype definitions ( DDefs , DataCon @@ -22,9 +21,6 @@ module Gibbon.Language.Syntax , Tag , IsBoxed , DDef(..) - , DataConMap - , UserOrdering(..) - , Constr(..) , lookupDDef , getConOrdering , getTyOfDataCon @@ -43,7 +39,6 @@ module Gibbon.Language.Syntax , FunMeta(..) , FunRec(..) , FunInline(..) - , FunOptimizeLayout(..) , insertFD , fromListFD , initFunEnv @@ -64,8 +59,6 @@ module Gibbon.Language.Syntax , lookupVEnv , extendFEnv , lookupFEnv - , unionEnv2 - , unionEnv2s , lookupVEnv' -- * Expresssions and thier types @@ -343,7 +336,7 @@ instance Out (ImportDecl SrcSpanInfo) where doc = text . show docPrec n v = docPrec n (show v) instance (NFData (TyOf ex), NFData (ArrowTy (TyOf ex)), NFData ex, Generic (ArrowTy (TyOf ex))) => NFData (ProgModule ex) where - rnf (ProgModule name prog imports) = rnf prog + rnf (ProgModule _ prog _) = rnf prog deriving instance (Out (Prog ex)) => Out (ProgModule ex) deriving instance diff --git a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs index 5564e567f..bd9f05293 100644 --- a/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs +++ b/gibbon-compiler/src/Gibbon/Passes/FreshBundle.hs @@ -46,8 +46,8 @@ freshModuleKeys (ProgModule name (Prog defs funs main) imports) uniquedefenv uni -- | Find the imported module from the import header findImportedModule :: ImportDecl SrcSpanInfo -> M.Map String ProgModule0 -> ProgModule0 -findImportedModule mod modmap = do - let (ImportDecl _ (ModuleName _ name) _ _ _ _ _ _) = mod +findImportedModule modl modmap = do + let (ImportDecl _ (ModuleName _ name) _ _ _ _ _ _) = modl case M.lookup name modmap of Just found -> found Nothing -> error $ "Could not find module " ++ name ++ " in imported modules: " ++ (show (M.keys modmap)) @@ -113,7 +113,7 @@ findFreshInTy ty defenv = SymSetTy -> ty SymHashTy -> ty MetaTv{} -> ty - TyVar tv -> ty + TyVar _ -> ty ProdTy tys -> ProdTy $ L.map (\v -> findFreshInTy v defenv) tys SymDictTy v t -> SymDictTy v $ findFreshInTy t defenv PDictTy k v -> do @@ -137,8 +137,8 @@ findFreshInDataCons (con, tys) defenv = -- | Find unique names in expressions findFreshInExp :: Exp0 -> VarEnv -> VarEnv -> VarEnv -> PassM Exp0 -findFreshInExp exp defenv funenv constrenv = - case exp of +findFreshInExp expr defenv funenv constrenv = + case expr of LitE i -> return $ LitE i CharE c -> return $ CharE c FloatE i -> return $ FloatE i @@ -148,7 +148,7 @@ findFreshInExp exp defenv funenv constrenv = AppE v locs ls -> do let v' = findFreshedName v funenv - ls' <- traverse (\v -> findFreshInExp v defenv funenv constrenv) ls + ls' <- traverse (\e -> findFreshInExp e defenv funenv constrenv) ls return $ AppE v' locs ls' PrimAppE p es -> do @@ -198,7 +198,7 @@ findFreshInExp exp defenv funenv constrenv = e' <- findFreshInExp e defenv funenv constrenv return $ WithArenaE v e' SpawnE v locs ls -> do - ls' <- traverse (\v -> findFreshInExp v defenv funenv constrenv) ls + ls' <- traverse (\e -> findFreshInExp e defenv funenv constrenv) ls return $ SpawnE v locs ls' SyncE -> return $ SyncE MapE (v, d, ve) e -> do @@ -304,25 +304,25 @@ getImportedEnv (ProgModule _ (Prog defs funs _) _) imp uniquedefenv uniquefunenv -- simple helper functions to convert `Name`s and `CNames`s to Vars name2var :: Name SrcSpanInfo -> Var name2var name = case name of - Ident l str -> toVar str - Symbol l str -> toVar str + Ident _ str -> toVar str + Symbol _ str -> toVar str cname2var :: CName SrcSpanInfo -> Var cname2var name = case name of - VarName l str -> name2var str - ConName l str -> name2var str + VarName _ str -> name2var str + ConName _ str -> name2var str -- parse the import header speclist parseSpec :: ImportSpec SrcSpanInfo -> [Var] parseSpec imp = case imp of -- imported a variable - IVar l nm -> [name2var nm] + IVar _ nm -> [name2var nm] -- a class, datatype, or type - IAbs l nmspc nm -> [name2var nm] + IAbs _ _ nm -> [name2var nm] -- a class with all it's methods, or a datatype with all it's constructors - IThingAll l nm -> [name2var nm] + IThingAll _ nm -> [name2var nm] -- a class with some of it's methods, or a datatype with some of it's constructors - IThingWith l nm thgs -> [name2var nm] ++ map cname2var thgs + IThingWith _ nm thgs -> [name2var nm] ++ map cname2var thgs -- construct global registry of uniques diff --git a/gibbon-compiler/src/Gibbon/Pretty.hs b/gibbon-compiler/src/Gibbon/Pretty.hs index 1fe45039a..3dec0360e 100644 --- a/gibbon-compiler/src/Gibbon/Pretty.hs +++ b/gibbon-compiler/src/Gibbon/Pretty.hs @@ -68,7 +68,7 @@ instance HasPretty ex => Pretty (Prog ex) where PPHaskell -> ghc_compat_prefix False $+$ ddefsDoc $+$ funsDoc $+$ meDoc $+$ ghc_compat_suffix False instance HasPretty ex => Pretty (ProgModule ex) where - pprintWithStyle sty (ProgModule name prog imports) = + pprintWithStyle sty (ProgModule _ prog _) = let (Prog ddefs funs me) = prog meDoc = case me of Nothing -> empty From 6756e1dbc92b6185c0ff56fbe1af4b820ad497c0 Mon Sep 17 00:00:00 2001 From: timmy Date: Thu, 20 Jun 2024 22:55:29 +0200 Subject: [PATCH 68/68] removing extra files from diff --- IR.log | 2308 ------------------------------ benchmarks/AddImport.c | 93 -- benchmarks/Addone.c | 76 - benchmarks/Addtwo.c | 76 - gibbon-compiler/build.log | 8 - gibbon-compiler/compile.log | 7 - gibbon-compiler/solve_ilp_-34.py | 22 - gibbon-compiler/solve_ilp_-49.py | 22 - gibbon-compiler/solve_ilp_14.py | 22 - 9 files changed, 2634 deletions(-) delete mode 100644 IR.log delete mode 100644 benchmarks/AddImport.c delete mode 100644 benchmarks/Addone.c delete mode 100644 benchmarks/Addtwo.c delete mode 100644 gibbon-compiler/build.log delete mode 100644 gibbon-compiler/compile.log delete mode 100644 gibbon-compiler/solve_ilp_-34.py delete mode 100644 gibbon-compiler/solve_ilp_-49.py delete mode 100644 gibbon-compiler/solve_ilp_14.py diff --git a/IR.log b/IR.log deleted file mode 100644 index 5baf44ccb..000000000 --- a/IR.log +++ /dev/null @@ -1,2308 +0,0 @@ - ! Responding to env Var: GIBBON_DEBUG=4 - ! We set DEBUG based on command-line verbose arg: 4 -cleaned: -module Addimport where - import Addone - import Addtwo - - - main :: Tree - main = Addtwo.add1 2 (Addtwo.add1 (Node (Leaf 1) (Leaf 2))) - -parsed: -ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 8 64, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 4 5 4 5,SrcSpan ".hs" 7 5 7 5,SrcSpan ".hs" 8 5 8 5,SrcSpan ".hs" 8 64 8 64]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 23, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 18 2 23]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 17, srcInfoPoints = []}) "Addimport") Nothing Nothing)) [] [ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 18, srcInfoPoints = [SrcSpan ".hs" 3 5 3 11]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 12 3 18, srcInfoPoints = []}) "Addone", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing},ImportDecl {importAnn = SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 5 4 18, srcInfoPoints = [SrcSpan ".hs" 4 5 4 11]}, importModule = ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 4 12 4 18, srcInfoPoints = []}) "Addtwo", importQualified = False, importSrc = False, importSafe = False, importPkg = Nothing, importAs = Nothing, importSpecs = Nothing}] [TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 5 7 17, srcInfoPoints = [SrcSpan ".hs" 7 10 7 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 5 7 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 64, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 5 8 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 10 8 64, srcInfoPoints = [SrcSpan ".hs" 8 10 8 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 64, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 25, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) (Qual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) "Addtwo") (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 12 8 23, srcInfoPoints = []}) "add1"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 25, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 25, srcInfoPoints = []}) 2 "2"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 26 8 64, srcInfoPoints = [SrcSpan ".hs" 8 26 8 27,SrcSpan ".hs" 8 63 8 64]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 63, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) (Qual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) "Addtwo") (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 38, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 39 8 63, srcInfoPoints = [SrcSpan ".hs" 8 39 8 40,SrcSpan ".hs" 8 62 8 63]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 62, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 53, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 40 8 44, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 45 8 53, srcInfoPoints = [SrcSpan ".hs" 8 45 8 46,SrcSpan ".hs" 8 52 8 53]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 52, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 46 8 50, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 51 8 52, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 51 8 52, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 54 8 62, srcInfoPoints = [SrcSpan ".hs" 8 54 8 55,SrcSpan ".hs" 8 61 8 62]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 61, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 55 8 59, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 60 8 61, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 60 8 61, srcInfoPoints = []}) 2 "2")))))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) - -cleaned: -module Addone where - data Tree = Leaf Int | Node Tree Tree - - add1 :: Tree -> Tree - add1 t = case t of - Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) - - main :: Tree - main = add1 (Node (Leaf 1) (Leaf 2)) - - -parsed: -ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 12 0, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 5 5 5 5,SrcSpan ".hs" 6 5 6 5,SrcSpan ".hs" 10 5 10 5,SrcSpan ".hs" 11 5 11 5,SrcSpan ".hs" 12 1 12 0]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 20, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 15 2 20]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Addone") Nothing Nothing)) [] [] [DataDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 42, srcInfoPoints = [SrcSpan ".hs" 3 15 3 16,SrcSpan ".hs" 3 26 3 27]}) (DataType (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 9, srcInfoPoints = []})) Nothing (DHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) "Tree")) [QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 21, srcInfoPoints = []}) "Leaf") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) "Int"))]),QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 32, srcInfoPoints = []}) "Node") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) "Tree")),TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) "Tree"))])] [],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 25, srcInfoPoints = [SrcSpan ".hs" 5 10 5 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 9, srcInfoPoints = []}) "add1"] (TyFun (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 25, srcInfoPoints = [SrcSpan ".hs" 5 18 5 20]}) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) "Tree"))) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) "Tree")))),FunBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) [Match (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 6 9, srcInfoPoints = []}) "add1") [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) "t")] (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 12 8 51, srcInfoPoints = [SrcSpan ".hs" 6 12 6 13]}) (Case (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 14 8 51, srcInfoPoints = [SrcSpan ".hs" 6 14 6 18,SrcSpan ".hs" 6 21 6 23,SrcSpan ".hs" 7 13 7 13,SrcSpan ".hs" 8 13 8 13,SrcSpan ".hs" 10 5 10 0]}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) "t"))) [Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 39, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 19, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Leaf")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) "x")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 24 7 39, srcInfoPoints = [SrcSpan ".hs" 7 24 7 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) "Leaf"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 32 7 39, srcInfoPoints = [SrcSpan ".hs" 7 32 7 33,SrcSpan ".hs" 7 38 7 39]}) (InfixApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 38, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) "x"))) (QVarOp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (Symbol (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) "+"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) 1 "1")))))) Nothing,Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 51, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 23, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) "Node")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) "x1"),PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) "x2")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 51, srcInfoPoints = [SrcSpan ".hs" 8 24 8 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 51, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 41, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 32 8 41, srcInfoPoints = [SrcSpan ".hs" 8 32 8 33,SrcSpan ".hs" 8 40 8 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 40, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) "x1")))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 42 8 51, srcInfoPoints = [SrcSpan ".hs" 8 42 8 43,SrcSpan ".hs" 8 50 8 51]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 50, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) "x2"))))))) Nothing])) Nothing],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 17, srcInfoPoints = [SrcSpan ".hs" 10 10 10 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 41, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 10 11 41, srcInfoPoints = [SrcSpan ".hs" 11 10 11 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 41, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 17 11 41, srcInfoPoints = [SrcSpan ".hs" 11 17 11 18,SrcSpan ".hs" 11 40 11 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 40, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 31, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 23 11 31, srcInfoPoints = [SrcSpan ".hs" 11 23 11 24,SrcSpan ".hs" 11 30 11 31]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 30, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 32 11 40, srcInfoPoints = [SrcSpan ".hs" 11 32 11 33,SrcSpan ".hs" 11 39 11 40]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) 2 "2")))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) - -cleaned: -module Addone where - data Tree = Leaf Int | Node Tree Tree - - add1 :: Tree -> Tree - add1 t = case t of - Leaf x -> Leaf (x + 1) - Node x1 x2 -> Node (add1 x1) (add1 x2) - - main :: Tree - main = add1 (Node (Leaf 1) (Leaf 2)) - - -parsed: -ParseOk (Module (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 12 0, srcInfoPoints = [SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 2 1 2 1,SrcSpan ".hs" 3 5 3 5,SrcSpan ".hs" 5 5 5 5,SrcSpan ".hs" 6 5 6 5,SrcSpan ".hs" 10 5 10 5,SrcSpan ".hs" 11 5 11 5,SrcSpan ".hs" 12 1 12 0]}) (Just (ModuleHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 1 2 20, srcInfoPoints = [SrcSpan ".hs" 2 1 2 7,SrcSpan ".hs" 2 15 2 20]}) (ModuleName (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 2 8 2 14, srcInfoPoints = []}) "Addone") Nothing Nothing)) [] [] [DataDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 42, srcInfoPoints = [SrcSpan ".hs" 3 15 3 16,SrcSpan ".hs" 3 26 3 27]}) (DataType (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 5 3 9, srcInfoPoints = []})) Nothing (DHead (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 10 3 14, srcInfoPoints = []}) "Tree")) [QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 17 3 21, srcInfoPoints = []}) "Leaf") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 22 3 25, srcInfoPoints = []}) "Int"))]),QualConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) Nothing Nothing (ConDecl (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 28 3 32, srcInfoPoints = []}) "Node") [TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 33 3 37, srcInfoPoints = []}) "Tree")),TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 3 38 3 42, srcInfoPoints = []}) "Tree"))])] [],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 25, srcInfoPoints = [SrcSpan ".hs" 5 10 5 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 5 5 9, srcInfoPoints = []}) "add1"] (TyFun (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 25, srcInfoPoints = [SrcSpan ".hs" 5 18 5 20]}) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 13 5 17, srcInfoPoints = []}) "Tree"))) (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 5 21 5 25, srcInfoPoints = []}) "Tree")))),FunBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) [Match (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 8 51, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 5 6 9, srcInfoPoints = []}) "add1") [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 10 6 11, srcInfoPoints = []}) "t")] (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 12 8 51, srcInfoPoints = [SrcSpan ".hs" 6 12 6 13]}) (Case (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 14 8 51, srcInfoPoints = [SrcSpan ".hs" 6 14 6 18,SrcSpan ".hs" 6 21 6 23,SrcSpan ".hs" 7 13 7 13,SrcSpan ".hs" 8 13 8 13,SrcSpan ".hs" 10 5 10 0]}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 6 19 6 20, srcInfoPoints = []}) "t"))) [Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 39, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 19, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 13 7 17, srcInfoPoints = []}) "Leaf")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 18 7 19, srcInfoPoints = []}) "x")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 24 7 39, srcInfoPoints = [SrcSpan ".hs" 7 24 7 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 27 7 31, srcInfoPoints = []}) "Leaf"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 32 7 39, srcInfoPoints = [SrcSpan ".hs" 7 32 7 33,SrcSpan ".hs" 7 38 7 39]}) (InfixApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 38, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 33 7 34, srcInfoPoints = []}) "x"))) (QVarOp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) (Symbol (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 35 7 36, srcInfoPoints = []}) "+"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 7 37 7 38, srcInfoPoints = []}) 1 "1")))))) Nothing,Alt (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 51, srcInfoPoints = []}) (PApp (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 23, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 13 8 17, srcInfoPoints = []}) "Node")) [PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 18 8 20, srcInfoPoints = []}) "x1"),PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 21 8 23, srcInfoPoints = []}) "x2")]) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 24 8 51, srcInfoPoints = [SrcSpan ".hs" 8 24 8 26]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 51, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 41, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 27 8 31, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 32 8 41, srcInfoPoints = [SrcSpan ".hs" 8 32 8 33,SrcSpan ".hs" 8 40 8 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 40, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 33 8 37, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 38 8 40, srcInfoPoints = []}) "x1")))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 42 8 51, srcInfoPoints = [SrcSpan ".hs" 8 42 8 43,SrcSpan ".hs" 8 50 8 51]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 50, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 43 8 47, srcInfoPoints = []}) "add1"))) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 8 48 8 50, srcInfoPoints = []}) "x2"))))))) Nothing])) Nothing],TypeSig (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 17, srcInfoPoints = [SrcSpan ".hs" 10 10 10 12]}) [Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 5 10 9, srcInfoPoints = []}) "main"] (TyCon (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 10 13 10 17, srcInfoPoints = []}) "Tree"))),PatBind (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 41, srcInfoPoints = []}) (PVar (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 5 11 9, srcInfoPoints = []}) "main")) (UnGuardedRhs (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 10 11 41, srcInfoPoints = [SrcSpan ".hs" 11 10 11 11]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 41, srcInfoPoints = []}) (Var (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 12 11 16, srcInfoPoints = []}) "add1"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 17 11 41, srcInfoPoints = [SrcSpan ".hs" 11 17 11 18,SrcSpan ".hs" 11 40 11 41]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 40, srcInfoPoints = []}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 31, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 18 11 22, srcInfoPoints = []}) "Node"))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 23 11 31, srcInfoPoints = [SrcSpan ".hs" 11 23 11 24,SrcSpan ".hs" 11 30 11 31]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 30, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 24 11 28, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 29 11 30, srcInfoPoints = []}) 1 "1"))))) (Paren (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 32 11 40, srcInfoPoints = [SrcSpan ".hs" 11 32 11 33,SrcSpan ".hs" 11 39 11 40]}) (App (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 39, srcInfoPoints = []}) (Con (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (UnQual (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) (Ident (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 33 11 37, srcInfoPoints = []}) "Leaf"))) (Lit (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) (Int (SrcSpanInfo {srcInfoSpan = SrcSpan ".hs" 11 38 11 39, srcInfoPoints = []}) 2 "2")))))))) Nothing],[Comment True (SrcSpan ".hs" 1 1 1 30) "# LINE 1 \".hs\" #"]) - -config: Config {input = Unspecified, mode = ToExe, benchInput = Nothing, arrayInput = Nothing, verbosity = 4, cc = "gcc", optc = " -O3 -flto ", cfile = Nothing, exefile = Nothing, backend = C, dynflags = DynFlags {generalFlags = fromList [], debugFlags = fromList []}, srcFile = Nothing} - - [compiler] pipeline starting, parsed program: -================================================================================ -Prog {ddefs = [(Tree, - DDef {tyName = "Tree", - tyArgs = [], - dataCons = [("Leaf", [(False, IntTy)]), - ("Node", - [(False, PackedTy "Tree" []),(False, PackedTy "Tree" [])])]})], - fundefs = [(add1, - FunDef {funName = "add1", - funArgs = [t], - funTy = ForAll [] - (ArrowTy [PackedTy "Tree" []] (PackedTy "Tree" [])), - funBody = CaseE (VarE "t") - [("Leaf", - [(x, MetaTv $2)], - DataConE (MetaTv $1) - "Leaf" - [PrimAppE AddP [VarE "x",LitE 1]]), - ("Node", - [(x1, MetaTv $4),(x2, MetaTv $5)], - DataConE (MetaTv $3) - "Node" - [AppE "add1" [] [VarE "x1"], - AppE "add1" [] [VarE "x2"]])], - funMeta = FunMeta {funRec = NotRec, - funInline = NoInline, - funCanTriggerGC = False, - funOptLayout = NoLayoutOpt, - userConstraintsDataCon = Nothing}})], - mainExp = Nothing} - - [compiler] Running pass, renameModules -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0 = - case t_0 of - Leaf x_1::$2 -> - (Leaf $1 x_1 + 1) - Node x1_2::$4 x2_3::$5 -> - (Node $3 (add1 [] x1_2) (add1 [] x2_3)) - - - [compiler] Running pass, freshen -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5::$2 -> - (Leaf $1 x_1_5 + 1) - Node x1_2_6::$4 x2_3_7::$5 -> - (Node $3 (add1 [] x1_2_6) (add1 [] x2_3_7)) - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5::Int -> - (Leaf () x_1_5 + 1) - Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> - (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) - - - [compiler] Running pass, bindLambdas -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5::Int -> - (Leaf () x_1_5 + 1) - Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> - (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) - - - [compiler] Running pass, monomorphize -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5::Int -> - (Leaf () x_1_5 + 1) - Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> - (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) - - - [compiler] Running pass, specLambdas -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5::Int -> - (Leaf () x_1_5 + 1) - Node x1_2_6::(Packed Tree []) x2_3_7::(Packed Tree []) -> - (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) - - - [compiler] Running pass, desugarL0 -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5::() -> - (Leaf () x_1_5 + 1) - Node x1_2_6::() x2_3_7::() -> - (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) -_copy_Tree arg_16 = - case arg_16 of - Leaf x_17::() -> - let y_18 :: Int = x_17 in - (Leaf () y_18) - Node x_19::() x_20::() -> - let y_21 :: (Packed Tree []) = (_copy_Tree [] x_19) in - let y_22 :: (Packed Tree []) = (_copy_Tree [] x_20) in - (Node () y_21 y_22) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) -_copy_without_ptrs_Tree arg_23 = - case arg_23 of - Leaf x_24::() -> - let y_25 :: Int = x_24 in - (Leaf () y_25) - Node x_26::() x_27::() -> - let y_28 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_26) in - let y_29 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_27) in - (Node () y_28 y_29) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: forall. ((Packed Tree []) -> ()) -_traverse_Tree arg_30 = - case arg_30 of - Leaf x_31::() -> - () - Node x_33::() x_34::() -> - let y_35 :: () = (_traverse_Tree [] x_33) in - let y_36 :: () = (_traverse_Tree [] x_34) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: forall. ((Packed Tree []) -> ()) -_print_Tree arg_37 = - case arg_37 of - Leaf x_38::() -> - let wildcard_40 :: () = printsym("(Leaf") in - let wildcard_42 :: () = printsym(" ") in - let y_39 :: () = printint(x_38) in - let wildcard_41 :: () = printsym(")") in - () - Node x_43::() x_44::() -> - let wildcard_47 :: () = printsym("(Node") in - let wildcard_50 :: () = printsym(" ") in - let y_45 :: () = (_print_Tree [] x_43) in - let wildcard_49 :: () = printsym(" ") in - let y_46 :: () = (_print_Tree [] x_44) in - let wildcard_48 :: () = printsym(")") in - () - - - [compiler] Running pass, floatOutCase -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree []) (Packed Tree []) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: forall. ((Packed Tree []) -> (Packed Tree [])) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5::() -> - (Leaf () x_1_5 + 1) - Node x1_2_6::() x2_3_7::() -> - (Node () (add1 [] x1_2_6) (add1 [] x2_3_7)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) -_copy_Tree arg_16 = - case arg_16 of - Leaf x_17::() -> - let y_18 :: Int = x_17 in - (Leaf () y_18) - Node x_19::() x_20::() -> - let y_21 :: (Packed Tree []) = (_copy_Tree [] x_19) in - let y_22 :: (Packed Tree []) = (_copy_Tree [] x_20) in - (Node () y_21 y_22) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: forall. ((Packed Tree []) -> (Packed Tree [])) -_copy_without_ptrs_Tree arg_23 = - case arg_23 of - Leaf x_24::() -> - let y_25 :: Int = x_24 in - (Leaf () y_25) - Node x_26::() x_27::() -> - let y_28 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_26) in - let y_29 :: (Packed Tree []) = (_copy_without_ptrs_Tree [] x_27) in - (Node () y_28 y_29) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: forall. ((Packed Tree []) -> ()) -_traverse_Tree arg_30 = - case arg_30 of - Leaf x_31::() -> - () - Node x_33::() x_34::() -> - let y_35 :: () = (_traverse_Tree [] x_33) in - let y_36 :: () = (_traverse_Tree [] x_34) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: forall. ((Packed Tree []) -> ()) -_print_Tree arg_37 = - case arg_37 of - Leaf x_38::() -> - let wildcard_40 :: () = printsym("(Leaf") in - let wildcard_42 :: () = printsym(" ") in - let y_39 :: () = printint(x_38) in - let wildcard_41 :: () = printsym(")") in - () - Node x_43::() x_44::() -> - let wildcard_47 :: () = printsym("(Node") in - let wildcard_50 :: () = printsym(" ") in - let y_45 :: () = (_print_Tree [] x_43) in - let wildcard_49 :: () = printsym(" ") in - let y_46 :: () = (_print_Tree [] x_44) in - let wildcard_48 :: () = printsym(")") in - () - - - [compiler] Running pass, toL1 -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: (Packed Tree) -> (Packed Tree) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5 -> - (Leaf x_1_5 + 1) - Node x1_2_6 x2_3_7 -> - (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16 = - case arg_16 of - Leaf x_17 -> - let y_18 :: Int = x_17 in - (Leaf y_18) - Node x_19 x_20 -> - let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in - let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in - (Node y_21 y_22) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23 = - case arg_23 of - Leaf x_24 -> - let y_25 :: Int = x_24 in - (Leaf y_25) - Node x_26 x_27 -> - let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in - let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in - (Node y_28 y_29) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30 = - case arg_30 of - Leaf x_31 -> - () - Node x_33 x_34 -> - let y_35 :: () = (_traverse_Tree [] x_33) in - let y_36 :: () = (_traverse_Tree [] x_34) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37 = - case arg_37 of - Leaf x_38 -> - let wildcard_40 :: () = printsym("(Leaf") in - let wildcard_42 :: () = printsym(" ") in - let y_39 :: () = printint(x_38) in - let wildcard_41 :: () = printsym(")") in - () - Node x_43 x_44 -> - let wildcard_47 :: () = printsym("(Node") in - let wildcard_50 :: () = printsym(" ") in - let y_45 :: () = (_print_Tree [] x_43) in - let wildcard_49 :: () = printsym(" ") in - let y_46 :: () = (_print_Tree [] x_44) in - let wildcard_48 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: (Packed Tree) -> (Packed Tree) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5 -> - (Leaf x_1_5 + 1) - Node x1_2_6 x2_3_7 -> - (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16 = - case arg_16 of - Leaf x_17 -> - let y_18 :: Int = x_17 in - (Leaf y_18) - Node x_19 x_20 -> - let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in - let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in - (Node y_21 y_22) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23 = - case arg_23 of - Leaf x_24 -> - let y_25 :: Int = x_24 in - (Leaf y_25) - Node x_26 x_27 -> - let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in - let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in - (Node y_28 y_29) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30 = - case arg_30 of - Leaf x_31 -> - () - Node x_33 x_34 -> - let y_35 :: () = (_traverse_Tree [] x_33) in - let y_36 :: () = (_traverse_Tree [] x_34) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37 = - case arg_37 of - Leaf x_38 -> - let wildcard_40 :: () = printsym("(Leaf") in - let wildcard_42 :: () = printsym(" ") in - let y_39 :: () = printint(x_38) in - let wildcard_41 :: () = printsym(")") in - () - Node x_43 x_44 -> - let wildcard_47 :: () = printsym("(Node") in - let wildcard_50 :: () = printsym(" ") in - let y_45 :: () = (_print_Tree [] x_43) in - let wildcard_49 :: () = printsym(" ") in - let y_46 :: () = (_print_Tree [] x_44) in - let wildcard_48 :: () = printsym(")") in - () - - - [compiler] Running pass, benchMainExp -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: (Packed Tree) -> (Packed Tree) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5 -> - (Leaf x_1_5 + 1) - Node x1_2_6 x2_3_7 -> - (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16 = - case arg_16 of - Leaf x_17 -> - let y_18 :: Int = x_17 in - (Leaf y_18) - Node x_19 x_20 -> - let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in - let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in - (Node y_21 y_22) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23 = - case arg_23 of - Leaf x_24 -> - let y_25 :: Int = x_24 in - (Leaf y_25) - Node x_26 x_27 -> - let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in - let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in - (Node y_28 y_29) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30 = - case arg_30 of - Leaf x_31 -> - () - Node x_33 x_34 -> - let y_35 :: () = (_traverse_Tree [] x_33) in - let y_36 :: () = (_traverse_Tree [] x_34) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37 = - case arg_37 of - Leaf x_38 -> - let wildcard_40 :: () = printsym("(Leaf") in - let wildcard_42 :: () = printsym(" ") in - let y_39 :: () = printint(x_38) in - let wildcard_41 :: () = printsym(")") in - () - Node x_43 x_44 -> - let wildcard_47 :: () = printsym("(Node") in - let wildcard_50 :: () = printsym(" ") in - let y_45 :: () = (_print_Tree [] x_43) in - let wildcard_49 :: () = printsym(" ") in - let y_46 :: () = (_print_Tree [] x_44) in - let wildcard_48 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = NotRec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -add1 :: (Packed Tree) -> (Packed Tree) -add1 t_0_4 = - case t_0_4 of - Leaf x_1_5 -> - (Leaf x_1_5 + 1) - Node x1_2_6 x2_3_7 -> - (Node (add1 [] x1_2_6) (add1 [] x2_3_7)) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16 = - case arg_16 of - Leaf x_17 -> - let y_18 :: Int = x_17 in - (Leaf y_18) - Node x_19 x_20 -> - let y_21 :: (Packed Tree) = (_copy_Tree [] x_19) in - let y_22 :: (Packed Tree) = (_copy_Tree [] x_20) in - (Node y_21 y_22) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23 = - case arg_23 of - Leaf x_24 -> - let y_25 :: Int = x_24 in - (Leaf y_25) - Node x_26 x_27 -> - let y_28 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26) in - let y_29 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27) in - (Node y_28 y_29) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30 = - case arg_30 of - Leaf x_31 -> - () - Node x_33 x_34 -> - let y_35 :: () = (_traverse_Tree [] x_33) in - let y_36 :: () = (_traverse_Tree [] x_34) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37 = - case arg_37 of - Leaf x_38 -> - let wildcard_40 :: () = printsym("(Leaf") in - let wildcard_42 :: () = printsym(" ") in - let y_39 :: () = printint(x_38) in - let wildcard_41 :: () = printsym(")") in - () - Node x_43 x_44 -> - let wildcard_47 :: () = printsym("(Node") in - let wildcard_50 :: () = printsym(" ") in - let y_45 :: () = (_print_Tree [] x_43) in - let wildcard_49 :: () = printsym(" ") in - let y_46 :: () = (_print_Tree [] x_44) in - let wildcard_48 :: () = printsym(")") in - () - - - [compiler] Running pass, simplify -Removed unused functions: [Var "add1"] -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16_55 = - case arg_16_55 of - Leaf x_17_56 -> - let y_18_57 :: Int = x_17_56 in - (Leaf y_18_57) - Node x_19_58 x_20_59 -> - let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in - let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in - (Node y_21_60 y_22_61) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23_62 = - case arg_23_62 of - Leaf x_24_63 -> - let y_25_64 :: Int = x_24_63 in - (Leaf y_25_64) - Node x_26_65 x_27_66 -> - let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in - let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in - (Node y_28_67 y_29_68) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30_69 = - case arg_30_69 of - Leaf x_31_70 -> - () - Node x_33_71 x_34_72 -> - let y_35_73 :: () = (_traverse_Tree [] x_33_71) in - let y_36_74 :: () = (_traverse_Tree [] x_34_72) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37_75 = - case arg_37_75 of - Leaf x_38_76 -> - let wildcard_40_77 :: () = printsym("(Leaf") in - let wildcard_42_78 :: () = printsym(" ") in - let y_39_79 :: () = printint(x_38_76) in - let wildcard_41_80 :: () = printsym(")") in - () - Node x_43_81 x_44_82 -> - let wildcard_47_83 :: () = printsym("(Node") in - let wildcard_50_84 :: () = printsym(" ") in - let y_45_85 :: () = (_print_Tree [] x_43_81) in - let wildcard_49_86 :: () = printsym(" ") in - let y_46_87 :: () = (_print_Tree [] x_44_82) in - let wildcard_48_88 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16_55 = - case arg_16_55 of - Leaf x_17_56 -> - let y_18_57 :: Int = x_17_56 in - (Leaf y_18_57) - Node x_19_58 x_20_59 -> - let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in - let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in - (Node y_21_60 y_22_61) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23_62 = - case arg_23_62 of - Leaf x_24_63 -> - let y_25_64 :: Int = x_24_63 in - (Leaf y_25_64) - Node x_26_65 x_27_66 -> - let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in - let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in - (Node y_28_67 y_29_68) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30_69 = - case arg_30_69 of - Leaf x_31_70 -> - () - Node x_33_71 x_34_72 -> - let y_35_73 :: () = (_traverse_Tree [] x_33_71) in - let y_36_74 :: () = (_traverse_Tree [] x_34_72) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37_75 = - case arg_37_75 of - Leaf x_38_76 -> - let wildcard_40_77 :: () = printsym("(Leaf") in - let wildcard_42_78 :: () = printsym(" ") in - let y_39_79 :: () = printint(x_38_76) in - let wildcard_41_80 :: () = printsym(")") in - () - Node x_43_81 x_44_82 -> - let wildcard_47_83 :: () = printsym("(Node") in - let wildcard_50_84 :: () = printsym(" ") in - let y_45_85 :: () = (_print_Tree [] x_43_81) in - let wildcard_49_86 :: () = printsym(" ") in - let y_46_87 :: () = (_print_Tree [] x_44_82) in - let wildcard_48_88 :: () = printsym(")") in - () - - - [compiler] Running pass, flatten -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16_55 = - case arg_16_55 of - Leaf x_17_56 -> - let y_18_57 :: Int = x_17_56 in - (Leaf y_18_57) - Node x_19_58 x_20_59 -> - let y_21_60 :: (Packed Tree) = (_copy_Tree [] x_19_58) in - let y_22_61 :: (Packed Tree) = (_copy_Tree [] x_20_59) in - (Node y_21_60 y_22_61) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23_62 = - case arg_23_62 of - Leaf x_24_63 -> - let y_25_64 :: Int = x_24_63 in - (Leaf y_25_64) - Node x_26_65 x_27_66 -> - let y_28_67 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65) in - let y_29_68 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66) in - (Node y_28_67 y_29_68) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30_69 = - case arg_30_69 of - Leaf x_31_70 -> - () - Node x_33_71 x_34_72 -> - let y_35_73 :: () = (_traverse_Tree [] x_33_71) in - let y_36_74 :: () = (_traverse_Tree [] x_34_72) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37_75 = - case arg_37_75 of - Leaf x_38_76 -> - let wildcard_40_77 :: () = printsym("(Leaf") in - let wildcard_42_78 :: () = printsym(" ") in - let y_39_79 :: () = printint(x_38_76) in - let wildcard_41_80 :: () = printsym(")") in - () - Node x_43_81 x_44_82 -> - let wildcard_47_83 :: () = printsym("(Node") in - let wildcard_50_84 :: () = printsym(" ") in - let y_45_85 :: () = (_print_Tree [] x_43_81) in - let wildcard_49_86 :: () = printsym(" ") in - let y_46_87 :: () = (_print_Tree [] x_44_82) in - let wildcard_48_88 :: () = printsym(")") in - () - - - [compiler] Running pass, simplify -Removed unused functions: [] -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - let y_18_57_91 :: Int = x_17_56_90 in - (Leaf y_18_57_91) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - let y_25_64_98 :: Int = x_24_63_97 in - (Leaf y_25_64_98) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, inlineTriv -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node (Packed Tree) (Packed Tree) -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: (Packed Tree) -> (Packed Tree) -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: (Packed Tree) = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: (Packed Tree) = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: (Packed Tree) -> (Packed Tree) -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: (Packed Tree) = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: (Packed Tree) -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: (Packed Tree) -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, directL3 -Pass output: -================================================================================ -data Tree = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: Cursor -> Cursor -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: Cursor -> Cursor -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: Cursor -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: Cursor -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: Cursor -> Cursor -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: Cursor -> Cursor -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: Cursor -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: Cursor -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, unariser -Pass output: -================================================================================ -data Tree = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: Cursor -> Cursor -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: Cursor -> Cursor -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: Cursor -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: Cursor -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: Cursor -> Cursor -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: Cursor -> Cursor -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: Cursor -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: Cursor -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.flatten -Pass output: -================================================================================ -data Tree = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: Cursor -> Cursor -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: Cursor -> Cursor -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: Cursor -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: Cursor -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, L3.typecheck -Pass output: -================================================================================ -data Tree = Leaf Int | - Node Cursor Cursor -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_Tree :: Cursor -> Cursor -_copy_Tree arg_16_55_89 = - case arg_16_55_89 of - Leaf x_17_56_90 -> - (Leaf x_17_56_90) - Node x_19_58_92 x_20_59_93 -> - let y_21_60_94 :: Cursor = (_copy_Tree [] x_19_58_92) in - let y_22_61_95 :: Cursor = (_copy_Tree [] x_20_59_93) in - (Node y_21_60_94 y_22_61_95) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_copy_without_ptrs_Tree :: Cursor -> Cursor -_copy_without_ptrs_Tree arg_23_62_96 = - case arg_23_62_96 of - Leaf x_24_63_97 -> - (Leaf x_24_63_97) - Node x_26_65_99 x_27_66_100 -> - let y_28_67_101 :: Cursor = (_copy_without_ptrs_Tree [] x_26_65_99) in - let y_29_68_102 :: Cursor = (_copy_without_ptrs_Tree [] x_27_66_100) in - (Node y_28_67_101 y_29_68_102) - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_traverse_Tree :: Cursor -> () -_traverse_Tree arg_30_69_103 = - case arg_30_69_103 of - Leaf x_31_70_104 -> - () - Node x_33_71_105 x_34_72_106 -> - let y_35_73_107 :: () = (_traverse_Tree [] x_33_71_105) in - let y_36_74_108 :: () = (_traverse_Tree [] x_34_72_106) in - () - -{meta: FunMeta {funRec = Rec, funInline = NoInline, funCanTriggerGC = False, funOptLayout = NoLayoutOpt, userConstraintsDataCon = Nothing}} -_print_Tree :: Cursor -> () -_print_Tree arg_37_75_109 = - case arg_37_75_109 of - Leaf x_38_76_110 -> - let wildcard_40_77_111 :: () = printsym("(Leaf") in - let wildcard_42_78_112 :: () = printsym(" ") in - let y_39_79_113 :: () = printint(x_38_76_110) in - let wildcard_41_80_114 :: () = printsym(")") in - () - Node x_43_81_115 x_44_82_116 -> - let wildcard_47_83_117 :: () = printsym("(Node") in - let wildcard_50_84_118 :: () = printsym(" ") in - let y_45_85_119 :: () = (_print_Tree [] x_43_81_115) in - let wildcard_49_86_120 :: () = printsym(" ") in - let y_46_87_121 :: () = (_print_Tree [] x_44_82_116) in - let wildcard_48_88_122 :: () = printsym(")") in - () - - - [compiler] Running pass, lower -Pass output: -================================================================================ -Prog {infoTable = [("Tree", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), - (126, " ")], - fundefs = [FunDecl {funName = "_copy_Tree", - funArgs = [(arg_16_55_89, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), - (tail_128, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_16_55_89"], - bod = Switch "switch_131" - (VarTriv "tag_127") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_56_90, - IntTy)], - ptr = "tail_128", - bod = LetAllocT {lhs = "tailift_129", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_17_56_90")], - bod = RetValsT [VarTriv "tailift_129"]}}), - (1, - LetUnpackT {binds = [(x_19_58_92, - CursorTy), - (x_20_59_93, - CursorTy)], - ptr = "tail_128", - bod = LetCallT {async = False, - binds = [(y_21_60_94, - CursorTy)], - rator = "_copy_Tree", - rands = [VarTriv "x_19_58_92"], - bod = LetCallT {async = False, - binds = [(y_22_61_95, - CursorTy)], - rator = "_copy_Tree", - rands = [VarTriv "x_20_59_93"], - bod = LetAllocT {lhs = "tailift_130", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_21_60_94"), - (CursorTy, - VarTriv "y_22_61_95")], - bod = RetValsT [VarTriv "tailift_130"]}}}})]) - (Just ErrT "Unknown tag in: tag_127")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Tree", - funArgs = [(arg_23_62_96, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), - (tail_133, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_23_62_96"], - bod = Switch "switch_136" - (VarTriv "tag_132") - (IntAlts [(0, - LetUnpackT {binds = [(x_24_63_97, - IntTy)], - ptr = "tail_133", - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_24_63_97")], - bod = RetValsT [VarTriv "tailift_134"]}}), - (1, - LetUnpackT {binds = [(x_26_65_99, - CursorTy), - (x_27_66_100, - CursorTy)], - ptr = "tail_133", - bod = LetCallT {async = False, - binds = [(y_28_67_101, - CursorTy)], - rator = "_copy_without_ptrs_Tree", - rands = [VarTriv "x_26_65_99"], - bod = LetCallT {async = False, - binds = [(y_29_68_102, - CursorTy)], - rator = "_copy_without_ptrs_Tree", - rands = [VarTriv "x_27_66_100"], - bod = LetAllocT {lhs = "tailift_135", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_28_67_101"), - (CursorTy, - VarTriv "y_29_68_102")], - bod = RetValsT [VarTriv "tailift_135"]}}}})]) - (Just ErrT "Unknown tag in: tag_132")}, - isPure = True}, - FunDecl {funName = "_traverse_Tree", - funArgs = [(arg_30_69_103, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), - (tail_138, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_30_69_103"], - bod = Switch "switch_139" - (VarTriv "tag_137") - (IntAlts [(0, - LetUnpackT {binds = [(x_31_70_104, - IntTy)], - ptr = "tail_138", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_33_71_105, - CursorTy), - (x_34_72_106, - CursorTy)], - ptr = "tail_138", - bod = LetCallT {async = False, - binds = [(y_35_73_107, - ProdTy [])], - rator = "_traverse_Tree", - rands = [VarTriv "x_33_71_105"], - bod = LetCallT {async = False, - binds = [(y_36_74_108, - ProdTy [])], - rator = "_traverse_Tree", - rands = [VarTriv "x_34_72_106"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_137")}, - isPure = True}, - FunDecl {funName = "_print_Tree", - funArgs = [(arg_37_75_109, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), - (tail_141, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_37_75_109"], - bod = Switch "switch_142" - (VarTriv "tag_140") - (IntAlts [(0, - LetUnpackT {binds = [(x_38_76_110, - IntTy)], - ptr = "tail_141", - bod = LetPrimCallT {binds = [(wildcard_40_77_111, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 125], - bod = LetPrimCallT {binds = [(wildcard_42_78_112, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetPrimCallT {binds = [(y_39_79_113, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_38_76_110"], - bod = LetPrimCallT {binds = [(wildcard_41_80_114, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 123], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_43_81_115, - CursorTy), - (x_44_82_116, - CursorTy)], - ptr = "tail_141", - bod = LetPrimCallT {binds = [(wildcard_47_83_117, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 124], - bod = LetPrimCallT {binds = [(wildcard_50_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetCallT {async = False, - binds = [(y_45_85_119, - ProdTy [])], - rator = "_print_Tree", - rands = [VarTriv "x_43_81_115"], - bod = LetPrimCallT {binds = [(wildcard_49_86_120, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetCallT {async = False, - binds = [(y_46_87_121, - ProdTy [])], - rator = "_print_Tree", - rands = [VarTriv "x_44_82_116"], - bod = LetPrimCallT {binds = [(wildcard_48_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 123], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_140")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Running pass, lateInlineTriv -Pass output: -================================================================================ -Prog {infoTable = [("Tree", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), - (126, " ")], - fundefs = [FunDecl {funName = "_copy_Tree", - funArgs = [(arg_16_55_89, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), - (tail_128, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_16_55_89"], - bod = Switch "switch_131" - (VarTriv "tag_127") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_56_90, - IntTy)], - ptr = "tail_128", - bod = LetAllocT {lhs = "tailift_129", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_17_56_90")], - bod = RetValsT [VarTriv "tailift_129"]}}), - (1, - LetUnpackT {binds = [(x_19_58_92, - CursorTy), - (x_20_59_93, - CursorTy)], - ptr = "tail_128", - bod = LetCallT {async = False, - binds = [(y_21_60_94, - CursorTy)], - rator = "_copy_Tree", - rands = [VarTriv "x_19_58_92"], - bod = LetCallT {async = False, - binds = [(y_22_61_95, - CursorTy)], - rator = "_copy_Tree", - rands = [VarTriv "x_20_59_93"], - bod = LetAllocT {lhs = "tailift_130", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_21_60_94"), - (CursorTy, - VarTriv "y_22_61_95")], - bod = RetValsT [VarTriv "tailift_130"]}}}})]) - (Just ErrT "Unknown tag in: tag_127")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Tree", - funArgs = [(arg_23_62_96, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), - (tail_133, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_23_62_96"], - bod = Switch "switch_136" - (VarTriv "tag_132") - (IntAlts [(0, - LetUnpackT {binds = [(x_24_63_97, - IntTy)], - ptr = "tail_133", - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_24_63_97")], - bod = RetValsT [VarTriv "tailift_134"]}}), - (1, - LetUnpackT {binds = [(x_26_65_99, - CursorTy), - (x_27_66_100, - CursorTy)], - ptr = "tail_133", - bod = LetCallT {async = False, - binds = [(y_28_67_101, - CursorTy)], - rator = "_copy_without_ptrs_Tree", - rands = [VarTriv "x_26_65_99"], - bod = LetCallT {async = False, - binds = [(y_29_68_102, - CursorTy)], - rator = "_copy_without_ptrs_Tree", - rands = [VarTriv "x_27_66_100"], - bod = LetAllocT {lhs = "tailift_135", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_28_67_101"), - (CursorTy, - VarTriv "y_29_68_102")], - bod = RetValsT [VarTriv "tailift_135"]}}}})]) - (Just ErrT "Unknown tag in: tag_132")}, - isPure = True}, - FunDecl {funName = "_traverse_Tree", - funArgs = [(arg_30_69_103, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), - (tail_138, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_30_69_103"], - bod = Switch "switch_139" - (VarTriv "tag_137") - (IntAlts [(0, - LetUnpackT {binds = [(x_31_70_104, - IntTy)], - ptr = "tail_138", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_33_71_105, - CursorTy), - (x_34_72_106, - CursorTy)], - ptr = "tail_138", - bod = LetCallT {async = False, - binds = [(y_35_73_107, - ProdTy [])], - rator = "_traverse_Tree", - rands = [VarTriv "x_33_71_105"], - bod = LetCallT {async = False, - binds = [(y_36_74_108, - ProdTy [])], - rator = "_traverse_Tree", - rands = [VarTriv "x_34_72_106"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_137")}, - isPure = True}, - FunDecl {funName = "_print_Tree", - funArgs = [(arg_37_75_109, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), - (tail_141, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_37_75_109"], - bod = Switch "switch_142" - (VarTriv "tag_140") - (IntAlts [(0, - LetUnpackT {binds = [(x_38_76_110, - IntTy)], - ptr = "tail_141", - bod = LetPrimCallT {binds = [(wildcard_40_77_111, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 125], - bod = LetPrimCallT {binds = [(wildcard_42_78_112, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetPrimCallT {binds = [(y_39_79_113, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_38_76_110"], - bod = LetPrimCallT {binds = [(wildcard_41_80_114, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 123], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_43_81_115, - CursorTy), - (x_44_82_116, - CursorTy)], - ptr = "tail_141", - bod = LetPrimCallT {binds = [(wildcard_47_83_117, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 124], - bod = LetPrimCallT {binds = [(wildcard_50_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetCallT {async = False, - binds = [(y_45_85_119, - ProdTy [])], - rator = "_print_Tree", - rands = [VarTriv "x_43_81_115"], - bod = LetPrimCallT {binds = [(wildcard_49_86_120, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetCallT {async = False, - binds = [(y_46_87_121, - ProdTy [])], - rator = "_print_Tree", - rands = [VarTriv "x_44_82_116"], - bod = LetPrimCallT {binds = [(wildcard_48_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 123], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_140")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Running pass, rearrangeFree -Pass output: -================================================================================ -Prog {infoTable = [("Tree", - [("Leaf", - DataConInfo {dcon_tag = 0, - scalar_bytes = 8, - num_shortcut = 0, - num_scalars = 1, - num_packed = 0, - field_tys = [IntTy]}), - ("Node", - DataConInfo {dcon_tag = 1, - scalar_bytes = 0, - num_shortcut = 2, - num_scalars = 0, - num_packed = 0, - field_tys = [CursorTy,CursorTy]})])], - symbolTable = [(123, ")"),(124, "(Node"),(125, "(Leaf"), - (126, " ")], - fundefs = [FunDecl {funName = "_copy_Tree", - funArgs = [(arg_16_55_89, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_127, TagTyPacked), - (tail_128, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_16_55_89"], - bod = Switch "switch_131" - (VarTriv "tag_127") - (IntAlts [(0, - LetUnpackT {binds = [(x_17_56_90, - IntTy)], - ptr = "tail_128", - bod = LetAllocT {lhs = "tailift_129", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_17_56_90")], - bod = RetValsT [VarTriv "tailift_129"]}}), - (1, - LetUnpackT {binds = [(x_19_58_92, - CursorTy), - (x_20_59_93, - CursorTy)], - ptr = "tail_128", - bod = LetCallT {async = False, - binds = [(y_21_60_94, - CursorTy)], - rator = "_copy_Tree", - rands = [VarTriv "x_19_58_92"], - bod = LetCallT {async = False, - binds = [(y_22_61_95, - CursorTy)], - rator = "_copy_Tree", - rands = [VarTriv "x_20_59_93"], - bod = LetAllocT {lhs = "tailift_130", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_21_60_94"), - (CursorTy, - VarTriv "y_22_61_95")], - bod = RetValsT [VarTriv "tailift_130"]}}}})]) - (Just ErrT "Unknown tag in: tag_127")}, - isPure = True}, - FunDecl {funName = "_copy_without_ptrs_Tree", - funArgs = [(arg_23_62_96, CursorTy)], - funRetTy = CursorTy, - funBody = LetPrimCallT {binds = [(tag_132, TagTyPacked), - (tail_133, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_23_62_96"], - bod = Switch "switch_136" - (VarTriv "tag_132") - (IntAlts [(0, - LetUnpackT {binds = [(x_24_63_97, - IntTy)], - ptr = "tail_133", - bod = LetAllocT {lhs = "tailift_134", - vals = [(IntTy, - IntTriv 0), - (IntTy, - VarTriv "x_24_63_97")], - bod = RetValsT [VarTriv "tailift_134"]}}), - (1, - LetUnpackT {binds = [(x_26_65_99, - CursorTy), - (x_27_66_100, - CursorTy)], - ptr = "tail_133", - bod = LetCallT {async = False, - binds = [(y_28_67_101, - CursorTy)], - rator = "_copy_without_ptrs_Tree", - rands = [VarTriv "x_26_65_99"], - bod = LetCallT {async = False, - binds = [(y_29_68_102, - CursorTy)], - rator = "_copy_without_ptrs_Tree", - rands = [VarTriv "x_27_66_100"], - bod = LetAllocT {lhs = "tailift_135", - vals = [(IntTy, - IntTriv 1), - (CursorTy, - VarTriv "y_28_67_101"), - (CursorTy, - VarTriv "y_29_68_102")], - bod = RetValsT [VarTriv "tailift_135"]}}}})]) - (Just ErrT "Unknown tag in: tag_132")}, - isPure = True}, - FunDecl {funName = "_traverse_Tree", - funArgs = [(arg_30_69_103, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_137, TagTyPacked), - (tail_138, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_30_69_103"], - bod = Switch "switch_139" - (VarTriv "tag_137") - (IntAlts [(0, - LetUnpackT {binds = [(x_31_70_104, - IntTy)], - ptr = "tail_138", - bod = RetValsT []}), - (1, - LetUnpackT {binds = [(x_33_71_105, - CursorTy), - (x_34_72_106, - CursorTy)], - ptr = "tail_138", - bod = LetCallT {async = False, - binds = [(y_35_73_107, - ProdTy [])], - rator = "_traverse_Tree", - rands = [VarTriv "x_33_71_105"], - bod = LetCallT {async = False, - binds = [(y_36_74_108, - ProdTy [])], - rator = "_traverse_Tree", - rands = [VarTriv "x_34_72_106"], - bod = RetValsT []}}})]) - (Just ErrT "Unknown tag in: tag_137")}, - isPure = True}, - FunDecl {funName = "_print_Tree", - funArgs = [(arg_37_75_109, CursorTy)], - funRetTy = ProdTy [], - funBody = LetPrimCallT {binds = [(tag_140, TagTyPacked), - (tail_141, CursorTy)], - prim = ReadScalar IntS, - rands = [VarTriv "arg_37_75_109"], - bod = Switch "switch_142" - (VarTriv "tag_140") - (IntAlts [(0, - LetUnpackT {binds = [(x_38_76_110, - IntTy)], - ptr = "tail_141", - bod = LetPrimCallT {binds = [(wildcard_40_77_111, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 125], - bod = LetPrimCallT {binds = [(wildcard_42_78_112, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetPrimCallT {binds = [(y_39_79_113, - ProdTy [])], - prim = PrintInt, - rands = [VarTriv "x_38_76_110"], - bod = LetPrimCallT {binds = [(wildcard_41_80_114, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 123], - bod = RetValsT []}}}}}), - (1, - LetUnpackT {binds = [(x_43_81_115, - CursorTy), - (x_44_82_116, - CursorTy)], - ptr = "tail_141", - bod = LetPrimCallT {binds = [(wildcard_47_83_117, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 124], - bod = LetPrimCallT {binds = [(wildcard_50_84_118, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetCallT {async = False, - binds = [(y_45_85_119, - ProdTy [])], - rator = "_print_Tree", - rands = [VarTriv "x_43_81_115"], - bod = LetPrimCallT {binds = [(wildcard_49_86_120, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 126], - bod = LetCallT {async = False, - binds = [(y_46_87_121, - ProdTy [])], - rator = "_print_Tree", - rands = [VarTriv "x_44_82_116"], - bod = LetPrimCallT {binds = [(wildcard_48_88_122, - ProdTy [])], - prim = PrintSym, - rands = [SymTriv 123], - bod = RetValsT []}}}}}}})]) - (Just ErrT "Unknown tag in: tag_140")}, - isPure = True}], - mainExp = Nothing} - - [compiler] Final C codegen: 8787 characters. -================================================================================ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef struct GibIntProd_struct { - GibInt field0; - } GibIntProd; -typedef struct GibIntGibIntProd_struct { - GibInt field0; - GibInt field1; - } GibIntGibIntProd; -typedef struct GibIntGibCursorGibCursorProd_struct { - GibInt field0; - GibCursor field1; - GibCursor field2; - } GibIntGibCursorGibCursorProd; -typedef struct GibPackedTagGibCursorProd_struct { - GibPackedTag field0; - GibCursor field1; - } GibPackedTagGibCursorProd; -typedef struct GibCursorProd_struct { - GibCursor field0; - } GibCursorProd; -typedef struct GibCursorGibCursorProd_struct { - GibCursor field0; - GibCursor field1; - } GibCursorGibCursorProd; -GibCursor _copy_Tree(GibCursor arg_16_55_89); -GibCursor _copy_without_ptrs_Tree(GibCursor arg_23_62_96); -unsigned char _traverse_Tree(GibCursor arg_30_69_103); -unsigned char _print_Tree(GibCursor arg_37_75_109); -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - Tree_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(8); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[1]; - - error = gib_info_table_insert_packed_dcon(Tree_T, 0, 8, 0, 1, 0, field_tys, - 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, Tree_T, 0); - exit(1); - } - error = gib_info_table_insert_packed_dcon(Tree_T, 1, 0, 2, 0, 0, field_tys, - 0); - if (error < 0) { - fprintf(stderr, - "Couldn't insert into info table, errorno=%d, tycon=%d, dcon=%d", - error, Tree_T, 1); - exit(1); - } - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ - gib_add_symbol(123, ")"); - gib_add_symbol(124, "(Node"); - gib_add_symbol(125, "(Leaf"); - gib_add_symbol(126, " "); -} -GibCursor _copy_Tree(GibCursor arg_16_55_89) -{ - GibPackedTag tag_127 = *(GibPackedTag *) arg_16_55_89; - GibCursor tail_128 = arg_16_55_89 + sizeof(GibInt); - - - switch_131: - ; - switch (tag_127) { - - case 0: - { - GibInt x_17_56_90 = ((GibIntProd *) tail_128)->field0; - GibPtr tailift_129 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_129)->field0 = 0; - ((GibIntGibIntProd *) tailift_129)->field1 = x_17_56_90; - return tailift_129; - break; - } - - case 1: - { - GibCursor x_19_58_92 = - ((GibCursorGibCursorProd *) tail_128)->field0; - GibCursor x_20_59_93 = - ((GibCursorGibCursorProd *) tail_128)->field1; - GibCursor y_21_60_94 = _copy_Tree(x_19_58_92); - GibCursor y_22_61_95 = _copy_Tree(x_20_59_93); - GibPtr tailift_130 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_130)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_130)->field1 = y_21_60_94; - ((GibIntGibCursorGibCursorProd *) tailift_130)->field2 = y_22_61_95; - return tailift_130; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_127"); - exit(1); - } - } -} -GibCursor _copy_without_ptrs_Tree(GibCursor arg_23_62_96) -{ - GibPackedTag tag_132 = *(GibPackedTag *) arg_23_62_96; - GibCursor tail_133 = arg_23_62_96 + sizeof(GibInt); - - - switch_136: - ; - switch (tag_132) { - - case 0: - { - GibInt x_24_63_97 = ((GibIntProd *) tail_133)->field0; - GibPtr tailift_134 = gib_alloc(sizeof(GibIntGibIntProd)); - - ((GibIntGibIntProd *) tailift_134)->field0 = 0; - ((GibIntGibIntProd *) tailift_134)->field1 = x_24_63_97; - return tailift_134; - break; - } - - case 1: - { - GibCursor x_26_65_99 = - ((GibCursorGibCursorProd *) tail_133)->field0; - GibCursor x_27_66_100 = - ((GibCursorGibCursorProd *) tail_133)->field1; - GibCursor y_28_67_101 = _copy_without_ptrs_Tree(x_26_65_99); - GibCursor y_29_68_102 = _copy_without_ptrs_Tree(x_27_66_100); - GibPtr tailift_135 = - gib_alloc(sizeof(GibIntGibCursorGibCursorProd)); - - ((GibIntGibCursorGibCursorProd *) tailift_135)->field0 = 1; - ((GibIntGibCursorGibCursorProd *) tailift_135)->field1 = - y_28_67_101; - ((GibIntGibCursorGibCursorProd *) tailift_135)->field2 = - y_29_68_102; - return tailift_135; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_132"); - exit(1); - } - } -} -unsigned char _traverse_Tree(GibCursor arg_30_69_103) -{ - GibPackedTag tag_137 = *(GibPackedTag *) arg_30_69_103; - GibCursor tail_138 = arg_30_69_103 + sizeof(GibInt); - - - switch_139: - ; - switch (tag_137) { - - case 0: - { - GibInt x_31_70_104 = ((GibIntProd *) tail_138)->field0; - - return 0; - break; - } - - case 1: - { - GibCursor x_33_71_105 = - ((GibCursorGibCursorProd *) tail_138)->field0; - GibCursor x_34_72_106 = - ((GibCursorGibCursorProd *) tail_138)->field1; - unsigned char y_35_73_107 = _traverse_Tree(x_33_71_105); - unsigned char y_36_74_108 = _traverse_Tree(x_34_72_106); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_137"); - exit(1); - } - } -} -unsigned char _print_Tree(GibCursor arg_37_75_109) -{ - GibPackedTag tag_140 = *(GibPackedTag *) arg_37_75_109; - GibCursor tail_141 = arg_37_75_109 + sizeof(GibInt); - - - switch_142: - ; - switch (tag_140) { - - case 0: - { - GibInt x_38_76_110 = ((GibIntProd *) tail_141)->field0; - unsigned char wildcard_40_77_111 = gib_print_symbol(125); - unsigned char wildcard_42_78_112 = gib_print_symbol(126); - unsigned char y_39_79_113 = printf("%ld", x_38_76_110); - unsigned char wildcard_41_80_114 = gib_print_symbol(123); - - return 0; - break; - } - - case 1: - { - GibCursor x_43_81_115 = - ((GibCursorGibCursorProd *) tail_141)->field0; - GibCursor x_44_82_116 = - ((GibCursorGibCursorProd *) tail_141)->field1; - unsigned char wildcard_47_83_117 = gib_print_symbol(124); - unsigned char wildcard_50_84_118 = gib_print_symbol(126); - unsigned char y_45_85_119 = _print_Tree(x_43_81_115); - unsigned char wildcard_49_86_120 = gib_print_symbol(126); - unsigned char y_46_87_121 = _print_Tree(x_44_82_116); - unsigned char wildcard_48_88_122 = gib_print_symbol(123); - - return 0; - break; - } - - default: - { - printf("%s\n", "Unknown tag in: tag_140"); - exit(1); - } - } -} -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - int exit_1 = gib_exit(); - - return exit_1; -} - -Compiling RTS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -make -f /home/timmy/git/gibbon/gibbon-rts/Makefile MODE=release GC=nongen USER_CFLAGS=" -O3 -flto " VERBOSITY=4 - -make: Nothing to be done for 'all'. - - - - -Compiling the program -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -gcc -std=gnu11 -O3 -flto -D_GIBBON_GENGC=0 -D_GIBBON_SIMPLE_WRITE_BARRIER=0 -D_GIBBON_EAGER_PROMOTION=1 -o /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.exe -I/home/timmy/git/gibbon/gibbon-rts/build -L/home/timmy/git/gibbon/gibbon-rts/build -Wl,-rpath=/home/timmy/git/gibbon/gibbon-rts/build /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.c /home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.o -lm -lgibbon_rts_ng - - - -In file included from /home/timmy/git/gibbon/./gibbon-compiler/examples/addimport.c:3:0: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h: In function ‘gib_indirection_barrier’: -/home/timmy/git/gibbon/gibbon-rts/build/gibbon_rts.h:1075:6: warning: #warning "Simple write barrier is disabled." [-Wcpp] - #warning "Simple write barrier is disabled." - ^~~~~~~ - - diff --git a/benchmarks/AddImport.c b/benchmarks/AddImport.c deleted file mode 100644 index 59ad8c64e..000000000 --- a/benchmarks/AddImport.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef struct GibIntProd_struct { - GibInt field0; - } GibIntProd; -GibInt add1(GibInt x_1_10_13); -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(7); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[0]; - - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ } -GibInt add1(GibInt x_1_10_13) -{ - GibInt flt_15 = x_1_10_13 + 1; - - return flt_15; -} -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - GibInt fltAppE_11_12 = add1(0); - GibInt tmp_app_14 = add1(fltAppE_11_12); - - printf("%ld", tmp_app_14); - printf("\n"); - return 0; - - int exit_1 = gib_exit(); - - return exit_1; -} \ No newline at end of file diff --git a/benchmarks/Addone.c b/benchmarks/Addone.c deleted file mode 100644 index bb458c5cc..000000000 --- a/benchmarks/Addone.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(7); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[0]; - - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ } -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - int exit_1 = gib_exit(); - - return exit_1; -} \ No newline at end of file diff --git a/benchmarks/Addtwo.c b/benchmarks/Addtwo.c deleted file mode 100644 index bb458c5cc..000000000 --- a/benchmarks/Addtwo.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Gibbon program. */ - -#include "gibbon_rts.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _WIN64 -#include -#endif - -#ifdef _GIBBON_POINTER -#include -#endif - -#ifdef _GIBBON_PARALLEL -#include -#include -#endif - -/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Program starts here - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - */ - -typedef enum { - GibInt_T, - GibFloat_T, - GibSym_T, - GibBool_T, - GibVector_T, - GibList_T, - GibCursor_T, - } GibDatatype; -void info_table_initialize(void) -{ - int error = gib_info_table_initialize(7); - - if (error < 0) { - fprintf(stderr, "Couldn't initialize info table, errorno=%d", error); - exit(1); - } - - GibDatatype field_tys[0]; - - gib_info_table_finalize(); -} -void symbol_table_initialize(void) -{ } -int main(int argc, char **argv) -{ - int init_0 = gib_init(argc, argv); - - info_table_initialize(); - symbol_table_initialize(); - - int exit_1 = gib_exit(); - - return exit_1; -} \ No newline at end of file diff --git a/gibbon-compiler/build.log b/gibbon-compiler/build.log deleted file mode 100644 index cb9f8de35..000000000 --- a/gibbon-compiler/build.log +++ /dev/null @@ -1,8 +0,0 @@ -Build profile: -w ghc-9.2.8 -O1 -In order, the following will be built (use -v for more details): - - gibbon-0.3 (lib) (file src/Gibbon/Language/Syntax.hs changed) - - gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) - - gibbon-0.3 (exe:gibbon) (dependency rebuilt) -Preprocessing library for gibbon-0.3.. -Building library for gibbon-0.3.. -[16 of 61] Compiling Gibbon.NewL2.Syntax ( src/Gibbon/NewL2/Syntax.hs, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.o, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.dyn_o ) [Gibbon.Language.Syntax changed] diff --git a/gibbon-compiler/compile.log b/gibbon-compiler/compile.log deleted file mode 100644 index 7db011525..000000000 --- a/gibbon-compiler/compile.log +++ /dev/null @@ -1,7 +0,0 @@ -Build profile: -w ghc-9.2.8 -O1 -In order, the following will be built (use -v for more details): - - gibbon-0.3 (lib) (file src/Gibbon/HaskellFrontend.hs changed) - - gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt) - - gibbon-0.3 (exe:gibbon) (dependency rebuilt) -Preprocessing library for gibbon-0.3.. -Building library for gibbon-0.3.. diff --git a/gibbon-compiler/solve_ilp_-34.py b/gibbon-compiler/solve_ilp_-34.py deleted file mode 100644 index 25e74d77b..000000000 --- a/gibbon-compiler/solve_ilp_-34.py +++ /dev/null @@ -1,22 +0,0 @@ -from docplex.mp.model import Model -model_2 = Model() -x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") -x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") -cost3 = model_2.integer_var(name="cost3") -x_minus_y11 = (x_00 - x_11) -cost5 = (x_minus_y11 == -1) -cost6 = (x_minus_y11 <= -1) -cost7 = (x_minus_y11 == 1) -cost8 = (x_minus_y11 >= 1) -cost9 = (x_minus_y11 != -1) -cost10 = (x_minus_y11 != 1) -model_2.add(cost5 <= (cost3 == 0)) -model_2.add((cost6 & cost9) <= (cost3 == 100)) -model_2.add(cost7 <= (cost3 == 200)) -model_2.add((cost8 & cost10) <= (cost3 == 300)) -min4 = cost3 * 50 -model_2.add(x_00 != x_11) -model_2.minimize(min4 + 0) -soln12 = model_2.solve() -print("({},{})".format(0, soln12.get_value(x_00))) -print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/solve_ilp_-49.py b/gibbon-compiler/solve_ilp_-49.py deleted file mode 100644 index 25e74d77b..000000000 --- a/gibbon-compiler/solve_ilp_-49.py +++ /dev/null @@ -1,22 +0,0 @@ -from docplex.mp.model import Model -model_2 = Model() -x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") -x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") -cost3 = model_2.integer_var(name="cost3") -x_minus_y11 = (x_00 - x_11) -cost5 = (x_minus_y11 == -1) -cost6 = (x_minus_y11 <= -1) -cost7 = (x_minus_y11 == 1) -cost8 = (x_minus_y11 >= 1) -cost9 = (x_minus_y11 != -1) -cost10 = (x_minus_y11 != 1) -model_2.add(cost5 <= (cost3 == 0)) -model_2.add((cost6 & cost9) <= (cost3 == 100)) -model_2.add(cost7 <= (cost3 == 200)) -model_2.add((cost8 & cost10) <= (cost3 == 300)) -min4 = cost3 * 50 -model_2.add(x_00 != x_11) -model_2.minimize(min4 + 0) -soln12 = model_2.solve() -print("({},{})".format(0, soln12.get_value(x_00))) -print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file diff --git a/gibbon-compiler/solve_ilp_14.py b/gibbon-compiler/solve_ilp_14.py deleted file mode 100644 index 25e74d77b..000000000 --- a/gibbon-compiler/solve_ilp_14.py +++ /dev/null @@ -1,22 +0,0 @@ -from docplex.mp.model import Model -model_2 = Model() -x_00 = model_2.integer_var(lb=0, ub=1, name="x_00") -x_11 = model_2.integer_var(lb=0, ub=1, name="x_11") -cost3 = model_2.integer_var(name="cost3") -x_minus_y11 = (x_00 - x_11) -cost5 = (x_minus_y11 == -1) -cost6 = (x_minus_y11 <= -1) -cost7 = (x_minus_y11 == 1) -cost8 = (x_minus_y11 >= 1) -cost9 = (x_minus_y11 != -1) -cost10 = (x_minus_y11 != 1) -model_2.add(cost5 <= (cost3 == 0)) -model_2.add((cost6 & cost9) <= (cost3 == 100)) -model_2.add(cost7 <= (cost3 == 200)) -model_2.add((cost8 & cost10) <= (cost3 == 300)) -min4 = cost3 * 50 -model_2.add(x_00 != x_11) -model_2.minimize(min4 + 0) -soln12 = model_2.solve() -print("({},{})".format(0, soln12.get_value(x_00))) -print("({},{})".format(1, soln12.get_value(x_11))) \ No newline at end of file