packages feed

lucid 2.9.4 → 2.9.5

raw patch · 3 files changed

+42/−4 lines, 3 filesdep +mmorphPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies added: mmorph

API changes (from Hackage documentation)

- Lucid.Base: instance (m ~ Data.Functor.Identity.Identity) => GHC.Show.Show (Lucid.Base.HtmlT m a)
+ Lucid.Base: instance Control.Monad.Morph.MFunctor Lucid.Base.HtmlT
+ Lucid.Base: instance Lucid.Base.ToHtml Data.ByteString.Internal.ByteString
+ Lucid.Base: instance Lucid.Base.ToHtml Data.ByteString.Lazy.Internal.ByteString
+ Lucid.Base: instance m ~ Data.Functor.Identity.Identity => GHC.Show.Show (Lucid.Base.HtmlT m a)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## 2.9.5++* Add ToHtml instance for ByteString (both)+ ## 2.9.1  * Small performance tweaks.
lucid.cabal view
@@ -1,5 +1,5 @@ name:                lucid-version:             2.9.4+version:             2.9.5 synopsis:            Clear to write, read and edit DSL for HTML description:         Clear to write, read and edit DSL for HTML. See the 'Lucid' module                      for description and documentation.@@ -13,6 +13,7 @@ build-type:          Simple cabal-version:       >=1.8 extra-source-files:  README.md, CHANGELOG.md+tested-with:         GHC==7.4.2,GHC==7.6.3,GHC==7.8.4,GHC==7.10.2  library   hs-source-dirs:    src/@@ -26,6 +27,7 @@                    , bytestring                    , containers                    , hashable+                   , mmorph                    , mtl                    , text                    , transformers
src/Lucid/Base.hs view
@@ -1,7 +1,9 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE DeriveDataTypeable #-}  -- | Base types and combinators. @@ -23,7 +25,7 @@   ,makeAttribute    -- * Types   ,Html-  ,HtmlT(..)+  ,HtmlT(HtmlT)   ,Attribute(..)    -- * Classes   ,Term(..)@@ -37,25 +39,30 @@ import qualified Blaze.ByteString.Builder.Html.Utf8 as Blaze import           Control.Applicative import           Control.Monad+import           Control.Monad.Morph import           Control.Monad.Reader import           Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as L+import qualified Data.ByteString as S import           Data.Functor.Identity-import           Data.Hashable (Hashable(..)) import           Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as M+import           Data.Hashable (Hashable(..)) import           Data.Monoid import           Data.String import           Data.Text (Text) import qualified Data.Text.Lazy as LT import qualified Data.Text.Lazy.Encoding as LT+import qualified Data.Text.Encoding as T+import           Data.Typeable (Typeable)+import           Prelude  -------------------------------------------------------------------------------- -- Types  -- | A simple attribute. Don't use the constructor, use 'makeAttribute'. data Attribute = Attribute !Text !Text-  deriving (Show,Eq)+  deriving (Show,Eq,Typeable)  instance Hashable Attribute where   hashWithSalt salt (Attribute a b) = salt `hashWithSalt` a `hashWithSalt` b@@ -76,7 +83,18 @@          -- pass 'mempty' for this argument for a top-level call. See          -- 'evalHtmlT' and 'execHtmlT' for easier to use functions.          }+-- GHC 7.4 errors with+--  Can't make a derived instance of `Typeable (HtmlT m a)':+--    `HtmlT' must only have arguments of kind `*'+-- GHC 7.6 errors with+--    `HtmlT' must only have arguments of kind `*'+#if  __GLASGOW_HASKELL__ >= 707+  deriving (Typeable)+#endif +instance MFunctor HtmlT where+  hoist f (HtmlT xs) = HtmlT (f xs)+ -- | Monoid is right-associative, a la the 'Builder' in it. instance (a ~ (),Monad m) => Monoid (HtmlT m a) where   mempty  = return mempty@@ -134,6 +152,20 @@ instance ToHtml LT.Text where   toHtml    = build . Blaze.fromHtmlEscapedLazyText   toHtmlRaw = build . Blaze.fromLazyText++-- | This instance requires the ByteString to contain UTF-8 encoded+-- text, for the 'toHtml' method. The 'toHtmlRaw' method doesn't care,+-- but the overall HTML rendering methods in this module assume UTF-8.+instance ToHtml S.ByteString where+  toHtml    = build . Blaze.fromHtmlEscapedText . T.decodeUtf8+  toHtmlRaw = build . Blaze.fromByteString++-- | This instance requires the ByteString to contain UTF-8 encoded+-- text, for the 'toHtml' method. The 'toHtmlRaw' method doesn't care,+-- but the overall HTML rendering methods in this module assume UTF-8.+instance ToHtml L.ByteString where+  toHtml    = build . Blaze.fromHtmlEscapedLazyText . LT.decodeUtf8+  toHtmlRaw = build . Blaze.fromLazyByteString  -- | Create an 'HtmlT' directly from a 'Builder'. build :: Monad m => Builder -> HtmlT m ()