aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Benchmarks/BenchmarkUtils.hs
blob: 4b9546c076ad237f7099e88c28c10df44f73c551 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
-- | This is a module which contains some ad-hoc HTML combinators for use when
-- benchmarking
--
{-# LANGUAGE OverloadedStrings, NoMonomorphismRestriction #-}
module Benchmarks.BenchmarkUtils
    ( Html
    , toHtml

    , tr
    , td
    , html
    , head
    , title
    , body
    , div
    , h1
    , h2
    , p
    , ol
    , li
    , table
    , img
    , id
    ) where

import Prelude hiding (div, head, id)
import Text.Blaze
import Text.Blaze.Internal

type Html = Markup

toHtml :: ToMarkup a => a -> Html
toHtml = toMarkup

tr :: Html  -- ^ Inner HTML.
   -> Html  -- ^ Resulting HTML.
tr = Parent "tr" "<tr" "</tr>"
{-# INLINE tr #-}

td :: Html  -- ^ Inner HTML.
   -> Html  -- ^ Resulting HTML.
td = Parent "td" "<td" "</td>"
{-# INLINE td #-}

html :: Html  -- ^ Inner HTML.
     -> Html  -- ^ Resulting HTML.
html = Parent "html" "<html" "</html>"
{-# INLINE html #-}

head :: Html  -- ^ Inner HTML.
     -> Html  -- ^ Resulting HTML.
head = Parent "head" "<head" "</head>"
{-# INLINE head #-}

title :: Html  -- ^ Inner HTML.
      -> Html  -- ^ Resulting HTML.
title = Parent "title" "<title" "</title>"
{-# INLINE title #-}

body :: Html  -- ^ Inner HTML.
     -> Html  -- ^ Resulting HTML.
body = Parent "body" "<body" "</body>"
{-# INLINE body #-}

div :: Html  -- ^ Inner HTML.
    -> Html  -- ^ Resulting HTML.
div = Parent "div" "<div" "</div>"
{-# INLINE div #-}

h1 :: Html  -- ^ Inner HTML.
   -> Html  -- ^ Resulting HTML.
h1 = Parent "h1" "<h1" "</h1>"
{-# INLINE h1 #-}

h2 :: Html  -- ^ Inner HTML.
   -> Html  -- ^ Resulting HTML.
h2 = Parent "h2" "<h2" "</h2>"
{-# INLINE h2 #-}

p :: Html  -- ^ Inner HTML.
  -> Html  -- ^ Resulting HTML.
p = Parent "p" "<p" "</p>"
{-# INLINE p #-}

ol :: Html  -- ^ Inner HTML.
   -> Html  -- ^ Resulting HTML.
ol = Parent "ol" "<ol" "</ol>"
{-# INLINE ol #-}

li :: Html  -- ^ Inner HTML.
   -> Html  -- ^ Resulting HTML.
li = Parent "li" "<li" "</li>"
{-# INLINE li #-}

table :: Html  -- ^ Inner HTML.
      -> Html  -- ^ Resulting HTML.
table = Parent "table" "<table" "</table>"
{-# INLINE table #-}

img :: Html  -- ^ Resulting HTML.
img = Leaf "img" "<img" ">"
{-# INLINE img #-}

id :: AttributeValue  -- ^ Attribute value.
   -> Attribute       -- ^ Resulting attribute.
id = attribute "id" " id=\""
{-# INLINE id #-}