aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-10-14 10:05:17 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-10-14 10:06:18 -0700
commit6dc3b6585d028dea4df3684ed975ccd2f7046e62 (patch)
tree3d50550898a0c6bc753e0754df42a90858d84424
parent1aff1b84ebb4ab863d9dda3ff740f7f94bbd362a (diff)
downloadpandoc-6dc3b6585d028dea4df3684ed975ccd2f7046e62.tar.gz
More changes to avoid compiler warnings on ghc 7.10.
* CPP around deprecated `parseTime`. * Text.Pandoc.Compat.Locale -> Text.Pandoc.Compat.Time, now exports Data.Time.
-rw-r--r--pandoc.cabal6
-rw-r--r--src/Text/Pandoc/Compat/Locale.hs9
-rw-r--r--src/Text/Pandoc/Compat/Time.hs18
-rw-r--r--src/Text/Pandoc/Readers/Txt2Tags.hs2
-rw-r--r--src/Text/Pandoc/Shared.hs10
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs3
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs3
-rw-r--r--src/Text/Pandoc/Writers/OPML.hs13
8 files changed, 42 insertions, 22 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index 2925296f3..a4ffeb04a 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -393,7 +393,7 @@ Library
Text.Pandoc.ImageSize,
Text.Pandoc.Slides,
Text.Pandoc.Highlighting,
- Text.Pandoc.Compat.Locale,
+ Text.Pandoc.Compat.Time,
Text.Pandoc.Compat.Except,
Text.Pandoc.Compat.TagSoupEntity,
Text.Pandoc.Compat.Directory
@@ -432,6 +432,7 @@ Executable pandoc
Hs-Source-Dirs: ., prelude
Main-Is: pandoc.hs
Buildable: True
+ Other-Modules: Prelude
Executable trypandoc
Main-Is: trypandoc.hs
@@ -443,6 +444,7 @@ Executable trypandoc
Buildable: True
else
Buildable: False
+ Other-Modules: Prelude
Test-Suite test-pandoc
Type: exitcode-stdio-1.0
@@ -492,6 +494,7 @@ Test-Suite test-pandoc
Tests.Writers.LaTeX
Tests.Writers.Docx
Tests.Writers.RST
+ Prelude
Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind -threaded
Default-Language: Haskell98
@@ -505,3 +508,4 @@ benchmark benchmark-pandoc
criterion >= 1.0 && < 1.2
Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind
Default-Language: Haskell98
+ Other-Modules: Prelude
diff --git a/src/Text/Pandoc/Compat/Locale.hs b/src/Text/Pandoc/Compat/Locale.hs
deleted file mode 100644
index ac791136c..000000000
--- a/src/Text/Pandoc/Compat/Locale.hs
+++ /dev/null
@@ -1,9 +0,0 @@
-{-# LANGUAGE CPP #-}
-module Text.Pandoc.Compat.Locale ( defaultTimeLocale )
-where
-
-#if MIN_VERSION_time(1,5,0)
-import Data.Time.Format ( defaultTimeLocale )
-#else
-import System.Locale ( defaultTimeLocale )
-#endif
diff --git a/src/Text/Pandoc/Compat/Time.hs b/src/Text/Pandoc/Compat/Time.hs
new file mode 100644
index 000000000..aa08ca224
--- /dev/null
+++ b/src/Text/Pandoc/Compat/Time.hs
@@ -0,0 +1,18 @@
+{-# LANGUAGE CPP #-}
+#if MIN_VERSION_time(1,5,0)
+module Text.Pandoc.Compat.Time (
+ module Data.Time
+)
+where
+import Data.Time
+
+#else
+module Text.Pandoc.Compat.Time (
+ module Data.Time,
+ defaultTimeLocale
+)
+where
+import Data.Time
+import System.Locale ( defaultTimeLocale )
+
+#endif
diff --git a/src/Text/Pandoc/Readers/Txt2Tags.hs b/src/Text/Pandoc/Readers/Txt2Tags.hs
index 79ecaf9a2..1c868f5f0 100644
--- a/src/Text/Pandoc/Readers/Txt2Tags.hs
+++ b/src/Text/Pandoc/Readers/Txt2Tags.hs
@@ -50,7 +50,7 @@ import Text.Pandoc.Error
import Data.Time.LocalTime (getZonedTime)
import Text.Pandoc.Compat.Directory(getModificationTime)
import Data.Time.Format (formatTime)
-import Text.Pandoc.Compat.Locale (defaultTimeLocale)
+import Text.Pandoc.Compat.Time (defaultTimeLocale)
import System.IO.Error (catchIOError)
type T2T = ParserT String ParserState (Reader T2TMeta)
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index b87611145..58e065845 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -123,8 +123,7 @@ import qualified Control.Monad.State as S
import qualified Control.Exception as E
import Control.Monad (msum, unless, MonadPlus(..))
import Text.Pandoc.Pretty (charWidth)
-import Text.Pandoc.Compat.Locale (defaultTimeLocale)
-import Data.Time
+import Text.Pandoc.Compat.Time
import Data.Time.Clock.POSIX
import System.IO (stderr)
import System.IO.Temp
@@ -321,7 +320,12 @@ tabFilter tabStop =
normalizeDate :: String -> Maybe String
normalizeDate s = fmap (formatTime defaultTimeLocale "%F")
(msum $ map (\fs -> parsetimeWith fs s) formats :: Maybe Day)
- where parsetimeWith = parseTime defaultTimeLocale
+ where parsetimeWith =
+#if MIN_VERSION_time(1,5,0)
+ parseTimeM True defaultTimeLocale
+#else
+ parseTime defaultTimeLocale
+#endif
formats = ["%x","%m/%d/%Y", "%D","%F", "%d %b %Y",
"%d %B %Y", "%b. %d, %Y", "%B %d, %Y", "%Y"]
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 77335834d..639818f2e 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -38,9 +38,8 @@ import qualified Text.Pandoc.UTF8 as UTF8
import Codec.Archive.Zip
import Data.Time.Clock.POSIX
import Data.Time.Clock
-import Data.Time.Format
import System.Environment
-import Text.Pandoc.Compat.Locale (defaultTimeLocale)
+import Text.Pandoc.Compat.Time
import Text.Pandoc.Definition
import Text.Pandoc.Generic
import Text.Pandoc.ImageSize
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index d8cf3a85f..2843f8c74 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -43,8 +43,7 @@ import qualified Data.ByteString.Lazy.Char8 as B8
import qualified Text.Pandoc.UTF8 as UTF8
import Codec.Archive.Zip ( emptyArchive, addEntryToArchive, eRelativePath, fromEntry , Entry, toEntry, fromArchive)
import Data.Time.Clock.POSIX ( getPOSIXTime )
-import Data.Time (getCurrentTime,UTCTime, formatTime)
-import Text.Pandoc.Compat.Locale ( defaultTimeLocale )
+import Text.Pandoc.Compat.Time
import Text.Pandoc.Shared ( renderTags', safeRead, uniqueIdent, trim
, normalizeDate, readDataFile, stringify, warn
, hierarchicalize, fetchItem' )
diff --git a/src/Text/Pandoc/Writers/OPML.hs b/src/Text/Pandoc/Writers/OPML.hs
index c7563d751..519136861 100644
--- a/src/Text/Pandoc/Writers/OPML.hs
+++ b/src/Text/Pandoc/Writers/OPML.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
{-
Copyright (C) 2013-2015 John MacFarlane <jgm@berkeley.edu>
@@ -37,8 +38,7 @@ import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.Writers.HTML (writeHtmlString)
import Text.Pandoc.Writers.Markdown (writeMarkdown)
import Text.Pandoc.Pretty
-import Data.Time
-import Text.Pandoc.Compat.Locale (defaultTimeLocale)
+import Text.Pandoc.Compat.Time
import qualified Text.Pandoc.Builder as B
-- | Convert Pandoc document to string in OPML format.
@@ -69,8 +69,13 @@ showDateTimeRFC822 :: UTCTime -> String
showDateTimeRFC822 = formatTime defaultTimeLocale "%a, %d %b %Y %X %Z"
convertDate :: [Inline] -> String
-convertDate ils = maybe "" showDateTimeRFC822
- $ parseTime defaultTimeLocale "%F" =<< (normalizeDate $ stringify ils)
+convertDate ils = maybe "" showDateTimeRFC822 $
+#if MIN_VERSION_time(1,5,0)
+ parseTimeM True
+#else
+ parseTime
+#endif
+ defaultTimeLocale "%F" =<< (normalizeDate $ stringify ils)
-- | Convert an Element to OPML.
elementToOPML :: WriterOptions -> Element -> Doc