From 8553459f61eb2290008fafedcfbb1df0bb1fe1b4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 9 Nov 2022 17:35:59 -0800 Subject: T.P.Format: Monoid, Semigroup instance for ExtensionsConfig. --- src/Text/Pandoc/Format.hs | 8 ++++++++ 1 file changed, 8 insertions(+) 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. -- cgit v1.2.3