thyme 0.3.5.0 → 0.3.5.1
raw patch · 7 files changed
+42/−35 lines, 7 filesdep ~vector-th-unbox
Dependency ranges changed: vector-th-unbox
Files
- src/Data/Thyme/Calendar/Internal.hs +20/−20
- src/Data/Thyme/Calendar/WeekdayOfMonth.hs +8/−5
- src/Data/Thyme/Clock/Internal.hs +1/−1
- src/Data/Thyme/Clock/TAI.hs +1/−1
- src/Data/Thyme/Internal/Micro.hs +1/−1
- src/Data/Thyme/LocalTime.hs +9/−5
- thyme.cabal +2/−2
src/Data/Thyme/Calendar/Internal.hs view
@@ -22,12 +22,12 @@ import Control.Lens import Control.Monad import Data.AffineSpace-import Data.Bits ((.&.))+import Data.Bits import Data.Data import Data.Int import Data.Ix import Data.Thyme.Format.Internal-#if __GLASGOW_HASKELL__ != 706+#if __GLASGOW_HASKELL__ == 704 import qualified Data.Vector.Generic import qualified Data.Vector.Generic.Mutable #endif@@ -407,27 +407,27 @@ derivingUnbox "Day" [t| Day -> Int |] [| toModifiedJulianDay |] [| ModifiedJulianDay |] -derivingUnbox "YearMonthDay" [t| YearMonthDay -> (Year, Month, DayOfMonth) |]- [| \ YearMonthDay {..} -> (ymdYear, ymdMonth, ymdDay) |]- [| \ (ymdYear, ymdMonth, ymdDay) -> YearMonthDay {..} |]+derivingUnbox "YearMonthDay" [t| YearMonthDay -> Int |]+ [| \ YearMonthDay {..} -> shiftL ymdYear 9 .|. shiftL ymdMonth 5 .|. ymdDay |]+ [| \ n -> YearMonthDay (shiftR n 9) (shiftR n 5 .&. 0xf) (n .&. 0x1f) |] -derivingUnbox "OrdinalDate" [t| OrdinalDate -> (Year, DayOfYear) |]- [| \ OrdinalDate {..} -> (odYear, odDay) |]- [| \ (odYear, odDay) -> OrdinalDate {..} |]+derivingUnbox "OrdinalDate" [t| OrdinalDate -> Int |]+ [| \ OrdinalDate {..} -> shiftL odYear 9 .|. odDay |]+ [| \ n -> OrdinalDate (shiftR n 9) (n .&. 0x1ff) |] -derivingUnbox "MonthDay" [t| MonthDay -> (Month, DayOfMonth) |]- [| \ MonthDay {..} -> (mdMonth, mdDay) |]- [| \ (mdMonth, mdDay) -> MonthDay {..} |]+derivingUnbox "MonthDay" [t| MonthDay -> Int |]+ [| \ MonthDay {..} -> shiftL mdMonth 5 .|. mdDay |]+ [| \ n -> MonthDay (shiftR n 5) (n .&. 0x1f) |] -derivingUnbox "WeekDate" [t| WeekDate -> (Year, WeekOfYear, DayOfWeek) |]- [| \ WeekDate {..} -> (wdYear, wdWeek, wdDay) |]- [| \ (wdYear, wdWeek, wdDay) -> WeekDate {..} |]+derivingUnbox "WeekDate" [t| WeekDate -> Int |]+ [| \ WeekDate {..} -> shiftL wdYear 9 .|. shiftL wdWeek 3 .|. wdDay |]+ [| \ n -> WeekDate (shiftR n 9) (shiftR n 3 .&. 0x3f) (n .&. 0x7) |] -derivingUnbox "SundayWeek" [t| SundayWeek -> (Year, WeekOfYear, DayOfWeek) |]- [| \ SundayWeek {..} -> (swYear, swWeek, swDay) |]- [| \ (swYear, swWeek, swDay) -> SundayWeek {..} |]+derivingUnbox "SundayWeek" [t| SundayWeek -> Int |]+ [| \ SundayWeek {..} -> shiftL swYear 9 .|. shiftL swWeek 3 .|. swDay |]+ [| \ n -> SundayWeek (shiftR n 9) (shiftR n 3 .&. 0x3f) (n .&. 0x7) |] -derivingUnbox "MondayWeek" [t| MondayWeek -> (Year, WeekOfYear, DayOfWeek) |]- [| \ MondayWeek {..} -> (mwYear, mwWeek, mwDay) |]- [| \ (mwYear, mwWeek, mwDay) -> MondayWeek {..} |]+derivingUnbox "MondayWeek" [t| MondayWeek -> Int |]+ [| \ MondayWeek {..} -> shiftL mwYear 9 .|. shiftL mwWeek 3 .|. mwDay |]+ [| \ n -> MondayWeek (shiftR n 9) (shiftR n 3 .&. 0x3f) (n .&. 0x7) |]
src/Data/Thyme/Calendar/WeekdayOfMonth.hs view
@@ -21,17 +21,18 @@ import Control.Lens import Control.Monad import Data.AffineSpace+import Data.Bits import Data.Data import Data.Thyme.Calendar import Data.Thyme.Calendar.Internal-#if __GLASGOW_HASKELL__ != 706+#if __GLASGOW_HASKELL__ == 704 import qualified Data.Vector.Generic import qualified Data.Vector.Generic.Mutable #endif import Data.Vector.Unboxed.Deriving import GHC.Generics (Generic) import System.Random-import Test.QuickCheck+import Test.QuickCheck hiding ((.&.)) data WeekdayOfMonth = WeekdayOfMonth { womYear :: {-# UNPACK #-}!Year@@ -41,9 +42,11 @@ } deriving (INSTANCES_USUAL, Show) derivingUnbox "WeekdayOfMonth"- [t| WeekdayOfMonth -> (Year, Month, Int, DayOfWeek) |]- [| \ WeekdayOfMonth {..} -> (womYear, womMonth, womNth, womDayOfWeek) |]- [| \ (womYear, womMonth, womNth, womDayOfWeek) -> WeekdayOfMonth {..} |]+ [t| WeekdayOfMonth -> Int |]+ [| \ WeekdayOfMonth {..} -> shiftL womYear 11 .|. shiftL womMonth 7+ .|. shiftL (womNth + 5) 3 .|. womDayOfWeek |]+ [| \ n -> WeekdayOfMonth (shiftR n 11) (shiftR n 7 .&. 0xf)+ (shiftR n 3 - 5) (n .&. 0x7) |] instance NFData WeekdayOfMonth
src/Data/Thyme/Clock/Internal.hs view
@@ -26,7 +26,7 @@ import Data.Ix import Data.Thyme.Internal.Micro import Data.Thyme.Calendar.Internal-#if __GLASGOW_HASKELL__ != 706+#if __GLASGOW_HASKELL__ == 704 import qualified Data.Vector.Generic import qualified Data.Vector.Generic.Mutable #endif
src/Data/Thyme/Clock/TAI.hs view
@@ -46,7 +46,7 @@ import Data.Thyme.Clock.Internal import Data.Thyme.Format.Internal import Data.Thyme.LocalTime-#if __GLASGOW_HASKELL__ != 706+#if __GLASGOW_HASKELL__ == 704 import qualified Data.Vector.Generic import qualified Data.Vector.Generic.Mutable #endif
src/Data/Thyme/Internal/Micro.hs view
@@ -21,7 +21,7 @@ import Data.Int import Data.Ix import Data.Ratio-#if __GLASGOW_HASKELL__ != 706+#if __GLASGOW_HASKELL__ == 704 import qualified Data.Vector.Generic import qualified Data.Vector.Generic.Mutable #endif
src/Data/Thyme/LocalTime.hs view
@@ -22,7 +22,9 @@ import Control.Lens import Control.Monad import Data.AffineSpace+import Data.Bits import Data.Data+import Data.Int import Data.Thyme.Internal.Micro import Data.Thyme.Calendar import Data.Thyme.Calendar.Internal@@ -30,7 +32,7 @@ import Data.Thyme.Clock.Internal import Data.Thyme.Format.Internal import qualified Data.Time as T-#if __GLASGOW_HASKELL__ != 706+#if __GLASGOW_HASKELL__ == 704 import qualified Data.Vector.Generic import qualified Data.Vector.Generic.Mutable #endif@@ -38,7 +40,7 @@ import Data.VectorSpace import GHC.Generics (Generic) import System.Random-import Test.QuickCheck+import Test.QuickCheck hiding ((.&.)) type Minutes = Int type Hours = Int@@ -129,9 +131,11 @@ , todSec :: {-# UNPACK #-}!DiffTime } deriving (INSTANCES_USUAL) -derivingUnbox "TimeOfDay" [t| TimeOfDay -> (Hour, Minute, DiffTime) |]- [| \ TimeOfDay {..} -> (todHour, todMin, todSec) |]- [| \ (todHour, todMin, todSec) -> TimeOfDay {..} |]+derivingUnbox "TimeOfDay" [t| TimeOfDay -> Int64 |]+ [| \ TimeOfDay {..} -> fromIntegral (todHour .|. shiftL todMin 8)+ .|. shiftL (todSec ^. microseconds) 16 |]+ [| \ n -> TimeOfDay (fromIntegral $ n .&. 0xff)+ (fromIntegral $ shiftR n 8 .&. 0xff) (microseconds # shiftR n 16) |] instance NFData TimeOfDay
thyme.cabal view
@@ -1,5 +1,5 @@ name: thyme-version: 0.3.5.0+version: 0.3.5.1 synopsis: A faster time library description: Thyme is a rewrite of the fine @time@ library, with a particular focus@@ -92,7 +92,7 @@ text >= 0.11, time >= 1.4, vector >= 0.9,- vector-th-unbox >= 0.2,+ vector-th-unbox >= 0.2.1.0, vector-space >= 0.8 if os(windows) build-depends: Win32