diff options
author | Johannes Gerer <oss@johannesgerer.com> | 2016-10-27 02:18:13 +0200 |
---|---|---|
committer | Johannes Gerer <oss@johannesgerer.com> | 2016-10-27 02:18:13 +0200 |
commit | 95eb4d6a041305a27dc8fcd42ff1831d9961b7a3 (patch) | |
tree | 3433db574dc8d074354ae70232d29a9cb81ba136 /src/Text/BlazeT/Renderer | |
parent | 675085c2e0b0b851378da08b7d73024766107c87 (diff) | |
download | blazeT-95eb4d6a041305a27dc8fcd42ff1831d9961b7a3.tar.gz blazeT-95eb4d6a041305a27dc8fcd42ff1831d9961b7a3.tar.zst blazeT-95eb4d6a041305a27dc8fcd42ff1831d9961b7a3.zip |
Docsv0.0.1
Diffstat (limited to 'src/Text/BlazeT/Renderer')
-rw-r--r-- | src/Text/BlazeT/Renderer/Pretty.hs | 11 | ||||
-rw-r--r-- | src/Text/BlazeT/Renderer/String.hs | 11 | ||||
-rw-r--r-- | src/Text/BlazeT/Renderer/Text.hs | 51 | ||||
-rw-r--r-- | src/Text/BlazeT/Renderer/Utf8.hs | 35 |
4 files changed, 19 insertions, 89 deletions
diff --git a/src/Text/BlazeT/Renderer/Pretty.hs b/src/Text/BlazeT/Renderer/Pretty.hs index 8977c94..5e033ac 100644 --- a/src/Text/BlazeT/Renderer/Pretty.hs +++ b/src/Text/BlazeT/Renderer/Pretty.hs | |||
@@ -1,22 +1,15 @@ | |||
1 | {-# LANGUAGE RankNTypes #-} | ||
1 | module Text.BlazeT.Renderer.Pretty | 2 | module Text.BlazeT.Renderer.Pretty |
2 | ( renderMarkup | 3 | ( renderMarkup |
3 | , renderHtml | 4 | , renderHtml |
4 | , renderMarkupT | ||
5 | , renderHtmlT | ||
6 | ) where | 5 | ) where |
7 | 6 | ||
8 | import Control.Monad | ||
9 | import Control.Monad.Identity | ||
10 | import qualified Text.Blaze.Renderer.Pretty as BU | 7 | import qualified Text.Blaze.Renderer.Pretty as BU |
11 | import Text.BlazeT | 8 | import Text.BlazeT |
12 | 9 | ||
13 | renderMarkup :: MarkupM a -> String | 10 | renderMarkup :: MarkupM a -> String |
14 | renderMarkup = runIdentity . renderMarkupT | 11 | renderMarkup = BU.renderMarkup . execMarkup |
15 | renderMarkupT :: Monad m => MarkupT m a -> m String | ||
16 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
17 | 12 | ||
18 | renderHtml :: MarkupM a -> String | 13 | renderHtml :: MarkupM a -> String |
19 | renderHtml = renderMarkup | 14 | renderHtml = renderMarkup |
20 | renderHtmlT :: Monad m => MarkupT m a -> m String | ||
21 | renderHtmlT = renderMarkupT | ||
22 | 15 | ||
diff --git a/src/Text/BlazeT/Renderer/String.hs b/src/Text/BlazeT/Renderer/String.hs index 0a2de8a..45c4786 100644 --- a/src/Text/BlazeT/Renderer/String.hs +++ b/src/Text/BlazeT/Renderer/String.hs | |||
@@ -1,13 +1,10 @@ | |||
1 | {-# LANGUAGE RankNTypes #-} | ||
1 | module Text.BlazeT.Renderer.String | 2 | module Text.BlazeT.Renderer.String |
2 | ( fromChoiceString | 3 | ( fromChoiceString |
3 | , renderMarkup | 4 | , renderMarkup |
4 | , renderHtml | 5 | , renderHtml |
5 | , renderMarkupT | ||
6 | , renderHtmlT | ||
7 | ) where | 6 | ) where |
8 | 7 | ||
9 | import Control.Monad | ||
10 | import Control.Monad.Identity | ||
11 | import Text.Blaze.Internal (ChoiceString) | 8 | import Text.Blaze.Internal (ChoiceString) |
12 | import qualified Text.Blaze.Renderer.String as BU | 9 | import qualified Text.Blaze.Renderer.String as BU |
13 | import Text.BlazeT | 10 | import Text.BlazeT |
@@ -16,12 +13,8 @@ fromChoiceString :: ChoiceString -> String -> String | |||
16 | fromChoiceString = BU.fromChoiceString | 13 | fromChoiceString = BU.fromChoiceString |
17 | 14 | ||
18 | renderMarkup :: MarkupM a -> String | 15 | renderMarkup :: MarkupM a -> String |
19 | renderMarkup = runIdentity . renderMarkupT | 16 | renderMarkup = BU.renderMarkup . execMarkup |
20 | renderMarkupT :: Monad m => MarkupT m a -> m String | ||
21 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
22 | 17 | ||
23 | renderHtml :: MarkupM a -> String | 18 | renderHtml :: MarkupM a -> String |
24 | renderHtml = renderMarkup | 19 | renderHtml = renderMarkup |
25 | renderHtmlT :: Monad m => MarkupT m a -> m String | ||
26 | renderHtmlT = renderMarkupT | ||
27 | 20 | ||
diff --git a/src/Text/BlazeT/Renderer/Text.hs b/src/Text/BlazeT/Renderer/Text.hs index 31181eb..a595bd1 100644 --- a/src/Text/BlazeT/Renderer/Text.hs +++ b/src/Text/BlazeT/Renderer/Text.hs | |||
@@ -1,13 +1,6 @@ | |||
1 | {-# LANGUAGE RankNTypes #-} | ||
1 | module Text.BlazeT.Renderer.Text | 2 | module Text.BlazeT.Renderer.Text |
2 | ( renderMarkupBuilderT | 3 | ( renderMarkupBuilder |
3 | , renderMarkupBuilder | ||
4 | , renderMarkupBuilderWithT | ||
5 | , renderMarkupT | ||
6 | , renderMarkupWithT | ||
7 | , renderHtmlBuilderT | ||
8 | , renderHtmlBuilderWithT | ||
9 | , renderHtmlT | ||
10 | , renderHtmlWithT | ||
11 | , renderMarkupBuilderWith | 4 | , renderMarkupBuilderWith |
12 | , renderMarkup | 5 | , renderMarkup |
13 | , renderMarkupWith | 6 | , renderMarkupWith |
@@ -17,9 +10,7 @@ module Text.BlazeT.Renderer.Text | |||
17 | , renderHtmlWith | 10 | , renderHtmlWith |
18 | ) where | 11 | ) where |
19 | 12 | ||
20 | import Control.Monad | ||
21 | import Data.ByteString (ByteString) | 13 | import Data.ByteString (ByteString) |
22 | import Control.Monad.Identity | ||
23 | import Data.Text (Text) | 14 | import Data.Text (Text) |
24 | import qualified Data.Text.Lazy as L | 15 | import qualified Data.Text.Lazy as L |
25 | import qualified Data.Text.Lazy.Builder as B | 16 | import qualified Data.Text.Lazy.Builder as B |
@@ -28,48 +19,26 @@ import qualified Text.Blaze.Renderer.Text as BU | |||
28 | import Text.BlazeT | 19 | import Text.BlazeT |
29 | 20 | ||
30 | renderMarkupBuilder :: MarkupM a -> B.Builder | 21 | renderMarkupBuilder :: MarkupM a -> B.Builder |
31 | renderMarkupBuilder = runIdentity . renderMarkupBuilderT | 22 | renderMarkupBuilder = BU.renderMarkupBuilder . execMarkup |
32 | |||
33 | renderMarkupBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
34 | renderMarkupBuilderT = liftM BU.renderMarkupBuilder . execMarkupT | ||
35 | 23 | ||
36 | renderHtmlBuilder :: MarkupM a -> B.Builder | 24 | renderHtmlBuilder :: MarkupM a -> B.Builder |
37 | renderHtmlBuilder = renderMarkupBuilder | 25 | renderHtmlBuilder = renderMarkupBuilder |
38 | 26 | ||
39 | renderHtmlBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
40 | renderHtmlBuilderT = renderMarkupBuilderT | ||
41 | |||
42 | renderMarkup :: MarkupM a -> L.Text | 27 | renderMarkup :: MarkupM a -> L.Text |
43 | renderMarkup = runIdentity . renderMarkupT | 28 | renderMarkup = BU.renderMarkup . execMarkup |
44 | renderMarkupT :: Monad m => MarkupT m a -> m L.Text | ||
45 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
46 | 29 | ||
47 | renderHtml :: MarkupM a -> L.Text | 30 | renderHtml :: MarkupM a -> L.Text |
48 | renderHtml = renderMarkup | 31 | 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 | 32 | ||
55 | renderMarkupWith :: (ByteString -> Text) -> MarkupM a -> L.Text | 33 | renderMarkupWith :: (ByteString -> Text) -> MarkupM a -> L.Text |
56 | renderMarkupWith g = runIdentity . renderMarkupWithT g | 34 | 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 | 35 | ||
61 | renderHtmlWith :: (ByteString -> Text) -> MarkupM a -> L.Text | 36 | renderHtmlWith :: (ByteString -> Text) -> MarkupM a -> L.Text |
62 | renderHtmlWith g = runIdentity . renderHtmlWithT g | 37 | 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 | 38 | ||
39 | renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder | ||
40 | renderMarkupBuilderWith g = (BU.renderMarkupBuilderWith g) . execMarkup | ||
70 | 41 | ||
71 | renderMarkupBuilderWithT :: Monad m => (ByteString -> Text) -> MarkupT m a -> m B.Builder | 42 | renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder |
72 | renderMarkupBuilderWithT g = liftM (BU.renderMarkupBuilderWith g) . execMarkupT | 43 | renderHtmlBuilderWith = renderHtmlBuilderWith |
73 | 44 | ||
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..2874b68 100644 --- a/src/Text/BlazeT/Renderer/Utf8.hs +++ b/src/Text/BlazeT/Renderer/Utf8.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE RankNTypes #-} | ||
1 | {-# OPTIONS_GHC -fsimpl-tick-factor=230 #-} | 2 | {-# OPTIONS_GHC -fsimpl-tick-factor=230 #-} |
2 | 3 | ||
3 | -- the above option was not needed with | 4 | -- the above option was not needed with |
@@ -13,54 +14,28 @@ module Text.BlazeT.Renderer.Utf8 | |||
13 | , renderHtmlBuilder | 14 | , renderHtmlBuilder |
14 | , renderHtml | 15 | , renderHtml |
15 | , renderHtmlToByteStringIO | 16 | , renderHtmlToByteStringIO |
16 | |||
17 | -- * new BlazeT stuff | ||
18 | , renderMarkupBuilderT | ||
19 | , renderMarkupT | ||
20 | , renderMarkupToByteStringIOT | ||
21 | , renderHtmlToByteStringIOT | ||
22 | , renderHtmlBuilderT | ||
23 | , renderHtmlT | ||
24 | ) where | 17 | ) where |
25 | 18 | ||
26 | import qualified Blaze.ByteString.Builder as B | 19 | import qualified Blaze.ByteString.Builder as B |
27 | import Control.Monad | ||
28 | import Control.Monad.Identity | ||
29 | import qualified Data.ByteString as BS | 20 | import qualified Data.ByteString as BS |
30 | import qualified Data.ByteString.Lazy as BL | 21 | import qualified Data.ByteString.Lazy as BL |
31 | import qualified Text.Blaze.Renderer.Utf8 as BU | 22 | import qualified Text.Blaze.Renderer.Utf8 as BU |
32 | import Text.BlazeT | 23 | import Text.BlazeT |
33 | 24 | ||
34 | renderMarkupBuilder :: MarkupM a -> B.Builder | 25 | renderMarkupBuilder :: MarkupM a -> B.Builder |
35 | renderMarkupBuilder = runIdentity . renderMarkupBuilderT | 26 | renderMarkupBuilder = BU.renderMarkupBuilder . execMarkup |
36 | |||
37 | renderMarkupBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
38 | renderMarkupBuilderT = liftM BU.renderMarkupBuilder . execMarkupT | ||
39 | 27 | ||
40 | renderHtmlBuilder :: MarkupM a -> B.Builder | 28 | renderHtmlBuilder :: MarkupM a -> B.Builder |
41 | renderHtmlBuilder = renderMarkupBuilder | 29 | renderHtmlBuilder = renderMarkupBuilder |
42 | 30 | ||
43 | renderHtmlBuilderT :: Monad m => MarkupT m a -> m B.Builder | ||
44 | renderHtmlBuilderT = renderMarkupBuilderT | ||
45 | |||
46 | renderMarkup :: MarkupM a -> BL.ByteString | 31 | renderMarkup :: MarkupM a -> BL.ByteString |
47 | renderMarkup = runIdentity . renderMarkupT | 32 | renderMarkup = BU.renderMarkup . execMarkup |
48 | renderMarkupT :: Monad m => MarkupT m a -> m BL.ByteString | ||
49 | renderMarkupT = liftM BU.renderMarkup . execMarkupT | ||
50 | 33 | ||
51 | renderHtml :: MarkupM a -> BL.ByteString | 34 | renderHtml :: MarkupM a -> BL.ByteString |
52 | renderHtml = renderMarkup | 35 | renderHtml = renderMarkup |
53 | renderHtmlT :: Monad m => MarkupT m a -> m BL.ByteString | ||
54 | renderHtmlT = renderMarkupT | ||
55 | 36 | ||
56 | renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () | 37 | renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () |
57 | renderMarkupToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g | 38 | 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 | 39 | ||
62 | renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () | 40 | renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO () |
63 | renderHtmlToByteStringIO g = runIdentity . renderMarkupToByteStringIOT g | 41 | renderHtmlToByteStringIO = renderMarkupToByteStringIO |
64 | renderHtmlToByteStringIOT :: Monad m => (BS.ByteString -> IO ()) -> | ||
65 | MarkupT m a -> m (IO ()) | ||
66 | renderHtmlToByteStringIOT g = liftM (BU.renderMarkupToByteStringIO g) . execMarkupT | ||