aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2022-11-09 17:35:59 -0800
committerJohn MacFarlane <[email protected]>2022-12-20 20:58:44 -0800
commit8553459f61eb2290008fafedcfbb1df0bb1fe1b4 (patch)
tree548723d13919ff98719d800db71b3c37f88d9234
parent1328e57f088d9f4dab230cd608c5945c605efb3c (diff)
T.P.Format: Monoid, Semigroup instance for ExtensionsConfig.
-rw-r--r--src/Text/Pandoc/Format.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Format.hs b/src/Text/Pandoc/Format.hs
index afd483577..c2065afb1 100644
--- a/src/Text/Pandoc/Format.hs
+++ b/src/Text/Pandoc/Format.hs
@@ -81,6 +81,14 @@ getExtensionsConfig fmt = ExtensionsConfig
, extsSupported = getAllExtensions fmt
}
+instance Semigroup ExtensionsConfig where
+ ExtensionsConfig x1 y1 <> ExtensionsConfig x2 y2 =
+ ExtensionsConfig (x1 <> x2) (y1 <> y2)
+
+instance Monoid ExtensionsConfig where
+ mappend = (<>)
+ mempty = ExtensionsConfig mempty mempty
+
-- | Apply the extension changes in the format spec to the extensions
-- given in the format's extensions configuration. Throws an error in
-- case of an unknown or unsupported extension.