[commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove maybeDecodeDay (7ece834)

git at git.haskell.org git at git.haskell.org
Mon Feb 20 21:08:13 UTC 2017


Repository : ssh://git@git.haskell.org/time

On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis
Link       : http://git.haskell.org/packages/time.git/commitdiff/7ece8344e900e08a360e85c610f3160303f47887

>---------------------------------------------------------------

commit 7ece8344e900e08a360e85c610f3160303f47887
Author: Ashley Yakeley <ashley at semantic.org>
Date:   Mon May 9 01:24:16 2005 -0700

    remove maybeDecodeDay
    
    darcs-hash:20050509082416-ac6dd-891eb8f17253072739f7852627b2a9de76a855c0


>---------------------------------------------------------------

7ece8344e900e08a360e85c610f3160303f47887
 System/Time/Calendar/Calendar.hs  | 4 ----
 System/Time/Calendar/Gregorian.hs | 1 -
 System/Time/Calendar/ISOWeek.hs   | 1 -
 System/Time/Calendar/YearDay.hs   | 2 --
 4 files changed, 8 deletions(-)

diff --git a/System/Time/Calendar/Calendar.hs b/System/Time/Calendar/Calendar.hs
index 060e43a..77f30d2 100644
--- a/System/Time/Calendar/Calendar.hs
+++ b/System/Time/Calendar/Calendar.hs
@@ -14,19 +14,15 @@ module System.Time.Calendar.Calendar
 import System.Time.Calendar.TimeOfDay
 import System.Time.Calendar.Timezone
 import System.Time.Clock
-import Data.Maybe
 
 class (Eq d) => DayEncoding d where
 	-- | name the given day according to the calendar
 	encodeDay :: ModJulianDay -> d
 	-- | find out which day a given calendar day is
-	maybeDecodeDay :: d -> Maybe ModJulianDay
 	decodeDay :: d -> ModJulianDay
-	decodeDay day = fromMaybe (error "invalid day") (maybeDecodeDay day)
 
 instance DayEncoding ModJulianDay where
 	encodeDay = id
-	maybeDecodeDay = Just
 	decodeDay = id
 
 class (Eq t) => LocalTimeEncoding t where
diff --git a/System/Time/Calendar/Gregorian.hs b/System/Time/Calendar/Gregorian.hs
index 4422ce1..fa9b89c 100644
--- a/System/Time/Calendar/Gregorian.hs
+++ b/System/Time/Calendar/Gregorian.hs
@@ -47,4 +47,3 @@ instance DayEncoding GregorianDay where
 		a = div (14 - month') 12
 		y = year - a
 		m = month' + (12 * a) - 3
-	maybeDecodeDay = Just . decodeDay -- WRONG
diff --git a/System/Time/Calendar/ISOWeek.hs b/System/Time/Calendar/ISOWeek.hs
index e6412e4..2390f01 100644
--- a/System/Time/Calendar/ISOWeek.hs
+++ b/System/Time/Calendar/ISOWeek.hs
@@ -34,4 +34,3 @@ instance DayEncoding ISOWeek where
 
 	decodeDay (ISOWeek y w d) = k - (mod k 7) + (toInteger ((w * 7) + d)) - 10 where
 		k = decodeDay (YearDay y 6)
-	maybeDecodeDay = Just . decodeDay -- WRONG
diff --git a/System/Time/Calendar/YearDay.hs b/System/Time/Calendar/YearDay.hs
index d9ecf53..556c913 100644
--- a/System/Time/Calendar/YearDay.hs
+++ b/System/Time/Calendar/YearDay.hs
@@ -29,8 +29,6 @@ instance DayEncoding YearDay where
 	decodeDay (YearDay year day) =
 		(fromIntegral day) + (div (1532) 5) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678882 where
 		y = year - 1
-	maybeDecodeDay t@(YearDay year day) | (day >= 1) && (day <= if isLeapYear year then 366 else 365) = Just (decodeDay t)
-	maybeDecodeDay _ = Nothing
 
 isLeapYear :: Integer -> Bool
 isLeapYear year = (mod year 4 == 0) && ((mod year 400 == 0) || not (mod year 100 == 0))



More information about the ghc-commits mailing list