3
0
Fork 0
forked from mirrors/nixpkgs

haskellPackages.timezone-series: Add support for time-1.6 - applied patch https://github.com/ygale/timezone-series/pull/1

This commit is contained in:
Maciek Starzyk 2016-06-08 23:34:23 +02:00
parent bdb8bafd1f
commit 10c87e69b4
2 changed files with 66 additions and 0 deletions

View file

@ -1036,4 +1036,6 @@ self: super: {
substituteInPlace ./libmpd.cabal --replace "time >=1.5 && <1.6" "time >=1.5"
'';
}));
timezone-series = appendPatch super.timezone-series ./patches/timezone-series.patch;
}

View file

@ -0,0 +1,64 @@
commit f8dece8c016db6476e2bb0d4f972769a76f6ff40
Author: Ryan Trinkle <ryan.trinkle@gmail.com>
Date: Wed May 11 20:17:23 2016 -0400
Add support for time-1.6
diff --git a/Data/Time/LocalTime/TimeZone/Series.hs b/Data/Time/LocalTime/TimeZone/Series.hs
index babcc0b..c8bb0ad 100644
--- a/Data/Time/LocalTime/TimeZone/Series.hs
+++ b/Data/Time/LocalTime/TimeZone/Series.hs
@@ -2,6 +2,7 @@
-- clock settings that occurred in the past and are scheduled to occur
-- in the future for the timezone.
+{-# LANGUAGE CPP #-}
module Data.Time.LocalTime.TimeZone.Series
(
-- * Representing a timezone
@@ -76,8 +77,18 @@ instance Show TimeZoneSeries where
instance Read TimeZoneSeries where
readsPrec n = map (first $ flip TimeZoneSeries []) . readsPrec n
+-- In time-1.6, buildTime was changed to return a `Maybe t` rather
+-- than just a `t`
+#if MIN_VERSION_time(1,6,0)
+mapBuiltTime :: (a -> b) -> Maybe a -> Maybe b
+mapBuiltTime = fmap
+#else
+mapBuiltTime :: (a -> b) -> a -> b
+mapBuiltTime = id
+#endif
+
instance ParseTime TimeZoneSeries where
- buildTime locale = flip TimeZoneSeries [] . buildTime locale
+ buildTime locale = mapBuiltTime (flip TimeZoneSeries []) . buildTime locale
-- | The latest non-summer @TimeZone@ in a @TimeZoneSeries@ is in some
-- sense representative of the timezone.
@@ -167,7 +178,7 @@ instance Read ZoneSeriesTime where
readsPrec n = map (first zonedTimeToZoneSeriesTime) . readsPrec n
instance ParseTime ZoneSeriesTime where
- buildTime locale = zonedTimeToZoneSeriesTime . buildTime locale
+ buildTime locale = mapBuiltTime zonedTimeToZoneSeriesTime . buildTime locale
instance FormatTime ZoneSeriesTime where
formatCharacter =
diff --git a/timezone-series.cabal b/timezone-series.cabal
index 058c142..4ee73a4 100644
--- a/timezone-series.cabal
+++ b/timezone-series.cabal
@@ -1,5 +1,5 @@
Name: timezone-series
-Version: 0.1.5.1
+Version: 0.1.5.2
Synopsis: Enhanced timezone handling for Data.Time
Description: This package endows Data.Time, from the time
package, with several data types and functions
@@ -28,4 +28,4 @@ Library
Exposed-modules: Data.Time.LocalTime.TimeZone.Series
Default-extensions: DeriveDataTypeable
Build-depends: base >= 4.4 && < 5,
- time >= 1.1.4 && < 1.6
+ time >= 1.1.4 && < 1.7