From d6cb5a4f979148f2a23af16cf4af1d7ed6f76018 Mon Sep 17 00:00:00 2001 From: Michael Hatfield Date: Sat, 30 May 2015 12:58:59 -0700 Subject: [PATCH] Added instance Attributable Attribute for more syntactic sugar --- src/Text/Blaze/Internal.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Text/Blaze/Internal.hs b/src/Text/Blaze/Internal.hs index 3ce7783..1b8c6f4 100644 --- a/src/Text/Blaze/Internal.hs +++ b/src/Text/Blaze/Internal.hs @@ -167,6 +167,7 @@ data MarkupM a | Empty deriving (Typeable) + -- | Simplification of the 'MarkupM' datatype. -- type Markup = MarkupM () @@ -523,6 +524,9 @@ instance Attributable (MarkupM a -> MarkupM b) where h ! f = (! f) . h {-# INLINE (!) #-} +instance Attributable Attribute where + (Attribute h) ! f = Attribute $ (! f) . h + -- | Shorthand for setting an attribute depending on a conditional. -- -- Example: @@ -603,3 +607,4 @@ null markup = case markup of EmptyChoiceString -> True emptyStaticString = B.null . getUtf8ByteString +