aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Benchmarks/BenchmarkUtils.hs
diff options
context:
space:
mode:
authorJohannes Gerer <oss@johannesgerer.com>2016-10-26 02:07:02 +0200
committerJohannes Gerer <oss@johannesgerer.com>2016-10-26 02:07:02 +0200
commit675085c2e0b0b851378da08b7d73024766107c87 (patch)
tree5a927de4a9576aef7e6129b96e74aa5c96f9ffb6 /src/Benchmarks/BenchmarkUtils.hs
downloadblazeT-675085c2e0b0b851378da08b7d73024766107c87.tar.gz
blazeT-675085c2e0b0b851378da08b7d73024766107c87.tar.zst
blazeT-675085c2e0b0b851378da08b7d73024766107c87.zip
Initial
Diffstat (limited to 'src/Benchmarks/BenchmarkUtils.hs')
-rw-r--r--src/Benchmarks/BenchmarkUtils.hs107
1 files changed, 107 insertions, 0 deletions
diff --git a/src/Benchmarks/BenchmarkUtils.hs b/src/Benchmarks/BenchmarkUtils.hs
new file mode 100644
index 0000000..4b9546c
--- /dev/null
+++ b/src/Benchmarks/BenchmarkUtils.hs
@@ -0,0 +1,107 @@
1-- | This is a module which contains some ad-hoc HTML combinators for use when
2-- benchmarking
3--
4{-# LANGUAGE OverloadedStrings, NoMonomorphismRestriction #-}
5module Benchmarks.BenchmarkUtils
6 ( Html
7 , toHtml
8
9 , tr
10 , td
11 , html
12 , head
13 , title
14 , body
15 , div
16 , h1
17 , h2
18 , p
19 , ol
20 , li
21 , table
22 , img
23 , id
24 ) where
25
26import Prelude hiding (div, head, id)
27import Text.Blaze
28import Text.Blaze.Internal
29
30type Html = Markup
31
32toHtml :: ToMarkup a => a -> Html
33toHtml = toMarkup
34
35tr :: Html -- ^ Inner HTML.
36 -> Html -- ^ Resulting HTML.
37tr = Parent "tr" "<tr" "</tr>"
38{-# INLINE tr #-}
39
40td :: Html -- ^ Inner HTML.
41 -> Html -- ^ Resulting HTML.
42td = Parent "td" "<td" "</td>"
43{-# INLINE td #-}
44
45html :: Html -- ^ Inner HTML.
46 -> Html -- ^ Resulting HTML.
47html = Parent "html" "<html" "</html>"
48{-# INLINE html #-}
49
50head :: Html -- ^ Inner HTML.
51 -> Html -- ^ Resulting HTML.
52head = Parent "head" "<head" "</head>"
53{-# INLINE head #-}
54
55title :: Html -- ^ Inner HTML.
56 -> Html -- ^ Resulting HTML.
57title = Parent "title" "<title" "</title>"
58{-# INLINE title #-}
59
60body :: Html -- ^ Inner HTML.
61 -> Html -- ^ Resulting HTML.
62body = Parent "body" "<body" "</body>"
63{-# INLINE body #-}
64
65div :: Html -- ^ Inner HTML.
66 -> Html -- ^ Resulting HTML.
67div = Parent "div" "<div" "</div>"
68{-# INLINE div #-}
69
70h1 :: Html -- ^ Inner HTML.
71 -> Html -- ^ Resulting HTML.
72h1 = Parent "h1" "<h1" "</h1>"
73{-# INLINE h1 #-}
74
75h2 :: Html -- ^ Inner HTML.
76 -> Html -- ^ Resulting HTML.
77h2 = Parent "h2" "<h2" "</h2>"
78{-# INLINE h2 #-}
79
80p :: Html -- ^ Inner HTML.
81 -> Html -- ^ Resulting HTML.
82p = Parent "p" "<p" "</p>"
83{-# INLINE p #-}
84
85ol :: Html -- ^ Inner HTML.
86 -> Html -- ^ Resulting HTML.
87ol = Parent "ol" "<ol" "</ol>"
88{-# INLINE ol #-}
89
90li :: Html -- ^ Inner HTML.
91 -> Html -- ^ Resulting HTML.
92li = Parent "li" "<li" "</li>"
93{-# INLINE li #-}
94
95table :: Html -- ^ Inner HTML.
96 -> Html -- ^ Resulting HTML.
97table = Parent "table" "<table" "</table>"
98{-# INLINE table #-}
99
100img :: Html -- ^ Resulting HTML.
101img = Leaf "img" "<img" ">"
102{-# INLINE img #-}
103
104id :: AttributeValue -- ^ Attribute value.
105 -> Attribute -- ^ Resulting attribute.
106id = attribute "id" " id=\""
107{-# INLINE id #-}