This is a paragraph
" -- [TagOpen "p" [],TagText "This is a paragraph",TagClose "p"] -- >>> filter (tagText (const True)) tags -- [TagText "This is a paragraph"] tagText :: (str -> Bool) -> Tag str -> Bool tagText p (TagText text) = p text tagText _ _ = False -- | Match comment tags -- -- ==== __Examples__ -- -- /Matching comment tags that include an exclamation mark:/ -- -- >>> let tags = parseTags "" -- [TagComment "This is a comment!"] -- >>> all (tagComment (\s -> '!' `elem` s)) tags -- True tagComment :: (str -> Bool) -> Tag str -> Bool tagComment p (TagComment text) = p text tagComment _ _ = False -- | Match an opening tag's name literally -- -- ==== __Examples__ -- -- /Matching @\@ tags with the @id@ "foo":/ -- -- >>> let tag = TagOpen "a" [("id", "foo")] -- TagOpen "a" [("id","foo")] -- >>> tagOpenLit "a" (\attrs -> any (== ("id", "foo")) attrs) tag -- True -- tagOpenLit :: Eq str => str -> ([Attribute str] -> Bool) -> Tag str -> Bool tagOpenLit name = tagOpen (name==) -- | Match a closing tag's name literally -- -- ==== __Examples__ -- -- /Match a closing @\@ tag:/ -- -- >>> tagCloseLit "a" (TagClose "a") -- True -- -- >>> tagCloseLit "a" (TagClose "em") -- False tagCloseLit :: Eq str => str -> Tag str -> Bool tagCloseLit name = tagClose (name==) -- | Match an opening tag's name literally, and at least one of its attributes -- -- ==== __Examples__ -- -- /Matching a @\