blaze-markup 0.8.0.0 → 0.8.1.0
raw patch · 6 files changed
+53/−19 lines, 6 filesdep +tastydep +tasty-hunitdep +tasty-quickcheckdep −test-frameworkdep −test-framework-hunitdep −test-framework-quickcheck2dep ~HUnitdep ~QuickCheckdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: tasty, tasty-hunit, tasty-quickcheck
Dependencies removed: test-framework, test-framework-hunit, test-framework-quickcheck2
Dependency ranges changed: HUnit, QuickCheck, base
API changes (from Hackage documentation)
+ Text.Blaze.Internal: instance Data.Semigroup.Semigroup Text.Blaze.Internal.Attribute
+ Text.Blaze.Internal: instance Data.Semigroup.Semigroup Text.Blaze.Internal.AttributeValue
+ Text.Blaze.Internal: instance Data.Semigroup.Semigroup Text.Blaze.Internal.ChoiceString
- Text.Blaze: class ToMarkup a where preEscapedToMarkup = toMarkup
+ Text.Blaze: class ToMarkup a
- Text.Blaze: class ToValue a where preEscapedToValue = toValue
+ Text.Blaze: class ToValue a
Files
- CHANGELOG +4/−0
- blaze-markup.cabal +13/−7
- src/Text/Blaze/Internal.hs +27/−2
- tests/TestSuite.hs +3/−4
- tests/Text/Blaze/Tests.hs +4/−4
- tests/Text/Blaze/Tests/Util.hs +2/−2
CHANGELOG view
@@ -1,5 +1,9 @@ # Changelog +- 0.8.1.0 (2017-09-16)+ * Compatibility with Semigroup/Monoid proposal+ * Switch to `tasty` for running tests+ - 0.8.0.0 (2017-01-30) * Make `MarkupM` finally adhere to the Monad laws * Stricten the `IsString` instance to only work with `MarkupM ()` and not
blaze-markup.cabal view
@@ -1,5 +1,5 @@ Name: blaze-markup-Version: 0.8.0.0+Version: 0.8.1.0 Homepage: http://jaspervdj.be/blaze Bug-Reports: http://github.com/jaspervdj/blaze-markup/issues License: BSD3@@ -46,16 +46,22 @@ Ghc-options: -Wall Other-modules:+ Text.Blaze+ Text.Blaze.Internal+ Text.Blaze.Renderer.Pretty+ Text.Blaze.Renderer.String+ Text.Blaze.Renderer.Text+ Text.Blaze.Renderer.Utf8 Text.Blaze.Tests Text.Blaze.Tests.Util Build-depends:- HUnit >= 1.2 && < 1.6,- QuickCheck >= 2.4 && < 2.10,- containers >= 0.3 && < 0.6,- test-framework >= 0.4 && < 0.9,- test-framework-hunit >= 0.3 && < 0.4,- test-framework-quickcheck2 >= 0.3 && < 0.4,+ HUnit >= 1.2 && < 1.7,+ QuickCheck >= 2.4 && < 2.11,+ containers >= 0.3 && < 0.6,+ tasty >= 0.11 && < 0.12,+ tasty-hunit >= 0.9 && < 0.10,+ tasty-quickcheck >= 0.8 && < 0.10, -- Copied from regular dependencies... base >= 4 && < 5, blaze-builder >= 0.3 && < 0.5,
src/Text/Blaze/Internal.hs view
@@ -96,7 +96,7 @@ import GHC.Exts (IsString (..)) #if MIN_VERSION_base(4,9,0)-import Data.Semigroup (Semigroup)+import Data.Semigroup (Semigroup(..)) #endif -- | A static string that supports efficient output to all possible backends.@@ -134,11 +134,19 @@ -- | Empty string | EmptyChoiceString +#if MIN_VERSION_base(4,9,0)+instance Semigroup ChoiceString where+ (<>) = AppendChoiceString+ {-# INLINE (<>) #-}+#endif+ instance Monoid ChoiceString where mempty = EmptyChoiceString {-# INLINE mempty #-}+#if !(MIN_VERSION_base(4,11,0)) mappend = AppendChoiceString {-# INLINE mappend #-}+#endif instance IsString ChoiceString where fromString = String@@ -178,13 +186,19 @@ instance Monoid a => Monoid (MarkupM a) where mempty = Empty mempty {-# INLINE mempty #-}+#if !(MIN_VERSION_base(4,11,0)) mappend x y = Append x y {-# INLINE mappend #-} mconcat = foldr Append (Empty mempty) {-# INLINE mconcat #-}+#endif #if MIN_VERSION_base(4,9,0) instance Monoid a => Semigroup (MarkupM a) where+ x <> y = Append x y+ {-# INLINE (<>) #-}+ sconcat = foldr Append (Empty mempty)+ {-# INLINE sconcat #-} #endif instance Functor MarkupM where@@ -242,14 +256,25 @@ -- newtype Attribute = Attribute (forall a. MarkupM a -> MarkupM a) +#if MIN_VERSION_base(4,9,0)+instance Semigroup Attribute where+ Attribute f <> Attribute g = Attribute (g . f)+#endif+ instance Monoid Attribute where mempty = Attribute id+#if !(MIN_VERSION_base(4,11,0)) Attribute f `mappend` Attribute g = Attribute (g . f)+#endif -- | The type for the value part of an attribute. -- newtype AttributeValue = AttributeValue { unAttributeValue :: ChoiceString }- deriving (IsString, Monoid)+ deriving (IsString, Monoid+#if MIN_VERSION_base(4,9,0)+ ,Semigroup+#endif+ ) -- | Create a custom parent element customParent :: Tag -- ^ Element tag
tests/TestSuite.hs view
@@ -2,11 +2,10 @@ -- module Main where -import Test.Framework (defaultMain, testGroup)+import qualified Test.Tasty as Tasty import qualified Text.Blaze.Tests main :: IO ()-main = defaultMain- [ testGroup "Text.Blaze.Tests" Text.Blaze.Tests.tests- ]+main = Tasty.defaultMain $+ Tasty.testGroup "Text.Blaze.Tests" Text.Blaze.Tests.tests
tests/Text/Blaze/Tests.hs view
@@ -14,10 +14,10 @@ import qualified Data.List as List import qualified Prelude as Prelude -import Test.Framework (Test)+import Test.Tasty (TestTree) import Test.HUnit (Assertion, (@=?))-import Test.Framework.Providers.HUnit (testCase)-import Test.Framework.Providers.QuickCheck2 (testProperty)+import Test.Tasty.HUnit (testCase)+import Test.Tasty.QuickCheck (testProperty) import Test.QuickCheck import qualified Data.ByteString as SB import qualified Data.ByteString.Lazy as LB@@ -27,7 +27,7 @@ import Text.Blaze.Internal import Text.Blaze.Tests.Util -tests :: [Test]+tests :: [TestTree] tests = [ testProperty "left identity Monoid law" monoidLeftIdentity , testProperty "right identity Monoid law" monoidRightIdentity , testProperty "associativity Monoid law" monoidAssociativity
tests/Text/Blaze/Tests/Util.hs view
@@ -5,8 +5,8 @@ ( renderUsingString , renderUsingText , renderUsingUtf8- , p, div, table, img, br, area- , id, class_, name+ , p, div, table, img, br, area+ , id, class_, name ) where import Prelude hiding (div, id)