deepseq 1.4.0.0 → 1.4.1.0
raw patch · 3 files changed
+42/−6 lines, 3 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Control.DeepSeq: instance [safe] (RealFloat a, NFData a) => NFData (Complex a)
+ Control.DeepSeq: instance [safe] NFData a => NFData (Complex a)
Files
- Control/DeepSeq.hs +35/−4
- changelog.md +6/−1
- deepseq.cabal +1/−1
Control/DeepSeq.hs view
@@ -81,8 +81,7 @@ #if MIN_VERSION_base(4,8,0) import Data.Functor.Identity ( Identity(..) )--- NB: Data.Typeable.Internal is "Trustworthy" only starting w/ base-4.8-import Data.Typeable.Internal ( TypeRep(..), TyCon(..) )+import Data.Typeable ( TypeRep, TyCon, rnfTypeRep, rnfTyCon ) import Data.Void ( Void, absurd ) import Numeric.Natural ( Natural ) #endif@@ -160,6 +159,26 @@ -- itself is demanded, so essentially it turns shallow evaluation into -- deep evaluation. --+-- 'force' can be conveniently used in combination with @ViewPatterns@:+--+-- > {-# LANGUAGE BangPatterns, ViewPatterns #-}+-- > import Control.DeepSeq+-- >+-- > someFun :: ComplexData -> SomeResult+-- > someFun (force -> !arg) = {- 'arg' will be fully evaluated -}+--+-- Another useful application is to combine 'force' with+-- 'Control.Exception.evaluate' in order to force deep evaluation+-- relative to other 'IO' operations:+--+-- > import Control.Exception (evaluate)+-- > import Control.DeepSeq+-- >+-- > main = do+-- > result <- evaluate $ force $ pureComputation+-- > {- 'result' will be fully evaluated at this point -}+-- > return ()+-- -- /Since: 1.2.0.0/ force :: (NFData a) => a -> a force x = x `deepseq` x@@ -284,10 +303,18 @@ --Rational and complex numbers. +#if __GLASGOW_HASKELL__ >= 711+instance NFData a => NFData (Ratio a) where+#else instance (Integral a, NFData a) => NFData (Ratio a) where+#endif rnf x = rnf (numerator x, denominator x) +#if MIN_VERSION_base(4,4,0)+instance (NFData a) => NFData (Complex a) where+#else instance (RealFloat a, NFData a) => NFData (Complex a) where+#endif rnf (x:+y) = rnf x `seq` rnf y `seq` ()@@ -316,7 +343,11 @@ instance NFData a => NFData (Const a b) where rnf = rnf . getConst +#if __GLASGOW_HASKELL__ >= 711+instance (NFData a, NFData b) => NFData (Array a b) where+#else instance (Ix a, NFData a, NFData b) => NFData (Array a b) where+#endif rnf x = rnf (bounds x, Data.Array.elems x) #if MIN_VERSION_base(4,6,0)@@ -368,13 +399,13 @@ -- -- /Since: 1.4.0.0/ instance NFData TypeRep where- rnf (TypeRep _ tycon tyrep) = rnf tycon `seq` rnf tyrep+ rnf tyrep = rnfTypeRep tyrep -- | __NOTE__: Only defined for @base-4.8.0.0@ and later -- -- /Since: 1.4.0.0/ instance NFData TyCon where- rnf (TyCon _ tcp tcm tcn) = rnf tcp `seq` rnf tcm `seq` rnf tcn+ rnf tycon = rnfTyCon tycon #endif ----------------------------------------------------------------------------
changelog.md view
@@ -1,8 +1,13 @@ # Changelog for [`deepseq` package](http://hackage.haskell.org/package/deepseq) -## 1.4.0.0 *Dec 2014*+## 1.4.1.0 *Mar 2015* * Bundled with GHC 7.10.1+ * Drop redundant constraints from a few `NFData` instances (if+ possible for a given `base` version)++## 1.4.0.0 *Dec 2014*+ * Switch to Generics based `DefaultSignature` `rnf` method implementation (based on code from `deepseq-generics`)
deepseq.cabal view
@@ -1,5 +1,5 @@ name: deepseq-version: 1.4.0.0+version: 1.4.1.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE