packages feed

deepseq-generics 0.1.1.2 → 0.2.0.1

raw patch · 5 files changed

Files

Control/DeepSeq/Generics.hs view
@@ -9,12 +9,6 @@ -- Stability:   stable -- Portability: GHC ----- Beyond the primary scope of providing the 'genericRnf' helper, this--- module also re-exports the definitions from "Control.DeepSeq" for--- convenience. If this poses any problems, just use qualified or--- explicit import statements (see code usage example in the--- 'genericRnf' description)--- -- __NOTE__: Starting with @deepseq-1.4.0.0@, 'NFData' gained support -- for generic derivation via @DefaultSignatures@. The new default -- 'rnf' method implementation is then equivalent to@@ -30,11 +24,6 @@ module Control.DeepSeq.Generics     ( genericRnf     , genericRnfV1-      -- * "Control.DeepSeq" re-exports-    , deepseq-    , force-    , NFData(rnf)-    , ($!!)     ) where  import Control.DeepSeq@@ -82,7 +71,7 @@ -- > instance NFData a => NFData (Bar a) where rnf = genericRnf -- -- __NOTE__: The 'GNFData' type-class showing up in the type-signature is---       used internally and not exported on purpose currently.+--           used internally and not exported.  genericRnf :: (Generic a, GNFData (Rep a)) => a -> () genericRnf = grnf_ . from@@ -97,26 +86,24 @@     grnf_ :: f a -> ()  instance GNFData U1 where-    grnf_ !U1 = ()-    {-# INLINE grnf_ #-}+    grnf_ U1 = ()  instance NFData a => GNFData (K1 i a) where     grnf_ = rnf . unK1-    {-# INLINE grnf_ #-}+    {-# INLINEABLE grnf_ #-}  instance GNFData a => GNFData (M1 i c a) where     grnf_ = grnf_ . unM1-    {-# INLINE grnf_ #-}+    {-# INLINEABLE grnf_ #-}  instance (GNFData a, GNFData b) => GNFData (a :*: b) where     grnf_ (x :*: y) = grnf_ x `seq` grnf_ y-    {-# INLINE grnf_ #-}+    {-# INLINEABLE grnf_ #-}  instance (GNFData a, GNFData b) => GNFData (a :+: b) where     grnf_ (L1 x) = grnf_ x     grnf_ (R1 x) = grnf_ x-    {-# INLINE grnf_ #-}-+    {-# INLINEABLE grnf_ #-}  -- | Variant of 'genericRnf' which supports derivation for uninhabited types. --@@ -136,9 +123,15 @@ -- >     In an equation for `it': it = genericRnf (undefined :: TagFoo) -- > -- > Prelude> genericRnfV1 (undefined :: TagFoo)--- > *** Exception: Control.DeepSeq.Generics.genericRnfV1: NF not defined for uninhabited types+-- > *** Exception: Control.DeepSeq.Generics.genericRnfV1: uninhabited type ----- /Since: 0.1.1.0/+-- 'genericRnfV1' corresponds to @deepseq-1.4.0.0@'s default @rnf@+-- method implementation.+--+-- __NOTE__: The 'GNFDataV1' type-class showing up in the type-signature is+--           used internally and not exported.+--+-- @since 0.1.1.0 genericRnfV1 :: (Generic a, GNFDataV1 (Rep a)) => a -> () genericRnfV1 = grnfV1_ . from {-# INLINE genericRnfV1 #-}@@ -148,25 +141,24 @@     grnfV1_ :: f a -> ()  instance GNFDataV1 V1 where-    grnfV1_ = error "Control.DeepSeq.Generics.genericRnfV1: NF not defined for uninhabited types"+    grnfV1_ = error "Control.DeepSeq.Generics.genericRnfV1: uninhabited type"  instance GNFDataV1 U1 where-    grnfV1_ !U1 = ()-    {-# INLINE grnfV1_ #-}+    grnfV1_ U1 = ()  instance NFData a => GNFDataV1 (K1 i a) where     grnfV1_ = rnf . unK1-    {-# INLINE grnfV1_ #-}+    {-# INLINEABLE grnfV1_ #-}  instance GNFDataV1 a => GNFDataV1 (M1 i c a) where     grnfV1_ = grnfV1_ . unM1-    {-# INLINE grnfV1_ #-}+    {-# INLINEABLE grnfV1_ #-}  instance (GNFDataV1 a, GNFDataV1 b) => GNFDataV1 (a :*: b) where     grnfV1_ (x :*: y) = grnfV1_ x `seq` grnfV1_ y-    {-# INLINE grnfV1_ #-}+    {-# INLINEABLE grnfV1_ #-}  instance (GNFDataV1 a, GNFDataV1 b) => GNFDataV1 (a :+: b) where     grnfV1_ (L1 x) = grnfV1_ x     grnfV1_ (R1 x) = grnfV1_ x-    {-# INLINE grnfV1_ #-}+    {-# INLINEABLE grnfV1_ #-}
− changelog
@@ -1,17 +0,0 @@--*-change-log-*---0.1.1.2 Herbert Valerio Riedel  <hvr@gnu.org>  November 2013--	* Add support for GHC 7.10 and `deepseq-1.4.0.0`--0.1.1.1 Herbert Valerio Riedel  <hvr@gnu.org>  November 2013--	* Add support for GHC 7.8--0.1.1.0 Herbert Valerio Riedel  <hvr@gnu.org>  September 2013--	* Control/DeepSeq/Generics.hs (genericRnfV1): New Function--0.1.0.0 Herbert Valerio Riedel  <hvr@gnu.org>  September 2012--	* Initial Release
+ changelog.md view
@@ -0,0 +1,26 @@+## 0.2.0.1  August 2025++ * Drop support for GHC 7+ * Tested with GHC 8.0 - 9.14 alpha1++## 0.2.0.0  January 2016++ * Add support for GHC 8.0+ * Remove re-exports from `deepseq:Control.DeepSeq`+ * Synchronise implementation to `deepseq-1.4.0.0`'s code++## 0.1.1.2  December 2014++ * Add support for GHC 7.10 and `deepseq-1.4.0.0`++## 0.1.1.1  November 2013++ * Add support for GHC 7.8++## 0.1.1.0  September 2013++ * New Function `Control.DeepSeq.Generics.genericRnfV1`++## 0.1.0.0  September 2012++ * Initial Release
deepseq-generics.cabal view
@@ -1,17 +1,34 @@+cabal-version:       1.18 name:                deepseq-generics-version:             0.1.1.2+version:             0.2.0.1+ synopsis:            GHC.Generics-based Control.DeepSeq.rnf implementation-homepage:            https://github.com/hvr/deepseq-generics-bug-reports:         https://github.com/hvr/deepseq-generics/issues+homepage:            https://github.com/haskell-hvr/deepseq-generics+bug-reports:         https://github.com/haskell-hvr/deepseq-generics/issues license:             BSD3 license-file:        LICENSE author:              Herbert Valerio Riedel-maintainer:          hvr@gnu.org+maintainer:          https://github.com/haskell-hvr copyright:           2012, Herbert Valerio Riedel category:            Control build-type:          Simple-cabal-version:       >=1.10-tested-with:         GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1++tested-with:+  GHC == 9.14.1+  GHC == 9.12.2+  GHC == 9.10.2+  GHC == 9.8.4+  GHC == 9.6.7+  GHC == 9.4.8+  GHC == 9.2.8+  GHC == 9.0.2+  GHC == 8.10.7+  GHC == 8.8.4+  GHC == 8.6.5+  GHC == 8.4.4+  GHC == 8.2.2+  GHC == 8.0.2+ description:     This package provides a "GHC.Generics"-based     'Control.DeepSeq.Generics.genericRnf' function which can be used@@ -26,23 +43,24 @@     This package differs from the @generic-deepseq@ package by working     in combination with the existing @deepseq@ package as opposed to     defining a conflicting drop-in replacement for @deepseq@'s-    @Control.Deepseq@ module.+    @Control.DeepSeq@ module.     .-    Note: The ability to auto-derive via "GHC.Generics" has been+    __Note__: The ability to auto-derive via "GHC.Generics" has been     merged into @deepseq-1.4.0.0@. This package is now still useful     for writing code that's also compatible with older @deepseq@     versions not yet providing "GHC.Generics"-support. -extra-source-files: changelog+extra-doc-files: changelog.md  source-repository head     type:     git-    location: https://github.com/hvr/deepseq-generics.git+    location: https://github.com/haskell-hvr/deepseq-generics.git  library     default-language:    Haskell2010     exposed-modules:     Control.DeepSeq.Generics-    build-depends:       base >= 4.5 && < 4.9, ghc-prim >= 0.2 && < 0.4, deepseq >= 1.2.0.1 && < 1.5+    build-depends:       base     >= 4.9     && < 5+                       , deepseq  >= 1.2.0.1 && < 1.6     other-extensions:    BangPatterns, FlexibleContexts, TypeOperators     ghc-options:         -Wall @@ -51,15 +69,14 @@     type:                exitcode-stdio-1.0     hs-source-dirs:      test     main-is:             Suite.hs-    other-extensions:    CPP, DeriveDataTypeable, DeriveGeneric, TupleSections+    other-extensions:    CPP, DeriveGeneric, TupleSections     ghc-options:         -Wall      build-depends:-        base,-        deepseq,-        deepseq-generics,-        ghc-prim,+        base+      , deepseq+      , deepseq-generics         -- end of packages with inherited version constraints-        test-framework,-        test-framework-hunit,-        HUnit+      , test-framework       >= 0.6.1 && < 0.9+      , test-framework-hunit >= 0.2.2 && < 0.9+      , HUnit                >= 1.2.5 && < 1.7
test/Suite.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, TupleSections, DeriveDataTypeable, DeriveGeneric #-}+{-# LANGUAGE CPP, TupleSections, DeriveGeneric #-}  module Main (main) where @@ -8,7 +8,6 @@ import Control.Monad import Data.Bits import Data.IORef-import Data.Typeable import Data.Word import GHC.Generics import System.IO.Unsafe (unsafePerformIO)@@ -21,16 +20,6 @@ -- IUT import Control.DeepSeq.Generics --- needed for GHC-7.4 compatibility-#if !MIN_VERSION_base(4,6,0)-atomicModifyIORef' :: IORef a -> (a -> (a,b)) -> IO b-atomicModifyIORef' ref f = do-    b <- atomicModifyIORef ref-            (\x -> let (a, b) = f x-                    in (a, a `seq` b))-    b `seq` return b-#endif- ---------------------------------------------------------------------------- -- simple hacky abstraction for testing forced evaluation via `rnf`-like functions @@ -72,7 +61,7 @@     {-# NOINLINE rnf #-}  -- |Exception to be thrown for testing 'seq'/'rnf'-data RnfEx = RnfEx deriving (Eq, Show, Typeable)+data RnfEx = RnfEx deriving (Eq, Show)  instance Exception RnfEx