diff options
28 files changed, 8 insertions, 70 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs index a98a9c670..992cecb83 100644 --- a/src/Text/Pandoc/App.hs +++ b/src/Text/Pandoc/App.hs @@ -54,7 +54,6 @@ import Data.Char (toLower, toUpper) import Data.List (find, intercalate, isPrefixOf, isSuffixOf, sort) import qualified Data.Map as M import Data.Maybe (fromMaybe, isJust, isNothing) -import Data.Monoid import qualified Data.Set as Set import Data.Text (Text) import qualified Data.Text as T diff --git a/src/Text/Pandoc/Class.hs b/src/Text/Pandoc/Class.hs index f7544433c..40927252f 100644 --- a/src/Text/Pandoc/Class.hs +++ b/src/Text/Pandoc/Class.hs @@ -923,11 +923,7 @@ data FileInfo = FileInfo { infoFileMTime :: UTCTime } newtype FileTree = FileTree {unFileTree :: M.Map FilePath FileInfo} -#if MIN_VERSION_base(4,9,0) deriving (Semigroup, Monoid) -#else - deriving (Monoid) -#endif getFileInfo :: FilePath -> FileTree -> Maybe FileInfo getFileInfo fp tree = diff --git a/src/Text/Pandoc/Extensions.hs b/src/Text/Pandoc/Extensions.hs index 31ca0d2f4..f1a264d82 100644 --- a/src/Text/Pandoc/Extensions.hs +++ b/src/Text/Pandoc/Extensions.hs @@ -60,17 +60,11 @@ 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 diff --git a/src/Text/Pandoc/MediaBag.hs b/src/Text/Pandoc/MediaBag.hs index a962db674..6f4cb8fee 100644 --- a/src/Text/Pandoc/MediaBag.hs +++ b/src/Text/Pandoc/MediaBag.hs @@ -51,11 +51,7 @@ import Text.Pandoc.MIME (MimeType, getMimeTypeDef) -- can be used for an empty 'MediaBag', and '<>' can be used to append -- two 'MediaBag's. newtype MediaBag = MediaBag (M.Map [String] (MimeType, BL.ByteString)) -#if MIN_VERSION_base(4,9,0) deriving (Semigroup, Monoid, Data, Typeable) -#else - deriving (Monoid, Data, Typeable) -#endif instance Show MediaBag where show bag = "MediaBag " ++ show (mediaDirectory bag) diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index 82c2312fe..512786a78 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -41,7 +41,6 @@ import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy.Char8 as BC import Data.Maybe (fromMaybe) -import Data.Monoid ((<>)) import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.IO as TextIO diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index 1afd8683b..64a380b1d 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -203,9 +203,6 @@ import Data.Default import Data.List (intercalate, isSuffixOf, transpose) import qualified Data.Map as M import Data.Maybe (mapMaybe, fromMaybe) -#if MIN_VERSION_base(4,9,0) -import Data.Semigroup (Semigroup, (<>)) -#endif import qualified Data.Set as Set import Data.Text (Text) import Text.HTML.TagSoup.Entity (lookupEntity) @@ -253,17 +250,11 @@ returnF = return . return trimInlinesF :: Future s Inlines -> Future s Inlines trimInlinesF = liftM trimInlines -#if MIN_VERSION_base(4,9,0) instance Semigroup a => Semigroup (Future s a) where (<>) = liftM2 (<>) instance (Semigroup a, Monoid a) => Monoid (Future s a) where mempty = return mempty mappend = (<>) -#else -instance Monoid a => Monoid (Future s a) where - mempty = return mempty - mappend = liftM2 mappend -#endif -- | Parse characters while a predicate is true. takeWhileP :: Monad m diff --git a/src/Text/Pandoc/Pretty.hs b/src/Text/Pandoc/Pretty.hs index 7f695c4d7..ecfd340ef 100644 --- a/src/Text/Pandoc/Pretty.hs +++ b/src/Text/Pandoc/Pretty.hs @@ -82,7 +82,6 @@ import Control.Monad.State.Strict import Data.Char (isSpace) import Data.Foldable (toList) import Data.List (intersperse) -import Data.Monoid ((<>)) import Data.Sequence (Seq, ViewL (..), fromList, mapWithIndex, singleton, viewl, (<|)) import qualified Data.Sequence as Seq @@ -112,11 +111,7 @@ data D = Text Int String deriving (Show, Eq) newtype Doc = Doc { unDoc :: Seq D } -#if MIN_VERSION_base(4,9,0) deriving (Semigroup, Monoid, Show, Eq) -#else - deriving (Monoid, Show, Eq) -#endif instance IsString Doc where fromString = text diff --git a/src/Text/Pandoc/Readers/Creole.hs b/src/Text/Pandoc/Readers/Creole.hs index 505d1686d..5ca625229 100644 --- a/src/Text/Pandoc/Readers/Creole.hs +++ b/src/Text/Pandoc/Readers/Creole.hs @@ -38,7 +38,6 @@ module Text.Pandoc.Readers.Creole ( readCreole import Control.Monad.Except (guard, liftM2, throwError) import qualified Data.Foldable as F import Data.Maybe (fromMaybe) -import Data.Monoid import Data.Text (Text) import qualified Data.Text as T import qualified Text.Pandoc.Builder as B @@ -67,7 +66,7 @@ type CRLParser = ParserT [Char] ParserState -- Utility functions -- -(<+>) :: (Monad m, Monoid a) => m a -> m a -> m a +(<+>) :: (Monad m, Semigroup a) => m a -> m a -> m a (<+>) = liftM2 (<>) -- we have to redefine `enclosed' from Text.Pandoc.Parsing, because it diff --git a/src/Text/Pandoc/Readers/EPUB.hs b/src/Text/Pandoc/Readers/EPUB.hs index 3b13bbe13..fb17c1c8c 100644 --- a/src/Text/Pandoc/Readers/EPUB.hs +++ b/src/Text/Pandoc/Readers/EPUB.hs @@ -16,7 +16,6 @@ import qualified Data.ByteString.Lazy as BL (ByteString) import Data.List (isInfixOf, isPrefixOf) import qualified Data.Map as M (Map, elems, fromList, lookup) import Data.Maybe (fromMaybe, mapMaybe) -import Data.Monoid ((<>)) import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TL import Network.URI (unEscapeString) diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 0e79f9ec3..13c87a9c7 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -54,7 +54,7 @@ import Data.List (isPrefixOf) import Data.List.Split (wordsBy, splitWhen) import qualified Data.Map as M import Data.Maybe (fromMaybe, isJust, isNothing) -import Data.Monoid (First (..), (<>)) +import Data.Monoid (First (..)) import qualified Data.Set as Set import Data.Text (Text) import qualified Data.Text as T diff --git a/src/Text/Pandoc/Readers/Haddock.hs b/src/Text/Pandoc/Readers/Haddock.hs index e98c79ed8..2f76fc1a0 100644 --- a/src/Text/Pandoc/Readers/Haddock.hs +++ b/src/Text/Pandoc/Readers/Haddock.hs @@ -17,7 +17,6 @@ module Text.Pandoc.Readers.Haddock import Control.Monad.Except (throwError) import Data.List (intersperse, stripPrefix) import Data.Maybe (fromMaybe) -import Data.Monoid ((<>)) import Data.Text (Text, unpack) import Documentation.Haddock.Parser import Documentation.Haddock.Types diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 7e1b1b95b..237f1aa0c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -39,7 +39,6 @@ import qualified Data.HashMap.Strict as H import Data.List (intercalate, sortBy, transpose, elemIndex) import qualified Data.Map as M import Data.Maybe -import Data.Monoid import Data.Ord (comparing) import Data.Scientific (base10Exponent, coefficient) import qualified Data.Set as Set diff --git a/src/Text/Pandoc/Readers/MediaWiki.hs b/src/Text/Pandoc/Readers/MediaWiki.hs index c19ef2f46..d791a0a28 100644 --- a/src/Text/Pandoc/Readers/MediaWiki.hs +++ b/src/Text/Pandoc/Readers/MediaWiki.hs @@ -45,7 +45,6 @@ import qualified Data.Foldable as F import Data.List (intercalate, intersperse, isPrefixOf) import qualified Data.Map as M import Data.Maybe (fromMaybe, maybeToList) -import Data.Monoid ((<>)) import Data.Sequence (ViewL (..), viewl, (<|)) import qualified Data.Set as Set import Data.Text (Text, unpack) diff --git a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs b/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs index f8ea5c605..03cb82f61 100644 --- a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs +++ b/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs @@ -39,8 +39,6 @@ compatible instances of "ArrowChoice". -- We export everything module Text.Pandoc.Readers.Odt.Generic.Fallible where -import Data.Monoid ((<>)) - -- | Default for now. Will probably become a class at some point. type Failure = () @@ -90,7 +88,7 @@ collapseEither (Right (Right x)) = Right x -- (possibly combined) non-error. If both values represent an error, an error -- is returned. chooseMax :: (Monoid a, Monoid b) => Either a b -> Either a b -> Either a b -chooseMax = chooseMaxWith (<>) +chooseMax = chooseMaxWith mappend -- | If either of the values represents a non-error, the result is a -- (possibly combined) non-error. If both values represent an error, an error @@ -100,7 +98,7 @@ chooseMaxWith :: (Monoid a) => (b -> b -> b) -> Either a b -> Either a b chooseMaxWith (><) (Right a) (Right b) = Right $ a >< b -chooseMaxWith _ (Left a) (Left b) = Left $ a <> b +chooseMaxWith _ (Left a) (Left b) = Left $ a `mappend` b chooseMaxWith _ (Right a) _ = Right a chooseMaxWith _ _ (Right b) = Right b diff --git a/src/Text/Pandoc/Readers/Odt/StyleReader.hs b/src/Text/Pandoc/Readers/Odt/StyleReader.hs index 1863773cf..477f6b8b7 100644 --- a/src/Text/Pandoc/Readers/Odt/StyleReader.hs +++ b/src/Text/Pandoc/Readers/Odt/StyleReader.hs @@ -182,7 +182,6 @@ data Styles = Styles deriving ( Show ) -- Styles from a monoid under union -#if MIN_VERSION_base(4,9,0) instance Semigroup Styles where (Styles sBn1 dSm1 lsBn1) <> (Styles sBn2 dSm2 lsBn2) = Styles (M.union sBn1 sBn2) @@ -191,15 +190,6 @@ instance Semigroup Styles where instance Monoid Styles where mempty = Styles M.empty M.empty M.empty mappend = (<>) -#else -instance Monoid Styles where - mempty = Styles M.empty M.empty M.empty - mappend (Styles sBn1 dSm1 lsBn1) - (Styles sBn2 dSm2 lsBn2) - = Styles (M.union sBn1 sBn2) - (M.union dSm1 dSm2) - (M.union lsBn1 lsBn2) -#endif -- Not all families from the specifications are implemented, only those we need. -- But there are none that are not mentioned here. diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs index fa016283c..de5cb007a 100644 --- a/src/Text/Pandoc/Readers/Org/Blocks.hs +++ b/src/Text/Pandoc/Readers/Org/Blocks.hs @@ -51,7 +51,6 @@ import Data.Char (isSpace, toLower, toUpper) import Data.Default (Default) import Data.List (foldl', isPrefixOf) import Data.Maybe (fromMaybe, isJust, isNothing) -import Data.Monoid ((<>)) import qualified Text.Pandoc.Builder as B import qualified Text.Pandoc.Walk as Walk diff --git a/src/Text/Pandoc/Readers/Org/DocumentTree.hs b/src/Text/Pandoc/Readers/Org/DocumentTree.hs index f77778ec9..ae244e3b0 100644 --- a/src/Text/Pandoc/Readers/Org/DocumentTree.hs +++ b/src/Text/Pandoc/Readers/Org/DocumentTree.hs @@ -36,7 +36,6 @@ import Control.Arrow ((***)) import Control.Monad (guard, void) import Data.Char (toLower, toUpper) import Data.List (intersperse) -import Data.Monoid ((<>)) import Text.Pandoc.Builder (Blocks, Inlines) import Text.Pandoc.Class (PandocMonad) import Text.Pandoc.Definition diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs index 651a069b9..6173669a5 100644 --- a/src/Text/Pandoc/Readers/Org/Inlines.hs +++ b/src/Text/Pandoc/Readers/Org/Inlines.hs @@ -55,7 +55,6 @@ import Data.Char (isAlphaNum, isSpace) import Data.List (intersperse) import qualified Data.Map as M import Data.Maybe (fromMaybe) -import Data.Monoid import Data.Traversable (sequence) import Prelude hiding (sequence) diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index cf6ad30cf..91e0b057a 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -40,7 +40,6 @@ import Data.List (deleteFirstsBy, elemIndex, intercalate, isInfixOf, isSuffixOf, nub, sort, transpose, union) import qualified Data.Map as M import Data.Maybe (fromMaybe, isJust) -import Data.Monoid ((<>)) import Data.Sequence (ViewR (..), viewr) import Data.Text (Text) import qualified Data.Text as T diff --git a/src/Text/Pandoc/Readers/Textile.hs b/src/Text/Pandoc/Readers/Textile.hs index 30bb6a715..fb0bbaa8a 100644 --- a/src/Text/Pandoc/Readers/Textile.hs +++ b/src/Text/Pandoc/Readers/Textile.hs @@ -56,7 +56,6 @@ import Control.Monad (guard, liftM) import Control.Monad.Except (throwError) import Data.Char (digitToInt, isUpper) import Data.List (intercalate, intersperse, transpose) -import Data.Monoid ((<>)) import Data.Text (Text) import qualified Data.Text as T import Text.HTML.TagSoup (Tag (..), fromAttrib) diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs index f4dda7a11..64d219e9c 100644 --- a/src/Text/Pandoc/Readers/Txt2Tags.hs +++ b/src/Text/Pandoc/Readers/Txt2Tags.hs @@ -38,7 +38,6 @@ import Data.Char (toLower) import Data.Default import Data.List (intercalate, transpose) import Data.Maybe (fromMaybe) -import Data.Monoid ((<>)) import Data.Text (Text) import qualified Data.Text as T import Data.Time.Format (formatTime) @@ -444,7 +443,7 @@ inlineMarkup p f c special = try $ do let end' = case drop 2 end of "" -> mempty xs -> special xs - return $ f (start' <> body' <> end') + return $ f (start' `mappend` body' `mappend` end') Nothing -> do -- Either bad or case such as ***** guard (l >= 5) let body' = replicate (l - 4) c diff --git a/src/Text/Pandoc/Readers/Vimwiki.hs b/src/Text/Pandoc/Readers/Vimwiki.hs index 74a7e8fd6..b0d6fbb41 100644 --- a/src/Text/Pandoc/Readers/Vimwiki.hs +++ b/src/Text/Pandoc/Readers/Vimwiki.hs @@ -69,7 +69,6 @@ import Control.Monad.Except (throwError) import Data.Default import Data.List (isInfixOf, isPrefixOf) import Data.Maybe -import Data.Monoid import Data.Text (Text, unpack) import Text.Pandoc.Builder (Blocks, Inlines, fromList, toList, trimInlines) import qualified Text.Pandoc.Builder as B (blockQuote, bulletList, code, diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs index a1c5c919e..d368b06c0 100644 --- a/src/Text/Pandoc/SelfContained.hs +++ b/src/Text/Pandoc/SelfContained.hs @@ -41,7 +41,6 @@ import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Lazy as L import Data.Char (isAlphaNum, isAscii, toLower) import Data.List (isPrefixOf) -import Data.Monoid ((<>)) import Network.URI (escapeURIString) import System.FilePath (takeDirectory, takeExtension, (</>)) import Text.HTML.TagSoup diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 52e1447db..d76333f41 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -111,7 +111,6 @@ import Data.Data (Data, Typeable) import Data.List (find, intercalate, intersperse, stripPrefix) import qualified Data.Map as M import Data.Maybe (mapMaybe) -import Data.Monoid ((<>)) import Data.Sequence (ViewL (..), ViewR (..), viewl, viewr) import qualified Data.Set as Set import qualified Data.Text as T @@ -447,7 +446,7 @@ instance Walkable Inline Element where elts' <- walkM f elts return $ Sec lev nums attr ils' elts' query f (Blk x) = query f x - query f (Sec _ _ _ ils elts) = query f ils <> query f elts + query f (Sec _ _ _ ils elts) = query f ils `mappend` query f elts instance Walkable Block Element where walk f (Blk x) = Blk (walk f x) @@ -458,7 +457,7 @@ instance Walkable Block Element where elts' <- walkM f elts return $ Sec lev nums attr ils' elts' query f (Blk x) = query f x - query f (Sec _ _ _ ils elts) = query f ils <> query f elts + query f (Sec _ _ _ ils elts) = query f ils `mappend` query f elts -- | Convert Pandoc inline list to plain text identifier. HTML diff --git a/src/Text/Pandoc/Translations.hs b/src/Text/Pandoc/Translations.hs index cc4b1ebba..8c38647b6 100644 --- a/src/Text/Pandoc/Translations.hs +++ b/src/Text/Pandoc/Translations.hs @@ -81,11 +81,7 @@ data Term = deriving (Show, Eq, Ord, Generic, Enum, Read) newtype Translations = Translations (M.Map Term String) -#if MIN_VERSION_base(4,9,0) deriving (Show, Generic, Semigroup, Monoid) -#else - deriving (Show, Generic, Monoid) -#endif instance FromJSON Term where parseJSON (String t) = case safeRead (T.unpack t) of diff --git a/src/Text/Pandoc/Writers/CommonMark.hs b/src/Text/Pandoc/Writers/CommonMark.hs index 7a6eb2948..4abb77280 100644 --- a/src/Text/Pandoc/Writers/CommonMark.hs +++ b/src/Text/Pandoc/Writers/CommonMark.hs @@ -36,7 +36,7 @@ import CMarkGFM import Control.Monad.State.Strict (State, get, modify, runState) import Data.Foldable (foldrM) import Data.List (transpose) -import Data.Monoid (Any (..), (<>)) +import Data.Monoid (Any (..)) import Data.Text (Text) import qualified Data.Text as T import Network.HTTP (urlEncode) diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 1647df7ea..0af5d7d2f 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -49,7 +49,6 @@ import Control.Monad.State.Strict import Data.Char (ord, toLower) import Data.List (intercalate, intersperse, isPrefixOf, partition) import Data.Maybe (catMaybes, fromMaybe, isJust, isNothing) -import Data.Monoid ((<>)) import qualified Data.Set as Set import Data.String (fromString) import Data.Text (Text) diff --git a/src/Text/Pandoc/Writers/OOXML.hs b/src/Text/Pandoc/Writers/OOXML.hs index 30d8d72dd..b1eaa9d25 100644 --- a/src/Text/Pandoc/Writers/OOXML.hs +++ b/src/Text/Pandoc/Writers/OOXML.hs @@ -45,7 +45,6 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy.Char8 as BL8 import Data.Maybe (mapMaybe) -import Data.Monoid ((<>)) import Text.Pandoc.Class (PandocMonad) import qualified Text.Pandoc.UTF8 as UTF8 import Text.XML.Light as XML |