From bec945518cc1c15a3c5b7d19fbbf58713a1eafef Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 5 Feb 2012 19:57:59 -0800 Subject: Fixed Pretty so it uses Data.Monoid's <> w/ GHC 7.4. Note: changed fixity to infixr 6. --- src/Text/Pandoc/Pretty.hs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs index 340afeeed..8c752c1be 100644 --- a/src/Text/Pandoc/Pretty.hs +++ b/src/Text/Pandoc/Pretty.hs @@ -128,9 +128,17 @@ isEmpty = null . toList . unDoc empty :: Doc empty = mempty --- | @a <> b@ is the result of concatenating @a@ with @b@. -(<>) :: Doc -> Doc -> Doc +#if MIN_VERSION_base(4,5,0) +-- (<>) is defined in Data.Monoid +#else +infixr 6 <> + +-- | An infix synonym for 'mappend'. +-- @a <> b@ is the result of concatenating @a@ with @b@. +(<>) :: Monoid m => m -> m -> m (<>) = mappend +{-# INLINE (<>) #-} +#endif -- | Concatenate a list of 'Doc's. cat :: [Doc] -> Doc @@ -142,6 +150,7 @@ hcat = mconcat -- | Concatenate a list of 'Doc's, putting breakable spaces -- between them. +infixr 6 <+> (<+>) :: Doc -> Doc -> Doc (<+>) x y = if isEmpty x then y @@ -154,6 +163,7 @@ hcat = mconcat hsep :: [Doc] -> Doc hsep = foldr (<+>) empty +infixr 5 $$ -- | @a $$ b@ puts @a@ above @b@. ($$) :: Doc -> Doc -> Doc ($$) x y = if isEmpty x @@ -162,6 +172,7 @@ hsep = foldr (<+>) empty then x else x <> cr <> y +infixr 5 $+$ -- | @a $$ b@ puts @a@ above @b@, with a blank line between. ($+$) :: Doc -> Doc -> Doc ($+$) x y = if isEmpty x -- cgit v1.2.3