diff options
-rw-r--r-- | README.md | 75 | ||||
-rw-r--r-- | src/Readme.hs | 23 | ||||
-rw-r--r-- | src/Text/BlazeT.hs | 2 | ||||
-rw-r--r-- | src/Text/BlazeT/Internal.hs | 14 | ||||
-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 |
8 files changed, 118 insertions, 98 deletions
@@ -26,14 +26,14 @@ accumulating log or other diagnostic output | |||
26 | doing `IO` (like database access) are the first things that come to | 26 | doing `IO` (like database access) are the first things that come to |
27 | mind. | 27 | mind. |
28 | 28 | ||
29 | The initial reason of existence of this library is its use | 29 | The reason of existence of this library is its use |
30 | in [Lykah](http://johannesgerer.com/Lykah), which powers my personal | 30 | in [Lykah](http://johannesgerer.com/Lykah), which powers my personal |
31 | website | 31 | website |
32 | [http://johannesgerer.com](http://johannesgerer.com/johannesgerer.com). In | 32 | [http://johannesgerer.com](http://johannesgerer.com/johannesgerer.com). In |
33 | Lykah, the HTML templates have access to the whole site structure (to | 33 | Lykah, the HTML templates have access to the whole site structure (to |
34 | build things like menus) and automatically check, insert and keep | 34 | build things like menus or blog post lists) and automatically check, |
35 | track of referenced pages and assets, which turns out to be very | 35 | insert and keep track of referenced pages and assets, which turns out |
36 | useful for the task of static website generation. | 36 | to be very useful functionality of a static website generator. |
37 | 37 | ||
38 | # How to use it? | 38 | # How to use it? |
39 | 39 | ||
@@ -51,20 +51,73 @@ their [documentation](https://jaspervdj.be/blaze/). | |||
51 | 51 | ||
52 | ## Unleash the monads | 52 | ## Unleash the monads |
53 | 53 | ||
54 | [Text.BlazeT](https://hackage.haskell.org/package/blazeT/docs/Text-BlazeT.html) exports | ||
55 | `runWith` and `execWith`, which work on any | ||
56 | `Text.Blaze.Renderer.*`. The rendered markup will be returned within | ||
57 | the base monad, whose actions can | ||
58 | be | ||
59 | [`lift`ed](https://hackage.haskell.org/package/transformers-0.5.2.0/docs/Control-Monad-Trans-Class.html) into | ||
60 | the Markup, as shown in the following example | ||
61 | (from [here](src/Readme.hs)): | ||
54 | 62 | ||
63 | ```Haskell | ||
64 | {-# LANGUAGE OverloadedStrings #-} | ||
65 | |||
66 | import Data.Time (getCurrentTime) | ||
67 | import Text.BlazeT.Html5 hiding (main) | ||
68 | import Text.BlazeT.Renderer.String | ||
69 | import Control.Monad.Trans.Class (lift) | ||
70 | |||
71 | -- Backwords compatible Blaze HTML | ||
72 | old :: Markup | ||
73 | old = do | ||
74 | p $ "created with blaze-html" | ||
75 | |||
76 | -- BlazeT HTML with lifted IO actions | ||
77 | new :: MarkupT IO () | ||
78 | new = do | ||
79 | time <- lift getCurrentTime | ||
80 | p $ string $ "created with blazeT at " ++ show time | ||
81 | |||
82 | main :: IO () | ||
83 | main = do | ||
84 | putStrLn $ renderMarkup old | ||
85 | putStrLn =<< execWith renderMarkup new | ||
86 | |||
87 | ``` | ||
88 | |||
89 | prints: | ||
90 | |||
91 | ```HTML | ||
92 | <p>created with blaze-html</p> | ||
93 | <p>created with blazeT at 2016-10-26 01:09:16.969147361 UTC</p> | ||
94 | ``` | ||
95 | |||
96 | # Installation | ||
97 | |||
98 | 1. To make it available on your system (or sandbox) use `cabal install blazeT`. | ||
99 | |||
100 | 2. To play around with the source, obtain by cloning this repo or use | ||
101 | `cabal get blazet`, enter the directory and run: | ||
102 | |||
103 | ```bash | ||
104 | cabal sandbox init #optional | ||
105 | cabal install | ||
106 | ``` | ||
107 | |||
108 | # Documentation on [Hackage](https://hackage.haskell.org/package/blazeT) | ||
55 | 109 | ||
56 | # Implementation | 110 | # Implementation |
57 | 111 | ||
58 | ... is located | 112 | ... is contained |
59 | in | 113 | in |
60 | [Text.BlazeT.Internals](https://hackage.haskell.org/package/blazeT/docs/Text-BlazeT-Internals.html). | 114 | [Text.BlazeT.Internals](https://hackage.haskell.org/package/blazeT/docs/Text-BlazeT-Internals.html). |
61 | 115 | ||
62 | Everything build around the simple `newtype` definition of the | 116 | Everything is build around the simple `newtype` definition of the |
63 | `MarkupT` transformer, which makes use of the fact that `Blaze.Markup` | 117 | `MarkupT` transformer, which makes use |
64 | is | 118 | the |
65 | a | 119 | [Monoid](https://hackage.haskell.org/package/base-4.7.0.2/docs/Data-Monoid.html) instance |
66 | [Monoid](https://hackage.haskell.org/package/base-4.7.0.2/docs/Data-Monoid.html) and | 120 | of `Blaze.Markup` and is basically a `WriterT` writing `Blaze.Markup`: |
67 | which is basically a `WriterT` transformer writing `Blaze.Markup`: | ||
68 | 121 | ||
69 | ```Haskell | 122 | ```Haskell |
70 | newtype MarkupT m a = MarkupT { fromMarkupT :: WriterT B.Markup m a } | 123 | newtype MarkupT m a = MarkupT { fromMarkupT :: WriterT B.Markup m a } |
diff --git a/src/Readme.hs b/src/Readme.hs new file mode 100644 index 0000000..3ccabad --- /dev/null +++ b/src/Readme.hs | |||
@@ -0,0 +1,23 @@ | |||
1 | {-# LANGUAGE OverloadedStrings #-} | ||
2 | |||
3 | import Data.Time (getCurrentTime) | ||
4 | import Text.BlazeT.Html5 hiding (main) | ||
5 | import Text.BlazeT.Renderer.String | ||
6 | import Control.Monad.Trans.Class (lift) | ||
7 | |||
8 | -- Backwords compatible Blaze HTML | ||
9 | old :: Markup | ||
10 | old = do | ||
11 | p $ "created with blaze-html" | ||
12 | |||
13 | -- BlazeT HTML with lifted IO actions | ||
14 | new :: MarkupT IO () | ||
15 | new = do | ||
16 | time <- lift getCurrentTime | ||
17 | p $ string $ "created with blazeT at " ++ show time | ||
18 | |||
19 | main :: IO () | ||
20 | main = do | ||
21 | putStrLn $ renderMarkup old | ||
22 | putStrLn =<< execWith renderMarkup new | ||
23 | |||
diff --git a/src/Text/BlazeT.hs b/src/Text/BlazeT.hs index 27228fa..b3e7c8d 100644 --- a/src/Text/BlazeT.hs +++ b/src/Text/BlazeT.hs | |||
@@ -62,6 +62,8 @@ module Text.BlazeT | |||
62 | ,runMarkupT | 62 | ,runMarkupT |
63 | ,execMarkup | 63 | ,execMarkup |
64 | ,execMarkupT | 64 | ,execMarkupT |
65 | ,runWith | ||
66 | ,execWith | ||
65 | ) where | 67 | ) where |
66 | 68 | ||
67 | import qualified Text.Blaze as B | 69 | import qualified Text.Blaze as B |
diff --git a/src/Text/BlazeT/Internal.hs b/src/Text/BlazeT/Internal.hs index 24ef1fe..f0c3edb 100644 --- a/src/Text/BlazeT/Internal.hs +++ b/src/Text/BlazeT/Internal.hs | |||
@@ -83,8 +83,11 @@ module Text.BlazeT.Internal | |||
83 | ,wrapMarkupT | 83 | ,wrapMarkupT |
84 | ,wrapMarkup2 | 84 | ,wrapMarkup2 |
85 | ,wrapMarkupT2 | 85 | ,wrapMarkupT2 |
86 | ,runWith | ||
87 | ,execWith | ||
86 | ) where | 88 | ) where |
87 | 89 | ||
90 | import Control.Arrow | ||
88 | import Control.Monad.Identity | 91 | import Control.Monad.Identity |
89 | import Control.Monad.Trans.Class | 92 | import Control.Monad.Trans.Class |
90 | import Control.Monad.Writer.Strict | 93 | import Control.Monad.Writer.Strict |
@@ -121,10 +124,21 @@ runMarkupT :: MarkupT m a -> m (a,B.Markup) | |||
121 | runMarkupT = runWriterT . fromMarkupT | 124 | runMarkupT = runWriterT . fromMarkupT |
122 | {-# INLINE runMarkupT #-} | 125 | {-# INLINE runMarkupT #-} |
123 | 126 | ||
127 | -- | run the MarkupT and return a pair consisting of the result of the | ||
128 | -- computation and the blaze markup rendered with a blaze renderer | ||
129 | -- like 'Text.Blaze.Renderer.Text.renderHtml' | ||
130 | runWith :: Monad m => (MarkupM () -> c) -> MarkupT m a -> m (a, c) | ||
131 | runWith renderer = liftM (second $ renderer . wrapMarkup) . runMarkupT | ||
132 | {-# INLINE runWith #-} | ||
133 | |||
124 | execMarkupT :: Monad m => MarkupT m a -> m B.Markup | 134 | execMarkupT :: Monad m => MarkupT m a -> m B.Markup |
125 | execMarkupT = liftM snd . runMarkupT | 135 | execMarkupT = liftM snd . runMarkupT |
126 | {-# INLINE execMarkupT #-} | 136 | {-# INLINE execMarkupT #-} |
127 | 137 | ||
138 | execWith :: Monad m => (MarkupM () -> c) -> MarkupT m a -> m c | ||
139 | execWith renderer = liftM snd . runWith renderer | ||
140 | {-# INLINE execWith #-} | ||
141 | |||
128 | runMarkup :: MarkupM a -> (a,B.Markup) | 142 | runMarkup :: MarkupM a -> (a,B.Markup) |
129 | runMarkup = runIdentity . runMarkupT | 143 | runMarkup = runIdentity . runMarkupT |
130 | {-# INLINE runMarkup #-} | 144 | {-# INLINE runMarkup #-} |
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 | ||