aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-08-08 10:41:39 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2013-08-08 10:41:39 -0700
commit802dc9a8b9f206eb3be592ab19067f637eb2a3ee (patch)
tree6a022f707773924c14d46b48c2fdb5b09d72c983 /src
parentbb61624bb2bba416e1992ecdf101f9660a3edcae (diff)
downloadpandoc-802dc9a8b9f206eb3be592ab19067f637eb2a3ee.tar.gz
Added Text.Pandoc.Compat.Monoid.
This allows pandoc to compile with base < 4.5, where Data.Monoid doesn't export `<>`. Thanks to Dirk Ullirch for the patch.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Compat/Monoid.hs16
-rw-r--r--src/Text/Pandoc/Templates.hs2
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs2
3 files changed, 18 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Compat/Monoid.hs b/src/Text/Pandoc/Compat/Monoid.hs
new file mode 100644
index 000000000..80ffcbbd6
--- /dev/null
+++ b/src/Text/Pandoc/Compat/Monoid.hs
@@ -0,0 +1,16 @@
+{-# LANGUAGE CPP #-}
+module Text.Pandoc.Compat.Monoid ( Monoid(..)
+ , (<>)
+ ) where
+
+#if MIN_VERSION_base(4,5,0)
+import Data.Monoid ((<>), Monoid(..))
+#else
+import Data.Monoid (mappend, Monoid(..))
+#endif
+
+#if MIN_VERSION_base(4,5,0)
+#else
+(<>) :: Monoid m => m -> m -> m
+(<>) = mappend
+#endif
diff --git a/src/Text/Pandoc/Templates.hs b/src/Text/Pandoc/Templates.hs
index c95c84ca8..22a44e735 100644
--- a/src/Text/Pandoc/Templates.hs
+++ b/src/Text/Pandoc/Templates.hs
@@ -102,7 +102,7 @@ import Control.Applicative
import qualified Data.Text as T
import Data.Text (Text)
import Data.Text.Encoding (encodeUtf8)
-import Data.Monoid ((<>), Monoid(..))
+import Text.Pandoc.Compat.Monoid ((<>), Monoid(..))
import Data.List (intersperse, nub)
import System.FilePath ((</>), (<.>))
import qualified Data.Map as M
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 611cddc65..6bb4d5569 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -35,7 +35,7 @@ import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Lazy.Char8 as BL8
import qualified Data.Map as M
import qualified Text.Pandoc.UTF8 as UTF8
-import Data.Monoid ((<>))
+import Text.Pandoc.Compat.Monoid ((<>))
import Codec.Archive.Zip
import Data.Time.Clock.POSIX
import Text.Pandoc.Definition