diff options
Diffstat (limited to 'src/Text/BlazeT/Renderer')
-rw-r--r-- | src/Text/BlazeT/Renderer/Pretty.hs | 10 | ||||
-rw-r--r-- | src/Text/BlazeT/Renderer/String.hs | 8 | ||||
-rw-r--r-- | src/Text/BlazeT/Renderer/Text.hs | 50 | ||||
-rw-r--r-- | src/Text/BlazeT/Renderer/Utf8.hs | 34 |
4 files changed, 15 insertions, 87 deletions
diff --git a/src/Text/BlazeT/Renderer/Pretty.hs b/src/Text/BlazeT/Renderer/Pretty.hs index 8977c94..fa8cdad 100644 --- a/src/Text/BlazeT/Renderer/Pretty.hs +++ b/src/Text/BlazeT/Renderer/Pretty.hs | |||
@@ -1,22 +1,14 @@ | |||
1 | module Text.BlazeT.Renderer.Pretty | 1 | module Text.BlazeT.Renderer.Pretty |
2 | ( renderMarkup | 2 | ( renderMarkup |
3 | , renderHtml | 3 | , renderHtml |
4 | , renderMarkupT | ||
5 | , renderHtmlT | ||
6 | ) where | 4 | ) where |
7 | 5 | ||
8 | import Control.Monad | ||
9 | import Control.Monad.Identity | ||
10 | import qualified Text.Blaze.Renderer.Pretty as BU | 6 | import qualified Text.Blaze.Renderer.Pretty as BU |
11 | import Text.BlazeT | 7 | import Text.BlazeT |
12 | 8 | ||
13 | renderMarkup :: MarkupM a -> String | 9 | renderMarkup :: MarkupM a -> String |
14 | renderMarkup = runIdentity . renderMarkupT | 10 | renderMarkup = BU.renderMarkup . execMarkup |
15 | renderMarkupT :: Monad m => MarkupT m a -> m String | ||
16 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
17 | 11 | ||
18 | renderHtml :: MarkupM a -> String | 12 | renderHtml :: MarkupM a -> String |
19 | renderHtml = renderMarkup | 13 | renderHtml = renderMarkup |
20 | renderHtmlT :: Monad m => MarkupT m a -> m String | ||
21 | renderHtmlT = renderMarkupT | ||
22 | 14 | ||
diff --git a/src/Text/BlazeT/Renderer/String.hs b/src/Text/BlazeT/Renderer/String.hs index 0a2de8a..9f0e0a0 100644 --- a/src/Text/BlazeT/Renderer/String.hs +++ b/src/Text/BlazeT/Renderer/String.hs | |||
@@ -2,8 +2,6 @@ module Text.BlazeT.Renderer.String | |||
2 | ( fromChoiceString | 2 | ( fromChoiceString |
3 | , renderMarkup | 3 | , renderMarkup |
4 | , renderHtml | 4 | , renderHtml |
5 | , renderMarkupT | ||
6 | , renderHtmlT | ||
7 | ) where | 5 | ) where |
8 | 6 | ||
9 | import Control.Monad | 7 | import Control.Monad |
@@ -16,12 +14,8 @@ fromChoiceString :: ChoiceString -> String -> String | |||
16 | fromChoiceString = BU.fromChoiceString | 14 | fromChoiceString = BU.fromChoiceString |
17 | 15 | ||
18 | renderMarkup :: MarkupM a -> String | 16 | renderMarkup :: MarkupM a -> String |
19 | renderMarkup = runIdentity . renderMarkupT | 17 | renderMarkup = BU.renderMarkup . execMarkup |
20 | renderMarkupT :: Monad m => MarkupT m a -> m String | ||
21 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
22 | 18 | ||
23 | renderHtml :: MarkupM a -> String | 19 | renderHtml :: MarkupM a -> String |
24 | renderHtml = renderMarkup | 20 | renderHtml = renderMarkup |
25 | renderHtmlT :: Monad m => MarkupT m a -> m String | ||
26 | renderHtmlT = renderMarkupT | ||
27 | 21 | ||
diff --git a/src/Text/BlazeT/Renderer/Text.hs b/src/Text/BlazeT/Renderer/Text.hs index 31181eb..991c81c 100644 --- a/src/Text/BlazeT/Renderer/Text.hs +++ b/src/Text/BlazeT/Renderer/Text.hs | |||
@@ -1,13 +1,5 @@ | |||
1 | module Text.BlazeT.Renderer.Text | 1 | module Text.BlazeT.Renderer.Text |
2 | ( renderMarkupBuilderT | 2 | ( renderMarkupBuilder |
3 | , renderMarkupBuilder | ||
4 | , renderMarkupBuilderWithT | ||
5 | , renderMarkupT | ||
6 | , renderMarkupWithT | ||
7 | , renderHtmlBuilderT | ||
8 | , renderHtmlBuilderWithT | ||
9 | , renderHtmlT | ||
10 | , renderHtmlWithT | ||
11 | , renderMarkupBuilderWith | 3 | , renderMarkupBuilderWith |
12 | , renderMarkup | 4 | , renderMarkup |
13 | , renderMarkupWith | 5 | , renderMarkupWith |
@@ -17,9 +9,7 @@ module Text.BlazeT.Renderer.Text | |||
17 | , renderHtmlWith | 9 | , renderHtmlWith |
18 | ) where | 10 | ) where |
19 | 11 | ||
20 | import Control.Monad | ||
21 | import Data.ByteString (ByteString) | 12 | import Data.ByteString (ByteString) |
22 | import Control.Monad.Identity | ||
23 | import Data.Text (Text) | 13 | import Data.Text (Text) |
24 | import qualified Data.Text.Lazy as L | 14 | import qualified Data.Text.Lazy as L |
25 | import qualified Data.Text.Lazy.Builder as B | 15 | import qualified Data.Text.Lazy.Builder as B |
@@ -28,48 +18,26 @@ import qualified Text.Blaze.Renderer.Text as BU | |||
28 | import Text.BlazeT | 18 | import Text.BlazeT |
29 | 19 | ||
30 | renderMarkupBuilder :: MarkupM a -> B.Builder | 20 | renderMarkupBuilder :: MarkupM a -> B.Builder |
31 | renderMarkupBuilder = runIdentity . renderMarkupBuilderT | 21 | renderMarkupBuilder = BU.renderMarkupBuilder . execMarkup |
32 | |||
33 | renderMarkupBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
34 | renderMarkupBuilderT = liftM BU.renderMarkupBuilder . execMarkupT | ||
35 | 22 | ||
36 | renderHtmlBuilder :: MarkupM a -> B.Builder | 23 | renderHtmlBuilder :: MarkupM a -> B.Builder |
37 | renderHtmlBuilder = renderMarkupBuilder | 24 | renderHtmlBuilder = renderMarkupBuilder |
38 | 25 | ||
39 | renderHtmlBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
40 | renderHtmlBuilderT = renderMarkupBuilderT | ||
41 | |||
42 | renderMarkup :: MarkupM a -> L.Text | 26 | renderMarkup :: MarkupM a -> L.Text |
43 | renderMarkup = runIdentity . renderMarkupT | 27 | renderMarkup = BU.renderMarkup . execMarkup |
44 | renderMarkupT :: Monad m => MarkupT m a -> m L.Text | ||
45 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
46 | 28 | ||
47 | renderHtml :: MarkupM a -> L.Text | 29 | renderHtml :: MarkupM a -> L.Text |
48 | renderHtml = renderMarkup | 30 | renderHtml = renderMarkup |
49 | renderHtmlT :: Monad m => MarkupT m a -> m L.Text | ||
50 | renderHtmlT = renderMarkupT | ||
51 | |||
52 | renderMarkupWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m L.Text | ||
53 | renderMarkupWithT g = liftM (BU.renderMarkupWith g) . execMarkupT | ||
54 | 31 | ||
55 | renderMarkupWith :: (ByteString -> Text) -> MarkupM a -> L.Text | 32 | renderMarkupWith :: (ByteString -> Text) -> MarkupM a -> L.Text |
56 | renderMarkupWith g = runIdentity . renderMarkupWithT g | 33 | renderMarkupWith g = (BH.renderHtmlWith g) . execMarkup |
57 | |||
58 | renderHtmlWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m L.Text | ||
59 | renderHtmlWithT g = liftM (BH.renderHtmlWith g) . execMarkupT | ||
60 | 34 | ||
61 | renderHtmlWith :: (ByteString -> Text) -> MarkupM a -> L.Text | 35 | renderHtmlWith :: (ByteString -> Text) -> MarkupM a -> L.Text |
62 | renderHtmlWith g = runIdentity . renderHtmlWithT g | 36 | renderHtmlWith = renderMarkupWith |
63 | |||
64 | renderHtmlBuilderWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m B.Builder | ||
65 | renderHtmlBuilderWithT g = liftM (BH.renderHtmlBuilderWith g) . execMarkupT | ||
66 | |||
67 | renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder | ||
68 | renderHtmlBuilderWith g = runIdentity . renderHtmlBuilderWithT g | ||
69 | 37 | ||
38 | renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder | ||
39 | renderMarkupBuilderWith g = (BU.renderMarkupBuilderWith g) . execMarkup | ||
70 | 40 | ||
71 | renderMarkupBuilderWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m B.Builder | 41 | renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder |
72 | renderMarkupBuilderWithT g = liftM (BU.renderMarkupBuilderWith g) . execMarkupT | 42 | renderHtmlBuilderWith = renderHtmlBuilderWith |
73 | 43 | ||
74 | renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder | ||
75 | renderMarkupBuilderWith g = runIdentity . renderMarkupBuilderWithT g | ||
diff --git a/src/Text/BlazeT/Renderer/Utf8.hs b/src/Text/BlazeT/Renderer/Utf8.hs index 292f81f..b5fd656 100644 --- a/src/Text/BlazeT/Renderer/Utf8.hs +++ b/src/Text/BlazeT/Renderer/Utf8.hs | |||
@@ -13,54 +13,28 @@ module Text.BlazeT.Renderer.Utf8 | |||
13 | , renderHtmlBuilder | 13 | , renderHtmlBuilder |
14 | , renderHtml | 14 | , renderHtml |
15 | , renderHtmlToByteStringIO | 15 | , renderHtmlToByteStringIO |
16 | |||
17 | -- * new BlazeT stuff | ||
18 | , renderMarkupBuilderT | ||
19 | , renderMarkupT | ||
20 | , renderMarkupToByteStringIOT | ||
21 | , renderHtmlToByteStringIOT | ||
22 | , renderHtmlBuilderT | ||
23 | , renderHtmlT | ||
24 | ) where | 16 | ) where |
25 | 17 | ||
26 | import qualified Blaze.ByteString.Builder as B | 18 | import qualified Blaze.ByteString.Builder as B |
27 | import Control.Monad | ||
28 | import Control.Monad.Identity | ||
29 | import qualified Data.ByteString as BS | 19 | import qualified Data.ByteString as BS |
30 | import qualified Data.ByteString.Lazy as BL | 20 | import qualified Data.ByteString.Lazy as BL |
31 | import qualified Text.Blaze.Renderer.Utf8 as BU | 21 | import qualified Text.Blaze.Renderer.Utf8 as BU |
32 | import Text.BlazeT | 22 | import Text.BlazeT |
33 | 23 | ||
34 | renderMarkupBuilder :: MarkupM a -> B.Builder | 24 | renderMarkupBuilder :: MarkupM a -> B.Builder |
35 | renderMarkupBuilder = runIdentity . renderMarkupBuilderT | 25 | renderMarkupBuilder = BU.renderMarkupBuilder . execMarkup |
36 | |||
37 | renderMarkupBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
38 | renderMarkupBuilderT = liftM BU.renderMarkupBuilder . execMarkupT | ||
39 | 26 | ||
40 | renderHtmlBuilder :: MarkupM a -> B.Builder | 27 | renderHtmlBuilder :: MarkupM a -> B.Builder |
41 | renderHtmlBuilder = renderMarkupBuilder | 28 | renderHtmlBuilder = renderMarkupBuilder |
42 | 29 | ||
43 | renderHtmlBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
44 | renderHtmlBuilderT = renderMarkupBuilderT | ||
45 | |||
46 | renderMarkup :: MarkupM a -> BL.ByteString | 30 | renderMarkup :: MarkupM a -> BL.ByteString |
47 | renderMarkup = runIdentity . renderMarkupT | 31 | renderMarkup = BU.renderMarkup . execMarkup |
48 | renderMarkupT :: Monad m => MarkupT m a -> m BL.ByteString | ||
49 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
50 | 32 | ||
51 | renderHtml :: MarkupM a -> BL.ByteString | 33 | renderHtml :: MarkupM a -> BL.ByteString |
52 | renderHtml = renderMarkup | 34 | renderHtml = renderMarkup |
53 | renderHtmlT :: Monad m => MarkupT m a -> m BL.ByteString | ||
54 | renderHtmlT = renderMarkupT | ||
55 | 35 | ||
56 | renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () | 36 | renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () |
57 | renderMarkupToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g | 37 | renderMarkupToByteStringIO g = BU.renderMarkupToByteStringIO g . execMarkup |
58 | renderMarkupToByteStringIOT :: Monad m => (BS.ByteString -> IO ()) -> | ||
59 | MarkupT m a -> m (IO ()) | ||
60 | renderMarkupToByteStringIOT g = liftM (BU.renderMarkupToByteStringIO g) . execMarkupT | ||
61 | 38 | ||
62 | renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () | 39 | renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () |
63 | renderHtmlToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g | 40 | renderHtmlToByteStringIO = renderMarkupToByteStringIO |
64 | renderHtmlToByteStringIOT :: Monad m => (BS.ByteString -> IO ()) -> | ||
65 | MarkupT m a -> m (IO ()) | ||
66 | renderHtmlToByteStringIOT g = liftM (BU.renderMarkupToByteStringIO g) . execMarkupT | ||