blaze-markup 0.6.1.1 → 0.6.2.0
raw patch · 4 files changed
+23/−2 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Text.Blaze.Internal: instance Applicative MarkupM
Files
- CHANGELOG +3/−0
- blaze-markup.cabal +1/−1
- src/Text/Blaze/Internal.hs +11/−0
- tests/Text/Blaze/Tests.hs +8/−1
CHANGELOG view
@@ -1,3 +1,6 @@+- 0.6.2.0+ * Add `Applicative` instance for `MarkupM`+ - 0.6.1.1 * Bump `text` dependency to allow 1.2
blaze-markup.cabal view
@@ -1,5 +1,5 @@ Name: blaze-markup-Version: 0.6.1.1+Version: 0.6.2.0 Homepage: http://jaspervdj.be/blaze Bug-Reports: http://github.com/jaspervdj/blaze-markup/issues License: BSD3
src/Text/Blaze/Internal.hs view
@@ -64,6 +64,7 @@ ) where import Prelude hiding (null)+import Control.Applicative (Applicative (..)) import Data.Monoid (Monoid, mappend, mempty, mconcat) import Unsafe.Coerce (unsafeCoerce) import qualified Data.List as List@@ -162,6 +163,16 @@ instance Functor MarkupM where -- Safe because it does not contain a value anyway fmap _ = unsafeCoerce++instance Applicative MarkupM where+ pure _ = Empty+ {-# INLINE pure #-}+ (<*>) = Append+ {-# INLINE (<*>) #-}+ (*>) = Append+ {-# INLINE (*>) #-}+ (<*) = Append+ {-# INLINE (<*) #-} instance Monad MarkupM where return _ = Empty
tests/Text/Blaze/Tests.hs view
@@ -8,10 +8,11 @@ import Prelude hiding (div, id, null) import Data.Monoid (mempty, mappend) import Control.Monad (replicateM)-import Control.Applicative ((<$>))+import Control.Applicative (Applicative (..), (<$>)) import Data.Word (Word8) import Data.Char (ord) import qualified Data.List as List+import qualified Prelude as Prelude import Test.Framework (Test) import Test.HUnit (Assertion, (@=?))@@ -30,6 +31,7 @@ , testProperty "right identity Monoid law" monoidRightIdentity , testProperty "associativity Monoid law" monoidAssociativity , testProperty "mconcat Monoid law" monoidConcat+ , testProperty "identity Applicative law" applicativeIdentity , testProperty "post escaping characters" postEscapingCharacters , testProperty "valid UTF-8" isValidUtf8 , testProperty "external </ sequence" externalEndSequence@@ -61,6 +63,11 @@ -- monoidConcat :: [Markup] -> Bool monoidConcat xs = sequence_ xs == foldr (>>) (return ()) xs++-- | Applicative identity law.+--+applicativeIdentity :: Markup -> Bool+applicativeIdentity x = (pure Prelude.id <*> x) == x -- | Escaped content cannot contain certain characters. --