packages feed

Spock-lucid 0.3.0.0 → 0.4.0.0

raw patch · 3 files changed

+13/−24 lines, 3 filesdep −blaze-builderPVP ok

version bump matches the API change (PVP)

Dependencies removed: blaze-builder

API changes (from Hackage documentation)

- Web.Spock.Lucid: lucid :: MonadIO m => Html a -> ActionCtxT cxt m a
+ Web.Spock.Lucid: lucid :: MonadIO m => Html a -> ActionCtxT cxt m b
- Web.Spock.Lucid: lucidIO :: MonadIO m => HtmlT IO a -> ActionCtxT cxt m a
+ Web.Spock.Lucid: lucidIO :: MonadIO m => HtmlT IO a -> ActionCtxT cxt m b
- Web.Spock.Lucid: lucidT :: MonadIO m => HtmlT m a -> ActionCtxT cxt m a
+ Web.Spock.Lucid: lucidT :: MonadIO m => HtmlT m a -> ActionCtxT cxt m b

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.4.0.0++* Generalized all types by not returning the value (since it can't be used anyway).+ # 0.3.0.0  * Added `lucidT`.
Spock-lucid.cabal view
@@ -1,5 +1,5 @@ name:                Spock-lucid-version:             0.3.0.0+version:             0.4.0.0 synopsis:            Lucid support for Spock description:   Lucid support for Spock@@ -26,7 +26,6 @@   -- other-extensions:       build-depends:       Spock >= 0.9                      , base >= 4.7 && < 4.10-                     , blaze-builder                      , lucid == 2.*                      , transformers   ghc-options:         -Wall -fno-warn-unused-do-bind
lib/Web/Spock/Lucid.hs view
@@ -1,8 +1,5 @@-{-# LANGUAGE-CPP,-OverloadedStrings,-RankNTypes-  #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RankNTypes #-}   module Web.Spock.Lucid@@ -19,37 +16,26 @@ import Control.Monad.Trans.Class import Web.Spock import Lucid.Base-import Blaze.ByteString.Builder -#if !MIN_VERSION_base(4,8,0)-import Data.Monoid (mempty)-#endif - -- | Render HTML and send as response body. Content-type will be @text/html@.-lucid :: MonadIO m => Html a -> ActionCtxT cxt m a+lucid :: MonadIO m => Html a -> ActionCtxT cxt m b lucid x = do   setHeader "Content-Type" "text/html; charset=utf-8"-  let Identity (render, a) = runHtmlT x-  lazyBytes (toLazyByteString (render mempty))-  return a+  lazyBytes (renderBS x) {-# INLINE lucid #-}  -- | Like 'lucid', but for @HtmlT IO@.-lucidIO :: MonadIO m => HtmlT IO a -> ActionCtxT cxt m a+lucidIO :: MonadIO m => HtmlT IO a -> ActionCtxT cxt m b lucidIO x = do   setHeader "Content-Type" "text/html; charset=utf-8"-  (render, a) <- liftIO (runHtmlT x)-  lazyBytes (toLazyByteString (render mempty))-  return a+  lazyBytes =<< liftIO (renderBST x) {-# INLINE lucidIO #-}  -- | Like 'lucid', but for arbitrary monads. Might require some additional -- boilerplate.-lucidT :: MonadIO m => HtmlT m a -> ActionCtxT cxt m a+lucidT :: MonadIO m => HtmlT m a -> ActionCtxT cxt m b lucidT x = do   setHeader "Content-Type" "text/html; charset=utf-8"-  (render, a) <- lift (runHtmlT x)-  lazyBytes (toLazyByteString (render mempty))-  return a+  lazyBytes =<< lift (renderBST x) {-# INLINE lucidT #-}