adapt to GHC-7.10's time-1.5 (#239)

This commit is contained in:
Simon Michael 2015-03-27 15:42:32 -07:00
parent b8974c4bcc
commit e60eb71467
6 changed files with 64 additions and 19 deletions

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoMonoLocalBinds #-} {-# LANGUAGE NoMonoLocalBinds #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-| {-|
@ -67,14 +68,18 @@ import Control.Applicative ((<*))
import Control.Monad import Control.Monad
import Data.List import Data.List
import Data.Maybe import Data.Maybe
#if MIN_VERSION_time(1,5,0)
import Data.Time.Format hiding (months)
#else
import Data.Time.Format import Data.Time.Format
import System.Locale (defaultTimeLocale)
#endif
import Data.Time.Calendar import Data.Time.Calendar
import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.OrdinalDate
import Data.Time.Calendar.WeekDate import Data.Time.Calendar.WeekDate
import Data.Time.Clock import Data.Time.Clock
import Data.Time.LocalTime import Data.Time.LocalTime
import Safe (headMay, lastMay, readMay) import Safe (headMay, lastMay, readMay)
import System.Locale (defaultTimeLocale)
import Test.HUnit import Test.HUnit
import Text.Parsec import Text.Parsec
import Text.Printf import Text.Printf

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-| {-|
A 'TimeLogEntry' is a clock-in, clock-out, or other directive in a timelog A 'TimeLogEntry' is a clock-in, clock-out, or other directive in a timelog
@ -13,7 +14,9 @@ import Data.Time.Calendar
import Data.Time.Clock import Data.Time.Clock
import Data.Time.Format import Data.Time.Format
import Data.Time.LocalTime import Data.Time.LocalTime
#if !MIN_VERSION_time(1,5,0)
import System.Locale (defaultTimeLocale) import System.Locale (defaultTimeLocale)
#endif
import Test.HUnit import Test.HUnit
import Text.Printf import Text.Printf

View File

@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-| {-|
A reader for CSV data, using an extra rules file to help interpret the data. A reader for CSV data, using an extra rules file to help interpret the data.
@ -30,11 +31,15 @@ import Data.Maybe
import Data.Ord import Data.Ord
import Data.Time.Calendar (Day) import Data.Time.Calendar (Day)
import Data.Time.Format (parseTime) import Data.Time.Format (parseTime)
#if MIN_VERSION_time(1,5,0)
import Data.Time.Format (defaultTimeLocale)
#else
import System.Locale (defaultTimeLocale)
#endif
import Safe import Safe
import System.Directory (doesFileExist) import System.Directory (doesFileExist)
import System.FilePath import System.FilePath
import System.IO (stderr) import System.IO (stderr)
import System.Locale (defaultTimeLocale)
import Test.HUnit import Test.HUnit
import Text.CSV (parseCSV, CSV) import Text.CSV (parseCSV, CSV)
import Text.Parsec hiding (parse) import Text.Parsec hiding (parse)

View File

@ -39,6 +39,12 @@ flag double
Default: False Default: False
flag old-locale
description: A compatibility flag, set automatically by cabal.
If false then depend on time >= 1.5,
if true then depend on time < 1.5 together with old-locale.
default: False
library library
-- should set patchlevel here as in Makefile -- should set patchlevel here as in Makefile
cpp-options: -DPATCHLEVEL=0 cpp-options: -DPATCHLEVEL=0
@ -93,20 +99,21 @@ library
,directory ,directory
,filepath ,filepath
,mtl ,mtl
,old-locale
,old-time ,old-time
,parsec >= 3 ,parsec >= 3
,regex-tdfa ,regex-tdfa
,regexpr >= 0.5.1 ,regexpr >= 0.5.1
,safe >= 0.2 ,safe >= 0.2
,split >= 0.1 && < 0.3 ,split >= 0.1 && < 0.3
,time
,transformers >= 0.2 && < 0.5 ,transformers >= 0.2 && < 0.5
,utf8-string >= 0.3.5 && < 1.1 ,utf8-string >= 0.3.5 && < 1.1
,HUnit ,HUnit
if impl(ghc >= 7.4) if impl(ghc >= 7.4)
build-depends: pretty-show >= 1.6.4 build-depends: pretty-show >= 1.6.4
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5
test-suite tests test-suite tests
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
@ -128,7 +135,6 @@ test-suite tests
, filepath , filepath
, HUnit , HUnit
, mtl , mtl
, old-locale
, old-time , old-time
, parsec >= 3 , parsec >= 3
, regex-tdfa , regex-tdfa
@ -137,10 +143,13 @@ test-suite tests
, split , split
, test-framework , test-framework
, test-framework-hunit , test-framework-hunit
, time
, transformers , transformers
if impl(ghc >= 7.4) if impl(ghc >= 7.4)
build-depends: pretty-show >= 1.6.4 build-depends: pretty-show >= 1.6.4
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5
-- cf http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html -- cf http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html

View File

@ -110,6 +110,11 @@ flag library-only
Description: Build for use with "yesod devel" Description: Build for use with "yesod devel"
Default: False Default: False
flag old-locale
description: A compatibility flag, set automatically by cabal.
If false then depend on time >= 1.5,
if true then depend on time < 1.5 together with old-locale.
default: False
library library
cpp-options: -DVERSION="0.24.98" cpp-options: -DVERSION="0.24.98"
@ -171,14 +176,12 @@ library
, HUnit , HUnit
, network-conduit , network-conduit
, conduit-extra , conduit-extra
, old-locale
, parsec >= 3 , parsec >= 3
, regexpr >= 0.5.1 , regexpr >= 0.5.1
, safe >= 0.2 , safe >= 0.2
, shakespeare >= 2.0 , shakespeare >= 2.0
, template-haskell , template-haskell
, text , text
, time
, transformers , transformers
, wai , wai
, wai-extra , wai-extra
@ -194,6 +197,10 @@ library
-- , fsnotify -- , fsnotify
-- , hsdev -- , hsdev
-- , mtl -- , mtl
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5
executable hledger-web executable hledger-web
@ -243,14 +250,12 @@ executable hledger-web
, HUnit , HUnit
, network-conduit , network-conduit
, conduit-extra , conduit-extra
, old-locale
, parsec >= 3 , parsec >= 3
, regexpr >= 0.5.1 , regexpr >= 0.5.1
, safe >= 0.2 , safe >= 0.2
, shakespeare >= 2.0 && < 2.1 , shakespeare >= 2.0 && < 2.1
, template-haskell , template-haskell
, text , text
, time
, transformers , transformers
, wai , wai
, wai-extra , wai-extra
@ -266,6 +271,10 @@ executable hledger-web
-- , fsnotify -- , fsnotify
-- , hsdev -- , hsdev
-- , mtl -- , mtl
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5
test-suite test test-suite test
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0

View File

@ -45,6 +45,12 @@ flag curses
Description: On POSIX systems, enable curses support for auto-detecting terminal width. Description: On POSIX systems, enable curses support for auto-detecting terminal width.
Default: True Default: True
flag old-locale
description: A compatibility flag, set automatically by cabal.
If false then depend on time >= 1.5,
if true then depend on time < 1.5 together with old-locale.
default: False
library library
cpp-options: -DVERSION="0.24.98" cpp-options: -DVERSION="0.24.98"
@ -81,7 +87,6 @@ library
,haskeline >= 0.6 && <= 0.8 ,haskeline >= 0.6 && <= 0.8
,HUnit ,HUnit
,mtl ,mtl
,old-locale
,old-time ,old-time
,parsec >= 3 ,parsec >= 3
,process ,process
@ -101,9 +106,12 @@ library
,split >= 0.1 && < 0.3 ,split >= 0.1 && < 0.3
,text >= 0.11 ,text >= 0.11
,tabular >= 0.2 && < 0.3 ,tabular >= 0.2 && < 0.3
,time
,utf8-string >= 0.3.5 && < 1.1 ,utf8-string >= 0.3.5 && < 1.1
,wizards == 1.0.* ,wizards == 1.0.*
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5
if impl(ghc >= 7.4) if impl(ghc >= 7.4)
build-depends: pretty-show >= 1.6.4 build-depends: pretty-show >= 1.6.4
if !os(windows) && flag(curses) if !os(windows) && flag(curses)
@ -132,7 +140,6 @@ executable hledger
,haskeline >= 0.6 && <= 0.8 ,haskeline >= 0.6 && <= 0.8
,HUnit ,HUnit
,mtl ,mtl
,old-locale
,old-time ,old-time
,parsec >= 3 ,parsec >= 3
,process ,process
@ -144,9 +151,12 @@ executable hledger
,split >= 0.1 && < 0.3 ,split >= 0.1 && < 0.3
,tabular >= 0.2 && < 0.3 ,tabular >= 0.2 && < 0.3
,text >= 0.11 ,text >= 0.11
,time
,utf8-string >= 0.3.5 && < 1.1 ,utf8-string >= 0.3.5 && < 1.1
,wizards == 1.0.* ,wizards == 1.0.*
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5
if impl(ghc >= 7.4) if impl(ghc >= 7.4)
build-depends: pretty-show >= 1.6.4 build-depends: pretty-show >= 1.6.4
@ -171,7 +181,6 @@ test-suite tests
, haskeline , haskeline
, HUnit , HUnit
, mtl , mtl
, old-locale
, old-time , old-time
, parsec >= 3 , parsec >= 3
, process , process
@ -185,9 +194,12 @@ test-suite tests
, test-framework , test-framework
, test-framework-hunit , test-framework-hunit
, text , text
, time
, transformers , transformers
, wizards == 1.0.* , wizards == 1.0.*
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5
if impl(ghc >= 7.4) if impl(ghc >= 7.4)
build-depends: pretty-show >= 1.6.4 build-depends: pretty-show >= 1.6.4
@ -203,11 +215,13 @@ benchmark bench
build-depends: hledger-lib, build-depends: hledger-lib,
hledger, hledger,
base >= 4.3 && < 5, base >= 4.3 && < 5,
old-locale,
time,
html, html,
tabular >= 0.2 && < 0.3, tabular >= 0.2 && < 0.3,
process, process,
filepath, filepath,
directory directory
if flag(old-locale)
build-depends: time < 1.5, old-locale
else
build-depends: time >= 1.5