diff options
-rw-r--r-- | src/Text/Pandoc/Extensions.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs index 968476930..31ca0d2f4 100644 --- a/src/Text/Pandoc/Extensions.hs +++ b/src/Text/Pandoc/Extensions.hs @@ -1,3 +1,8 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TemplateHaskell #-} {- Copyright (C) 2012-2018 John MacFarlane <jgm@berkeley.edu> @@ -15,10 +20,6 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE TemplateHaskell #-} {- | Module : Text.Pandoc.Extensions @@ -59,9 +60,17 @@ import Text.Parsec newtype Extensions = Extensions Integer deriving (Show, Read, Eq, Ord, Data, Typeable, Generic, ToJSON, FromJSON) +#if MIN_VERSION_base(4,9,0) +instance Semigroup Extensions where + (Extensions a) <> (Extensions b) = Extensions (a .|. b) +instance Monoid Extensions where + mempty = Extensions 0 + mappend = (<>) +#else instance Monoid Extensions where mempty = Extensions 0 mappend (Extensions a) (Extensions b) = Extensions (a .|. b) +#endif extensionsFromList :: [Extension] -> Extensions extensionsFromList = foldr enableExtension emptyExtensions |