diff options
Diffstat (limited to 'src/Text/BlazeT/Renderer/Utf8.hs')
-rw-r--r-- | src/Text/BlazeT/Renderer/Utf8.hs | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/Text/BlazeT/Renderer/Utf8.hs b/src/Text/BlazeT/Renderer/Utf8.hs new file mode 100644 index 0000000..292f81f --- /dev/null +++ b/src/Text/BlazeT/Renderer/Utf8.hs | |||
@@ -0,0 +1,66 @@ | |||
1 | {-# OPTIONS_GHC -fsimpl-tick-factor=230 #-} | ||
2 | |||
3 | -- the above option was not needed with | ||
4 | -- ,blaze-html >= 0.6.0.0 && < 0.7.0.0 | ||
5 | -- ,blaze-builder >= 0.2 | ||
6 | -- ,text < 1.2 | ||
7 | |||
8 | module Text.BlazeT.Renderer.Utf8 | ||
9 | ( | ||
10 | renderMarkupBuilder | ||
11 | , renderMarkup | ||
12 | , renderMarkupToByteStringIO | ||
13 | , renderHtmlBuilder | ||
14 | , renderHtml | ||
15 | , renderHtmlToByteStringIO | ||
16 | |||
17 | -- * new BlazeT stuff | ||
18 | , renderMarkupBuilderT | ||
19 | , renderMarkupT | ||
20 | , renderMarkupToByteStringIOT | ||
21 | , renderHtmlToByteStringIOT | ||
22 | , renderHtmlBuilderT | ||
23 | , renderHtmlT | ||
24 | ) where | ||
25 | |||
26 | import qualified Blaze.ByteString.Builder as B | ||
27 | import Control.Monad | ||
28 | import Control.Monad.Identity | ||
29 | import qualified Data.ByteString as BS | ||
30 | import qualified Data.ByteString.Lazy as BL | ||
31 | import qualified Text.Blaze.Renderer.Utf8 as BU | ||
32 | import Text.BlazeT | ||
33 | |||
34 | renderMarkupBuilder :: MarkupM a -> B.Builder | ||
35 | renderMarkupBuilder = runIdentity . renderMarkupBuilderT | ||
36 | |||
37 | renderMarkupBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
38 | renderMarkupBuilderT = liftM BU.renderMarkupBuilder . execMarkupT | ||
39 | |||
40 | renderHtmlBuilder :: MarkupM a -> B.Builder | ||
41 | renderHtmlBuilder = renderMarkupBuilder | ||
42 | |||
43 | renderHtmlBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
44 | renderHtmlBuilderT = renderMarkupBuilderT | ||
45 | |||
46 | renderMarkup :: MarkupM a -> BL.ByteString | ||
47 | renderMarkup = runIdentity . renderMarkupT | ||
48 | renderMarkupT :: Monad m => MarkupT m a -> m BL.ByteString | ||
49 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
50 | |||
51 | renderHtml :: MarkupM a -> BL.ByteString | ||
52 | renderHtml = renderMarkup | ||
53 | renderHtmlT :: Monad m => MarkupT m a -> m BL.ByteString | ||
54 | renderHtmlT = renderMarkupT | ||
55 | |||
56 | renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () | ||
57 | renderMarkupToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g | ||
58 | renderMarkupToByteStringIOT :: Monad m => (BS.ByteString -> IO ()) -> | ||
59 | MarkupT m a -> m (IO ()) | ||
60 | renderMarkupToByteStringIOT g = liftM (BU.renderMarkupToByteStringIO g) . execMarkupT | ||
61 | |||
62 | renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () | ||
63 | renderHtmlToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g | ||
64 | renderHtmlToByteStringIOT :: Monad m => (BS.ByteString -> IO ()) -> | ||
65 | MarkupT m a -> m (IO ()) | ||
66 | renderHtmlToByteStringIOT g = liftM (BU.renderMarkupToByteStringIO g) . execMarkupT | ||