# blazeT [![Build Status](https://travis-ci.org/johannesgerer/blazeT.svg?branch=master)](https://travis-ci.org/johannesgerer/blazeT) A true monad (transformer) version of the [blaze-markup](https://hackage.haskell.org/package/blaze-markup) and [blaze-html](https://hackage.haskell.org/package/blaze-html) libraries. # Why? While blaze's `Markup` and `Html` types have `Monad` instances and are able to use the concise `do` notation. # How? ## Backwards compatible The library is intended to serve as a drop-in replacement for the blaze-markup and blaze-html libraries and should be backwards compatible: Simply replace your `module Text.Blaze.*` imports with `module Text.BlazeT.*` and it should give the same results. For usage of blaze check out their [documentation](https://jaspervdj.be/blaze/). ## Unleash the monads # Implementation Details (from [Text.BlazeT.Internals](https://hackage.haskell.org/package/blazeT/docs/Text-BlazeT-Internals.html)) Everything build around the simple `newtype` definition of the `MarkupT` transformer, which is basically a `WriterT` transformer writing `Blaze.Markup`: ```Haskell newtype MarkupT m a= MarkupT { fromMarkupT :: WriterT B.Markup m a } ``` Wrappers used to lift all `Blaze` entities into `BlazeT` are trivially expressible using basic `WriterT` class methods: ```Haskell -- | Wrapping `Blaze.Markup` is simply `WriterT.tell` wrapMarkupT :: Monad m => B.Markup -> MarkupT m () wrapMarkupT = tell -- | Wrapping functions that modify `Blaze.Markup` is simply `WriterT.censor` wrapMarkupT2 :: Monad m => (B.Markup -> B.Markup) -> MarkupT m a -> MarkupT m a wrapMarkupT2 = censor ```