diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-06-24 13:20:30 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-06-24 13:20:42 +0200 |
commit | a9259c1501cdfd0d0b5c0f95f36497da82befb50 (patch) | |
tree | 81bb91ccea8d145ad485589673151fed49db5383 /src/Text/Pandoc | |
parent | a20302d9cfc3651a217bd76e9f9cce3e285433d4 (diff) | |
download | pandoc-a9259c1501cdfd0d0b5c0f95f36497da82befb50.tar.gz |
Extensions: Monoid instance for Extensions.
[API change]
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Extensions.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs index 398944d47..79e3529e9 100644 --- a/src/Text/Pandoc/Extensions.hs +++ b/src/Text/Pandoc/Extensions.hs @@ -45,7 +45,7 @@ module Text.Pandoc.Extensions ( Extension(..) , githubMarkdownExtensions , multimarkdownExtensions ) where -import Data.Bits (clearBit, setBit, testBit) +import Data.Bits (clearBit, setBit, testBit, (.|.)) import Data.Data (Data) import Data.Typeable (Typeable) import GHC.Generics (Generic) @@ -55,6 +55,10 @@ import Text.Parsec newtype Extensions = Extensions Integer deriving (Show, Read, Eq, Ord, Data, Typeable, Generic) +instance Monoid Extensions where + mempty = Extensions 0 + mappend (Extensions a) (Extensions b) = Extensions (a .|. b) + extensionsFromList :: [Extension] -> Extensions extensionsFromList = foldr enableExtension emptyExtensions |