Skip to content

Commit

Permalink
Added instance Attributable Attribute for more syntactic sugar
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehat committed May 30, 2015
1 parent 67da6e7 commit d6cb5a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Text/Blaze/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ data MarkupM a
| Empty
deriving (Typeable)


-- | Simplification of the 'MarkupM' datatype.
--
type Markup = MarkupM ()
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -603,3 +607,4 @@ null markup = case markup of
EmptyChoiceString -> True

emptyStaticString = B.null . getUtf8ByteString

0 comments on commit d6cb5a4

Please sign in to comment.