Skip to content

Commit

Permalink
fixing manyFuncs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtimmy committed Feb 21, 2024
1 parent 1387304 commit 1d9fed9
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gibbon-compiler/examples/layout_bench/Basics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()



Expand Down
38 changes: 38 additions & 0 deletions gibbon-compiler/examples/layout_bench/manyFuncs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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



Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1d9fed9

Please sign in to comment.