blazeT 0.0.1 → 0.0.2
raw patch · 6 files changed
+42/−42 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.BlazeT: execWith :: Monad m => (Markup -> c) -> MarkupT m a -> m c
+ Text.BlazeT: execWith :: Monad m => (MarkupI () -> c) -> MarkupT m a -> m c
- Text.BlazeT: runWith :: Monad m => (Markup -> c) -> MarkupT m a -> m (a, c)
+ Text.BlazeT: runWith :: Monad m => (MarkupI () -> c) -> MarkupT m a -> m (a, c)
- Text.BlazeT.Internal: execWith :: Monad m => (Markup -> c) -> MarkupT m a -> m c
+ Text.BlazeT.Internal: execWith :: Monad m => (MarkupI () -> c) -> MarkupT m a -> m c
- Text.BlazeT.Internal: runWith :: Monad m => (Markup -> c) -> MarkupT m a -> m (a, c)
+ Text.BlazeT.Internal: runWith :: Monad m => (MarkupI () -> c) -> MarkupT m a -> m (a, c)
- Text.BlazeT.Renderer.Pretty: renderHtml :: MarkupM a -> String
+ Text.BlazeT.Renderer.Pretty: renderHtml :: MarkupI a -> String
- Text.BlazeT.Renderer.Pretty: renderMarkup :: MarkupM a -> String
+ Text.BlazeT.Renderer.Pretty: renderMarkup :: MarkupI a -> String
- Text.BlazeT.Renderer.String: renderHtml :: MarkupM a -> String
+ Text.BlazeT.Renderer.String: renderHtml :: MarkupI a -> String
- Text.BlazeT.Renderer.String: renderMarkup :: MarkupM a -> String
+ Text.BlazeT.Renderer.String: renderMarkup :: MarkupI a -> String
- Text.BlazeT.Renderer.Text: renderHtml :: MarkupM a -> Text
+ Text.BlazeT.Renderer.Text: renderHtml :: MarkupI a -> Text
- Text.BlazeT.Renderer.Text: renderHtmlBuilder :: MarkupM a -> Builder
+ Text.BlazeT.Renderer.Text: renderHtmlBuilder :: MarkupI a -> Builder
- Text.BlazeT.Renderer.Text: renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupM a -> Builder
+ Text.BlazeT.Renderer.Text: renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupI a -> Builder
- Text.BlazeT.Renderer.Text: renderHtmlWith :: (ByteString -> Text) -> MarkupM a -> Text
+ Text.BlazeT.Renderer.Text: renderHtmlWith :: (ByteString -> Text) -> MarkupI a -> Text
- Text.BlazeT.Renderer.Text: renderMarkup :: MarkupM a -> Text
+ Text.BlazeT.Renderer.Text: renderMarkup :: MarkupI a -> Text
- Text.BlazeT.Renderer.Text: renderMarkupBuilder :: MarkupM a -> Builder
+ Text.BlazeT.Renderer.Text: renderMarkupBuilder :: MarkupI a -> Builder
- Text.BlazeT.Renderer.Text: renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupM a -> Builder
+ Text.BlazeT.Renderer.Text: renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupI a -> Builder
- Text.BlazeT.Renderer.Text: renderMarkupWith :: (ByteString -> Text) -> MarkupM a -> Text
+ Text.BlazeT.Renderer.Text: renderMarkupWith :: (ByteString -> Text) -> MarkupI a -> Text
- Text.BlazeT.Renderer.Utf8: renderHtml :: MarkupM a -> ByteString
+ Text.BlazeT.Renderer.Utf8: renderHtml :: MarkupI a -> ByteString
- Text.BlazeT.Renderer.Utf8: renderHtmlBuilder :: MarkupM a -> Builder
+ Text.BlazeT.Renderer.Utf8: renderHtmlBuilder :: MarkupI a -> Builder
- Text.BlazeT.Renderer.Utf8: renderHtmlToByteStringIO :: (ByteString -> IO ()) -> MarkupM a -> IO ()
+ Text.BlazeT.Renderer.Utf8: renderHtmlToByteStringIO :: (ByteString -> IO ()) -> MarkupI a -> IO ()
- Text.BlazeT.Renderer.Utf8: renderMarkup :: MarkupM a -> ByteString
+ Text.BlazeT.Renderer.Utf8: renderMarkup :: MarkupI a -> ByteString
- Text.BlazeT.Renderer.Utf8: renderMarkupBuilder :: MarkupM a -> Builder
+ Text.BlazeT.Renderer.Utf8: renderMarkupBuilder :: MarkupI a -> Builder
- Text.BlazeT.Renderer.Utf8: renderMarkupToByteStringIO :: (ByteString -> IO ()) -> MarkupM a -> IO ()
+ Text.BlazeT.Renderer.Utf8: renderMarkupToByteStringIO :: (ByteString -> IO ()) -> MarkupI a -> IO ()
Files
- blazeT.cabal +1/−1
- src/Text/BlazeT/Internal.hs +23/−23
- src/Text/BlazeT/Renderer/Pretty.hs +2/−2
- src/Text/BlazeT/Renderer/String.hs +2/−2
- src/Text/BlazeT/Renderer/Text.hs +8/−8
- src/Text/BlazeT/Renderer/Utf8.hs +6/−6
blazeT.cabal view
@@ -1,5 +1,5 @@ Name: blazeT-Version: 0.0.1+Version: 0.0.2 Homepage: Bug-Reports: http://github.com/johannesgerer/blazeT/issues License: MIT
src/Text/BlazeT/Internal.hs view
@@ -146,15 +146,15 @@ -- | run the MarkupT and return a pair consisting of the result of the -- computation and the blaze markup rendered with a blaze renderer -- like 'Text.BlazeT.Renderer.Text.renderHtml'-runWith :: Monad m => (Markup -> c) -> MarkupT m a -> m (a, c)-runWith renderer = liftM (second $ \x -> renderer $ wrapMarkup x) . runMarkupT +runWith :: Monad m => (MarkupI () -> c) -> MarkupT m a -> m (a, c)+runWith renderer = liftM (second $ renderer . wrapMarkup) . runMarkupT {-# INLINE runWith #-} execMarkupT :: Monad m => MarkupT m a -> m Text.Blaze.Markup execMarkupT = liftM snd . runMarkupT {-# INLINE execMarkupT #-} -execWith :: Monad m => (Markup -> c) -> MarkupT m a -> m c+execWith :: Monad m => (MarkupI () -> c) -> MarkupT m a -> m c execWith renderer = liftM snd . runWith renderer {-# INLINE execWith #-} @@ -166,26 +166,6 @@ execMarkup = snd . runMarkup {-# INLINE execMarkup #-} --instance (Monad m,Monoid a) => Monoid (MarkupT m a) where- mempty = return mempty- {-# INLINE mempty #-}- a `mappend` b = do {a' <- a; b >>= return . (mappend a')}- {-# INLINE mappend #-}---instance Monad m => Text.Blaze.Attributable (MarkupT m a) where- h ! a = wrapMarkupT2 (Text.Blaze.! a) h- {-# INLINE (!) #-}--instance Monad m => Text.Blaze.Attributable (a -> MarkupT m b) where- h ! a = \x -> wrapMarkupT2 (Text.Blaze.! a) $ h x- {-# INLINE (!) #-}--instance Monad m => IsString (MarkupT m ()) where- fromString = wrapMarkup . fromString- {-# INLINE fromString #-}- -- | Wrapper for 'Text.Blaze.Markup' is simply -- 'tell' wrapMarkupT :: Monad m => Text.Blaze.Markup -> MarkupT m ()@@ -207,6 +187,26 @@ wrapMarkup2 :: (Text.Blaze.Markup -> Text.Blaze.Markup) -> Markup2 wrapMarkup2 = wrapMarkupT2 {-# INLINE wrapMarkup2 #-}+++instance (Monad m,Monoid a) => Monoid (MarkupT m a) where+ mempty = return mempty+ {-# INLINE mempty #-}+ a `mappend` b = do {a' <- a; b >>= return . (mappend a')}+ {-# INLINE mappend #-}+++instance Monad m => Text.Blaze.Attributable (MarkupT m a) where+ h ! a = wrapMarkupT2 (Text.Blaze.! a) h+ {-# INLINE (!) #-}++instance Monad m => Text.Blaze.Attributable (a -> MarkupT m b) where+ h ! a = \x -> wrapMarkupT2 (Text.Blaze.! a) $ h x+ {-# INLINE (!) #-}++instance Monad m => IsString (MarkupT m ()) where+ fromString = wrapMarkup . fromString+ {-# INLINE fromString #-} unsafeByteString :: BS.ByteString -> Markup unsafeByteString = wrapMarkup . Text.Blaze.unsafeByteString
src/Text/BlazeT/Renderer/Pretty.hs view
@@ -7,9 +7,9 @@ import qualified Text.Blaze.Renderer.Pretty as BU import Text.BlazeT -renderMarkup :: MarkupM a -> String+renderMarkup :: MarkupI a -> String renderMarkup = BU.renderMarkup . execMarkup -renderHtml :: MarkupM a -> String+renderHtml :: MarkupI a -> String renderHtml = renderMarkup
src/Text/BlazeT/Renderer/String.hs view
@@ -12,9 +12,9 @@ fromChoiceString :: ChoiceString -> String -> String fromChoiceString = BU.fromChoiceString -renderMarkup :: MarkupM a -> String+renderMarkup :: MarkupI a -> String renderMarkup = BU.renderMarkup . execMarkup -renderHtml :: MarkupM a -> String+renderHtml :: MarkupI a -> String renderHtml = renderMarkup
src/Text/BlazeT/Renderer/Text.hs view
@@ -18,27 +18,27 @@ import qualified Text.Blaze.Renderer.Text as BU import Text.BlazeT -renderMarkupBuilder :: MarkupM a -> B.Builder+renderMarkupBuilder :: MarkupI a -> B.Builder renderMarkupBuilder = BU.renderMarkupBuilder . execMarkup -renderHtmlBuilder :: MarkupM a -> B.Builder+renderHtmlBuilder :: MarkupI a -> B.Builder renderHtmlBuilder = renderMarkupBuilder -renderMarkup :: MarkupM a -> L.Text+renderMarkup :: MarkupI a -> L.Text renderMarkup = BU.renderMarkup . execMarkup -renderHtml :: MarkupM a -> L.Text+renderHtml :: MarkupI a -> L.Text renderHtml = renderMarkup -renderMarkupWith :: (ByteString -> Text) -> MarkupM a -> L.Text+renderMarkupWith :: (ByteString -> Text) -> MarkupI a -> L.Text renderMarkupWith g = (BH.renderHtmlWith g) . execMarkup -renderHtmlWith :: (ByteString -> Text) -> MarkupM a -> L.Text+renderHtmlWith :: (ByteString -> Text) -> MarkupI a -> L.Text renderHtmlWith = renderMarkupWith -renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder+renderMarkupBuilderWith :: (ByteString -> Text) -> MarkupI a -> B.Builder renderMarkupBuilderWith g = (BU.renderMarkupBuilderWith g) . execMarkup -renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupM a -> B.Builder+renderHtmlBuilderWith :: (ByteString -> Text) -> MarkupI a -> B.Builder renderHtmlBuilderWith = renderHtmlBuilderWith
src/Text/BlazeT/Renderer/Utf8.hs view
@@ -22,20 +22,20 @@ import qualified Text.Blaze.Renderer.Utf8 as BU import Text.BlazeT -renderMarkupBuilder :: MarkupM a -> B.Builder+renderMarkupBuilder :: MarkupI a -> B.Builder renderMarkupBuilder = BU.renderMarkupBuilder . execMarkup -renderHtmlBuilder :: MarkupM a -> B.Builder+renderHtmlBuilder :: MarkupI a -> B.Builder renderHtmlBuilder = renderMarkupBuilder -renderMarkup :: MarkupM a -> BL.ByteString+renderMarkup :: MarkupI a -> BL.ByteString renderMarkup = BU.renderMarkup . execMarkup -renderHtml :: MarkupM a -> BL.ByteString+renderHtml :: MarkupI a -> BL.ByteString renderHtml = renderMarkup -renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO ()+renderMarkupToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupI a -> IO () renderMarkupToByteStringIO g = BU.renderMarkupToByteStringIO g . execMarkup -renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupM a -> IO ()+renderHtmlToByteStringIO :: (BS.ByteString -> IO ()) -> MarkupI a -> IO () renderHtmlToByteStringIO = renderMarkupToByteStringIO