git.iko.soy/typeable/pandoc
on master help sign in
Fixed Pretty so it uses Data.Monoid's <> w/ GHC 7.4.

Note: changed fixity to infixr 6.

commitbec945518cc1c15a3c5b7d19fbbf58713a1eafef authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 5 Feb 2012, 19:57 (15 years ago) parent8575243
1 file changed+13−2
src/Text/Pandoc/Pretty.hs+13−2
src/Text/Pandoc/Pretty.hs+13−2
@@ -128,9 +128,17 @@ isEmpty = null . toList . unDoc
128128empty :: Doc
129129empty = mempty
130130
131−-- | @a <> b@ is the result of concatenating @a@ with @b@.
132−(<>) :: Doc -> Doc -> Doc
131+#if MIN_VERSION_base(4,5,0)
132+-- (<>) is defined in Data.Monoid
133+#else
134+infixr 6 <>
135+
136+-- | An infix synonym for 'mappend'.
137+-- @a <> b@ is the result of concatenating @a@ with @b@.
138+(<>) :: Monoid m => m -> m -> m
133139(<>) = mappend
140+{-# INLINE (<>) #-}
141+#endif
134142
135143-- | Concatenate a list of 'Doc's.
136144cat :: [Doc] -> Doc
@@ -142,6 +150,7 @@ hcat = mconcat
142150
143151-- | Concatenate a list of 'Doc's, putting breakable spaces
144152-- between them.
153+infixr 6 <+>
145154(<+>) :: Doc -> Doc -> Doc
146155(<+>) x y = if isEmpty x
147156 then y
@@ -154,6 +163,7 @@ hcat = mconcat
154163hsep :: [Doc] -> Doc
155164hsep = foldr (<+>) empty
156165
166+infixr 5 $$
157167-- | @a $$ b@ puts @a@ above @b@.
158168($$) :: Doc -> Doc -> Doc
159169($$) x y = if isEmpty x
@@ -162,6 +172,7 @@ hsep = foldr (<+>) empty
162172 then x
163173 else x <> cr <> y
164174
175+infixr 5 $+$
165176-- | @a $$ b@ puts @a@ above @b@, with a blank line between.
166177($+$) :: Doc -> Doc -> Doc
167178($+$) x y = if isEmpty x