T.P.Format: Monoid, Semigroup instance for ExtensionsConfig.

This commit is contained in:
John MacFarlane
2022-12-20 20:58:44 -08:00
parent 1328e57f08
commit 8553459f61
+8
View File
@@ -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.