diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -51,14 +51,13 @@ 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 | 54 | [Text.BlazeT](https://hackage.haskell.org/package/blazeT/docs/Text-BlazeT.html) |
55 | `runWith` and `execWith`, which work on any | 55 | exports `runWith` and `execWith`, which work on any |
56 | `Text.Blaze.Renderer.*`. The rendered markup will be returned within | 56 | `Text.BlazeT.Renderer.*`. The rendered markup will be returned within |
57 | the base monad, whose actions can | 57 | the base monad, whose actions can be |
58 | be | 58 | [`lift`ed](https://hackage.haskell.org/package/transformers-0.5.2.0/docs/Control-Monad-Trans-Class.html) |
59 | [`lift`ed](https://hackage.haskell.org/package/transformers-0.5.2.0/docs/Control-Monad-Trans-Class.html) into | 59 | into the Markup, as shown in the following example (from |
60 | the Markup, as shown in the following example | 60 | [here](src/Readme.hs)): |
61 | (from [here](src/Readme.hs)): | ||
62 | 61 | ||
63 | ```Haskell | 62 | ```Haskell |
64 | {-# LANGUAGE OverloadedStrings #-} | 63 | {-# LANGUAGE OverloadedStrings #-} |
@@ -123,8 +122,16 @@ of `Blaze.Markup` and is basically a `WriterT` writing `Blaze.Markup`: | |||
123 | newtype MarkupT m a = MarkupT { fromMarkupT :: WriterT B.Markup m a } | 122 | newtype MarkupT m a = MarkupT { fromMarkupT :: WriterT B.Markup m a } |
124 | ``` | 123 | ``` |
125 | 124 | ||
125 | The old `Text.Blaze.Markup` type is replaced by a rank-2 version of | ||
126 | the transformer: | ||
127 | |||
128 | ```Haskell | ||
129 | type Markup = forall m . Monad m => MarkupT m () | ||
130 | ``` | ||
131 | |||
126 | Wrappers used to lift all `Blaze` entities into `BlazeT` are trivially | 132 | Wrappers used to lift all `Blaze` entities into `BlazeT` are trivially |
127 | expressible using basic `WriterT` class methods. Wrapping `Blaze.Markup` is simply `WriterT.tell`: | 133 | expressible using basic `WriterT` class methods. Wrapping |
134 | `Blaze.Markup` is simply `WriterT.tell`: | ||
128 | 135 | ||
129 | ```Haskell | 136 | ```Haskell |
130 | wrapMarkupT :: Monad m => B.Markup -> MarkupT m () | 137 | wrapMarkupT :: Monad m => B.Markup -> MarkupT m () |
@@ -137,4 +144,3 @@ wrapMarkupT2 :: Monad m => (B.Markup -> B.Markup) -> MarkupT m a -> MarkupT m a | |||
137 | wrapMarkupT2 = censor | 144 | wrapMarkupT2 = censor |
138 | ``` | 145 | ``` |
139 | 146 | ||
140 | |||