Skip to content

Commit

Permalink
Merge branch 'layout_changes' of github.com:iu-parfunc/gibbon into la…
Browse files Browse the repository at this point in the history
…yout_changes
  • Loading branch information
vidsinghal committed Jan 9, 2024
2 parents daebd24 + cecb100 commit 2729734
Show file tree
Hide file tree
Showing 26 changed files with 1,247 additions and 0 deletions.
Binary file not shown.
682 changes: 682 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/MainGhc.hs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import MainGhc

emphKeywordInContent :: Text -> Blog -> Blog
emphKeywordInContent keyword blogs =
case blogs of
End -> End
Layout1 header id author date content tags rst -> let --present = searchBlogContent keyword content
--_ = printsym (quote "NEWLINE")
--_ = printbool present
--_ = printsym (quote "NEWLINE")
newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
--_ = printsym (quote "NEWLINE")
--_ = printPacked newContent
--_ = printsym (quote "NEWLINE")
newRst = emphKeywordInContent keyword rst
in Layout1 header id author date newContent tags newRst


-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout1 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
20 changes: 20 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1FindBlogs.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import MainGhc

insertKeywordInTagList :: Text -> Blog -> Blog
insertKeywordInTagList keyword blogs = case blogs of
End -> End
Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags
in if present then
let newRst = insertKeywordInTagList keyword rst
in Layout1 header id author date content tags newRst
else insertKeywordInTagList keyword rst


-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout1 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
26 changes: 26 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout1TagSearch.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import MainGhc

emphKeywordInTag :: Text -> Blog -> Blog
emphKeywordInTag keyword blogs = case blogs of
End -> End
Layout1 header id author date content tags rst -> let present = searchBlogTags keyword tags -- search the tags for the keyword
--_ = printbool present
in if (present)
then let newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInTag keyword rst
in Layout1 header id author date newContent tags newRst
else
let newRst = emphKeywordInTag keyword rst
in Layout1 header id author date content tags newRst



-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout1 400000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import MainGhc

emphKeywordInContent :: Text -> Blog -> Blog
emphKeywordInContent keyword blogs =
case blogs of
End -> End
Layout2 content tags rst header id author date -> --let present = searchBlogContent keyword content
-- in
-- if present then
let newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInContent keyword rst
in Layout2 newContent tags newRst header id author date
-- else
-- let newRst = emphKeywordInContent keyword rst
-- in Layout2 content tags newRst header id author date


-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout2 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
21 changes: 21 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2FindBlogs.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import MainGhc


insertKeywordInTagList :: Text -> Blog -> Blog
insertKeywordInTagList keyword blogs = case blogs of
End -> End
Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags
in if present then
let newRst = insertKeywordInTagList keyword rst
in Layout2 content tags newRst header id author date
else insertKeywordInTagList keyword rst


-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout2 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
27 changes: 27 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout2TagSearch.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import MainGhc

emphKeywordInTag :: Text -> Blog -> Blog
emphKeywordInTag keyword blogs = case blogs of
End -> End
Layout2 content tags rst header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword
-- _ = printbool present
in if (present)
then let newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInTag keyword rst
in Layout2 newContent tags newRst header id author date
else
let newRst = emphKeywordInTag keyword rst
in Layout2 content tags newRst header id author date




-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout2 400000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import MainGhc

emphKeywordInContent :: Text -> Blog -> Blog
emphKeywordInContent keyword blogs =
case blogs of
End -> End
Layout3 tags rst content header id author date -> let --present = searchBlogContent keyword content
newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInContent keyword rst
in Layout3 tags newRst newContent header id author date



-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout3 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
20 changes: 20 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3FindBlogs.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import MainGhc

insertKeywordInTagList :: Text -> Blog -> Blog
insertKeywordInTagList keyword blogs = case blogs of
End -> End
Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags
in if present then
let newRst = insertKeywordInTagList keyword rst
in Layout3 tags newRst content header id author date
else insertKeywordInTagList keyword rst


-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout3 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
30 changes: 30 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout3TagSearch.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import MainGhc

emphKeywordInTag :: Text -> Blog -> Blog
emphKeywordInTag keyword blogs = case blogs of
End -> End
Layout3 tags rst content header id author date -> let present = searchBlogTags keyword tags -- search the tags for the keyword
--_ = printbool present
in if present then
let
newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInTag keyword rst
in Layout3 tags newRst newContent header id author date
else
let
newRst = emphKeywordInTag keyword rst
in Layout3 tags newRst content header id author date





-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout3 400000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import MainGhc

emphKeywordInContent :: Text -> Blog -> Blog
emphKeywordInContent keyword blogs =
case blogs of
End -> End
Layout4 tags content rst header id author date -> let --present = searchBlogContent keyword content
newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInContent keyword rst
in Layout4 tags newContent newRst header id author date



-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout4 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
20 changes: 20 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4FindBlogs.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import MainGhc

insertKeywordInTagList :: Text -> Blog -> Blog
insertKeywordInTagList keyword blogs = case blogs of
End -> End
Layout4 tags content rst header id author date -> let present = searchBlogTags keyword tags
in if present then
let newRst = insertKeywordInTagList keyword rst
in Layout4 tags content newRst header id author date
else insertKeywordInTagList keyword rst


-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout4 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
26 changes: 26 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout4TagSearch.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import MainGhc

emphKeywordInTag :: Text -> Blog -> Blog
emphKeywordInTag keyword blogs = case blogs of
End -> End
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 newContent newRst header id author date
else
let newRst = emphKeywordInTag keyword rst
in Layout4 tags content newRst header id author date




-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout4 400000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInTag ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import MainGhc

emphKeywordInContent :: Text -> Blog -> Blog
emphKeywordInContent keyword blogs =
case blogs of
End -> End
Layout5 rst tags content header id author date -> let --present = searchBlogContent keyword content
newContent = case content of
Content block -> Content (emphasizeKeywordInBlock keyword block)
newRst = emphKeywordInContent keyword rst
in Layout5 newRst tags newContent header id author date



-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout5 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList emphKeywordInContent ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
21 changes: 21 additions & 0 deletions gibbon-compiler/examples/layout_bench/Ghc/ghc/layout5FindBlogs.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import MainGhc

insertKeywordInTagList :: Text -> Blog -> Blog
insertKeywordInTagList keyword blogs = case blogs of
End -> End
Layout5 rst tags content header id author date -> let present = searchBlogTags keyword tags
in if present then
let newRst = insertKeywordInTagList keyword rst
in Layout5 newRst tags content header id author date
else insertKeywordInTagList keyword rst



-- main function
main :: IO ()
main =
do let blogs1 = mkBlogs_layout5 1000000
(newblog1, self1, batch1) <- benchFilterBlogsBasedOnKeywordInTagList insertKeywordInTagList ['a'] blogs1 1
putStrLn $ "Length of new Blogs is: "
print (blogLength newblog1)
putStrLn $ "Done."
Loading

0 comments on commit 2729734

Please sign in to comment.