aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Text/BlazeT.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/BlazeT.hs')
-rw-r--r--src/Text/BlazeT.hs81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/Text/BlazeT.hs b/src/Text/BlazeT.hs
new file mode 100644
index 0000000..27228fa
--- /dev/null
+++ b/src/Text/BlazeT.hs
@@ -0,0 +1,81 @@
1{-# LANGUAGE UndecidableInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE RankNTypes #-}
4module Text.BlazeT
5 (
6 -- * Important types.
7 Markup
8 , Tag
9 , Attribute
10 , AttributeValue
11
12 -- * Creating attributes.
13 , dataAttribute
14 , customAttribute
15
16 -- * Converting values to Markup.
17 , ToMarkup (..)
18 , text
19 , preEscapedText
20 , lazyText
21 , preEscapedLazyText
22 , string
23 , preEscapedString
24 , unsafeByteString
25 , unsafeLazyByteString
26
27 -- * Comments
28 , textComment
29 , lazyTextComment
30 , stringComment
31 , unsafeByteStringComment
32 , unsafeLazyByteStringComment
33
34 -- * Creating tags.
35 , textTag
36 , stringTag
37
38 -- * Converting values to attribute values.
39 , B.ToValue (..)
40 , textValue
41 , preEscapedTextValue
42 , lazyTextValue
43 , preEscapedLazyTextValue
44 , stringValue
45 , preEscapedStringValue
46 , unsafeByteStringValue
47 , unsafeLazyByteStringValue
48
49 -- * Setting attributes
50 , (!)
51 , (!?)
52
53 -- * Modifiying Markup trees
54 , contents
55
56 -- * BlazeT new stuff
57 ,MarkupM
58 ,Markup2
59 ,mapMarkupT
60 ,MarkupT
61 ,runMarkup
62 ,runMarkupT
63 ,execMarkup
64 ,execMarkupT
65 ) where
66
67import qualified Text.Blaze as B
68import Text.BlazeT.Internal
69
70class ToMarkup a where
71 toMarkup :: a -> Markup
72 preEscapedToMarkup :: a -> Markup
73
74-- test :: (ToMarkup a, Monad m) => a -> MarkupT m ()
75-- test = toMarkup
76
77instance B.ToMarkup a => ToMarkup a where
78 toMarkup = wrapMarkup . B.toMarkup
79 {-# INLINE toMarkup #-}
80 preEscapedToMarkup = wrapMarkup . B.preEscapedToMarkup
81 {-# INLINE preEscapedToMarkup #-}