From a82d9bb00b4b3528a6e6d1ab9e13042beae83242 Mon Sep 17 00:00:00 2001 From: vidsinghal Date: Thu, 25 Jan 2024 21:28:45 -0500 Subject: [PATCH] edit --- .../ECOOP-2024-Bench/TreeCopyPostPre.hs | 14 +++++++------- .../ECOOP-2024-Bench/TreeExpoPostPre.hs | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPostPre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPostPre.hs index 9dfd554f9..86dc9b803 100644 --- a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPostPre.hs +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeCopyPostPre.hs @@ -1,18 +1,18 @@ module TreeSum where data PackedInt = P Int -data Tree = Node PackedInt Tree Tree | Leaf +data Tree = Node Tree Tree PackedInt | Leaf mkTree :: Int -> Tree mkTree depth = if depth <= 0 then Leaf else - let - val = P depth + let left = mkTree (depth-1) right = mkTree (depth-1) - in Node val left right + val = P depth + in Node left right val copyPackedInt :: PackedInt -> PackedInt @@ -21,11 +21,11 @@ copyPackedInt a = case a of copyTree :: Tree -> Tree copyTree tree = case tree of - Node val l r -> let + Node l r val -> let newVal = copyPackedInt val sl = copyTree l sr = copyTree r - in Node newVal sl sr + in Node sl sr newVal Leaf -> Leaf @@ -33,4 +33,4 @@ copyTree tree = case tree of gibbon_main = let tree = mkTree 27 newTree = iterate (copyTree tree) - in () --printPacked newTree + in () diff --git a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPostPre.hs b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPostPre.hs index 44ffa6cd5..4f2a2e88a 100644 --- a/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPostPre.hs +++ b/gibbon-compiler/examples/layout_bench/ECOOP-2024-Bench/TreeExpoPostPre.hs @@ -1,7 +1,7 @@ module TreeExpo where data PackedInt = P Int -data Tree = Node PackedInt Tree Tree | Nil +data Tree = Node Tree Tree PackedInt | Nil mkTree :: Int -> Tree @@ -9,10 +9,10 @@ mkTree depth = if depth <= 0 then Nil else let - val = P depth left = mkTree (depth-1) right = mkTree (depth-1) - in Node val left right + val = P depth + in Node left right val expo :: Int -> Int -> Int {-# INLINE expo #-} @@ -27,11 +27,11 @@ expo2 val = case val of expoTree :: Tree -> Tree expoTree tree = case tree of - Node val l r -> let + Node l r val -> let a1 = expo2 val sl = expoTree l sr = expoTree r - in Node a1 sl sr + in Node sl sr a1 Nil -> Nil