[commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add support for `deepseq-1.4.0.0` (e6d887a)

git at git.haskell.org git at git.haskell.org
Fri Apr 21 16:53:12 UTC 2017


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

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

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

commit e6d887a4eb63a9971ba86d84222e809f3c20373c
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Fri Nov 14 18:19:36 2014 +0100

    Add support for `deepseq-1.4.0.0`
    
    `deepseq-1.4.0.0`'s major change is the default `rnf` method implementation
    (see haskell/deepseq#1 for details).
    
    This commit changes `time` not to rely on the default implementation and
    instead explicitly make use of `seq` like the old default implementation did.


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

e6d887a4eb63a9971ba86d84222e809f3c20373c
 lib/Data/Time/Clock/Scale.hs | 3 ++-
 lib/Data/Time/Clock/UTC.hs   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs
index 8ba7759..def28ce 100644
--- a/lib/Data/Time/Clock/Scale.hs
+++ b/lib/Data/Time/Clock/Scale.hs
@@ -50,7 +50,8 @@ newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord
     )
 
 -- necessary because H98 doesn't have "cunning newtype" derivation
-instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing
+instance NFData DiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing
+        rnf dt = seq dt ()
 
 -- necessary because H98 doesn't have "cunning newtype" derivation
 instance Enum DiffTime where
diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs
index d41b8f8..4cb9447 100644
--- a/lib/Data/Time/Clock/UTC.hs
+++ b/lib/Data/Time/Clock/UTC.hs
@@ -70,7 +70,8 @@ newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord
     )
 
 -- necessary because H98 doesn't have "cunning newtype" derivation
-instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing
+instance NFData NominalDiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing
+        rnf ndt = seq ndt ()
 
 instance Enum NominalDiffTime where
 	succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a)



More information about the ghc-commits mailing list