Extensions: Monoid instance for Extensions.
[API change]
This commit is contained in:
parent
a20302d9cf
commit
a9259c1501
1 changed files with 5 additions and 1 deletions
|
@ -45,7 +45,7 @@ module Text.Pandoc.Extensions ( Extension(..)
|
||||||
, githubMarkdownExtensions
|
, githubMarkdownExtensions
|
||||||
, multimarkdownExtensions )
|
, multimarkdownExtensions )
|
||||||
where
|
where
|
||||||
import Data.Bits (clearBit, setBit, testBit)
|
import Data.Bits (clearBit, setBit, testBit, (.|.))
|
||||||
import Data.Data (Data)
|
import Data.Data (Data)
|
||||||
import Data.Typeable (Typeable)
|
import Data.Typeable (Typeable)
|
||||||
import GHC.Generics (Generic)
|
import GHC.Generics (Generic)
|
||||||
|
@ -55,6 +55,10 @@ import Text.Parsec
|
||||||
newtype Extensions = Extensions Integer
|
newtype Extensions = Extensions Integer
|
||||||
deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
|
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 :: [Extension] -> Extensions
|
||||||
extensionsFromList = foldr enableExtension emptyExtensions
|
extensionsFromList = foldr enableExtension emptyExtensions
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue