diff options
author | Johannes Gerer <oss@johannesgerer.com> | 2016-10-26 02:07:02 +0200 |
---|---|---|
committer | Johannes Gerer <oss@johannesgerer.com> | 2016-10-26 02:07:02 +0200 |
commit | 675085c2e0b0b851378da08b7d73024766107c87 (patch) | |
tree | 5a927de4a9576aef7e6129b96e74aa5c96f9ffb6 /src/Text/BlazeT/Renderer/Utf8.hs | |
download | blazeT-675085c2e0b0b851378da08b7d73024766107c87.tar.gz blazeT-675085c2e0b0b851378da08b7d73024766107c87.tar.zst blazeT-675085c2e0b0b851378da08b7d73024766107c87.zip |
Initial
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 | ||