From 675085c2e0b0b851378da08b7d73024766107c87 Mon Sep 17 00:00:00 2001 From: Johannes Gerer Date: Wed, 26 Oct 2016 02:07:02 +0200 Subject: Initial --- src/Benchmarks/BenchmarkUtils.hs | 107 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/Benchmarks/BenchmarkUtils.hs (limited to 'src/Benchmarks/BenchmarkUtils.hs') 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 @@ +-- | 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" "" +{-# INLINE tr #-} + +td :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +td = Parent "td" "" +{-# INLINE td #-} + +html :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +html = Parent "html" "" +{-# INLINE html #-} + +head :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +head = Parent "head" "" +{-# INLINE head #-} + +title :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +title = Parent "title" "" +{-# INLINE title #-} + +body :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +body = Parent "body" "" +{-# INLINE body #-} + +div :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +div = Parent "div" "" +{-# INLINE div #-} + +h1 :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +h1 = Parent "h1" "" +{-# INLINE h1 #-} + +h2 :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +h2 = Parent "h2" "" +{-# INLINE h2 #-} + +p :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +p = Parent "p" "" +{-# INLINE p #-} + +ol :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +ol = Parent "ol" "" +{-# INLINE ol #-} + +li :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +li = Parent "li" "" +{-# INLINE li #-} + +table :: Html -- ^ Inner HTML. + -> Html -- ^ Resulting HTML. +table = Parent "table" "" +{-# INLINE table #-} + +img :: Html -- ^ Resulting HTML. +img = Leaf "img" "" +{-# INLINE img #-} + +id :: AttributeValue -- ^ Attribute value. + -> Attribute -- ^ Resulting attribute. +id = attribute "id" " id=\"" +{-# INLINE id #-} -- cgit v1.2.3