{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module TextShow.Text.XHtml () where
import Prelude ()
import Prelude.Compat
import Text.XHtml.Frameset (Html, HtmlAttr, HotLink,
htmlAttrPair, renderHtmlFragment)
import Text.XHtml.Table (HtmlTable)
import TextShow (TextShow(..), FromStringShow(..), fromString, singleton)
import TextShow.TH (deriveTextShow)
instance TextShow Html where
showb :: Html -> Builder
showb = String -> Builder
fromString forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall html. HTML html => html -> String
renderHtmlFragment
{-# INLINE showb #-}
showbList :: [Html] -> Builder
showbList = forall a. Monoid a => [a] -> a
mconcat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map forall a. TextShow a => a -> Builder
showb
{-# INLINE showbList #-}
instance TextShow HtmlAttr where
showb :: HtmlAttr -> Builder
showb HtmlAttr
ha = case HtmlAttr -> (String, String)
htmlAttrPair HtmlAttr
ha of
(String
str, String
val) -> String -> Builder
fromString String
str forall a. Semigroup a => a -> a -> a
<> Char -> Builder
singleton Char
'=' forall a. Semigroup a => a -> a -> a
<> forall a. TextShow a => a -> Builder
showb String
val
{-# INLINE showb #-}
$(deriveTextShow ''HotLink)
instance TextShow HtmlTable where
showb :: HtmlTable -> Builder
showb = forall a. TextShow a => a -> Builder
showb forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. a -> FromStringShow a
FromStringShow
{-# INLINE showb #-}