deepseq 1.4.1.2 → 1.4.2.0
raw patch · 3 files changed
+216/−66 lines, 3 filesdep ~HUnitdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: HUnit, base
API changes (from Hackage documentation)
- Control.DeepSeq: instance (GHC.Arr.Ix a, Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (GHC.Arr.Array a b)
- Control.DeepSeq: instance (GHC.Real.Integral a, Control.DeepSeq.NFData a) => Control.DeepSeq.NFData (GHC.Real.Ratio a)
- Control.DeepSeq: instance Control.DeepSeq.NFData (Data.Proxy.Proxy a)
- Control.DeepSeq: instance Control.DeepSeq.NFData Data.Typeable.Internal.TyCon
- Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Control.Applicative.Const a b)
+ Control.DeepSeq: instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (Data.Semigroup.Arg a b)
+ Control.DeepSeq: instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData b) => Control.DeepSeq.NFData (GHC.Arr.Array a b)
+ Control.DeepSeq: instance Control.DeepSeq.NFData (GHC.IORef.IORef a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData (GHC.MVar.MVar a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData (GHC.Ptr.FunPtr a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData (GHC.Ptr.Ptr a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData (GHC.STRef.STRef s a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData GHC.IO.Exception.ExitCode
+ Control.DeepSeq: instance Control.DeepSeq.NFData GHC.Stack.Types.CallStack
+ Control.DeepSeq: instance Control.DeepSeq.NFData GHC.Stack.Types.SrcLoc
+ Control.DeepSeq: instance Control.DeepSeq.NFData GHC.Types.TyCon
+ Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.List.NonEmpty.NonEmpty a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Semigroup.First a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Semigroup.Last a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Semigroup.Max a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Semigroup.Min a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Semigroup.Option a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (GHC.Real.Ratio a)
+ Control.DeepSeq: instance Control.DeepSeq.NFData m => Control.DeepSeq.NFData (Data.Semigroup.WrappedMonoid m)
+ Control.DeepSeq: instance forall k (a :: k). Control.DeepSeq.NFData (Data.Proxy.Proxy a)
+ Control.DeepSeq: instance forall k a (b :: k). Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Data.Functor.Const.Const a b)
- Control.DeepSeq: class NFData a
+ Control.DeepSeq: class NFData a where rnf = grnf . from
- Control.DeepSeq: rnf :: NFData a => a -> ()
+ Control.DeepSeq: rnf :: (NFData a, Generic a, GNFData (Rep a)) => a -> ()
Files
- Control/DeepSeq.hs +185/−62
- changelog.md +22/−0
- deepseq.cabal +9/−4
Control/DeepSeq.hs view
@@ -8,6 +8,9 @@ {-# LANGUAGE Safe #-} # endif #endif+#if __GLASGOW_HASKELL__ >= 706+{-# LANGUAGE PolyKinds #-}+#endif ----------------------------------------------------------------------------- -- | -- Module : Control.DeepSeq@@ -51,14 +54,16 @@ -- thread, before passing to another thread (preventing work moving to -- the wrong threads). ----- /Since: 1.1.0.0/+-- @since 1.1.0.0 module Control.DeepSeq ( deepseq, ($!!), force, NFData(..), ) where import Control.Applicative-import Control.Concurrent ( ThreadId )+import Control.Concurrent ( ThreadId, MVar )+import Data.IORef+import Data.STRef import Data.Int import Data.Word import Data.Ratio@@ -66,9 +71,11 @@ import Data.Array import Data.Fixed import Data.Version-import Data.Monoid+import Data.Monoid as Mon import Data.Unique ( Unique )+import Foreign.Ptr import Foreign.C.Types+import System.Exit ( ExitCode(..) ) import System.Mem.StableName ( StableName ) #if MIN_VERSION_base(4,6,0)@@ -86,6 +93,18 @@ import Numeric.Natural ( Natural ) #endif +#if MIN_VERSION_base(4,9,0)+import Data.List.NonEmpty ( NonEmpty (..) )+import Data.Semigroup as Semi+#endif++#if MIN_VERSION_base(4,9,0)+import GHC.Stack.Types ( CallStack(..), SrcLoc(..) )+#elif MIN_VERSION_base(4,8,1)+import GHC.Stack ( CallStack(..) )+import GHC.SrcLoc ( SrcLoc(..) )+#endif+ #if __GLASGOW_HASKELL__ >= 702 import GHC.Fingerprint.Type ( Fingerprint(..) ) import GHC.Generics@@ -139,14 +158,14 @@ -- evaluation, use 'pseq' from "Control.Parallel" in the -- @parallel@ package. ----- /Since: 1.1.0.0/+-- @since 1.1.0.0 deepseq :: NFData a => a -> b -> b deepseq a b = rnf a `seq` b -- | the deep analogue of '$!'. In the expression @f $!! x@, @x@ is -- fully evaluated before the function @f@ is applied to it. ----- /Since: 1.2.0.0/+-- @since 1.2.0.0 ($!!) :: (NFData a) => (a -> b) -> a -> b f $!! x = x `deepseq` f x @@ -179,13 +198,13 @@ -- > {- 'result' will be fully evaluated at this point -} -- > return () ----- /Since: 1.2.0.0/+-- @since 1.2.0.0 force :: (NFData a) => a -> a force x = x `deepseq` x -- | A class of types that can be fully evaluated. ----- /Since: 1.1.0.0/+-- @since 1.1.0.0 class NFData a where -- | 'rnf' should reduce its argument to normal form (that is, fully -- evaluate all sub-components), and then return '()'.@@ -273,32 +292,32 @@ instance NFData Word64 where rnf !_ = () #if MIN_VERSION_base(4,7,0)--- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData (Proxy a) where rnf Proxy = () #endif #if MIN_VERSION_base(4,8,0)--- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData a => NFData (Identity a) where rnf = rnf . runIdentity -- | Defined as @'rnf' = 'absurd'@. ----- /Since: 1.4.0.0/+-- @since 1.4.0.0 instance NFData Void where rnf = absurd --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData Natural where rnf !_ = () #endif --- |/Since: 1.3.0.0/+-- |@since 1.3.0.0 instance NFData (Fixed a) where rnf !_ = () -- |This instance is for convenience and consistency with 'seq'. -- This assumes that WHNF is equivalent to NF for functions. ----- /Since: 1.3.0.0/+-- @since 1.3.0.0 instance NFData (a -> b) where rnf !_ = () --Rational and complex numbers.@@ -327,7 +346,7 @@ rnf (Left x) = rnf x rnf (Right y) = rnf y --- |/Since: 1.3.0.0/+-- |@since 1.3.0.0 instance NFData Data.Version.Version where rnf (Data.Version.Version branch tags) = rnf branch `seq` rnf tags @@ -335,11 +354,11 @@ rnf [] = () rnf (x:xs) = rnf x `seq` rnf xs --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData a => NFData (ZipList a) where rnf = rnf . getZipList --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData a => NFData (Const a b) where rnf = rnf . getConst @@ -351,164 +370,268 @@ rnf x = rnf (bounds x, Data.Array.elems x) #if MIN_VERSION_base(4,6,0)--- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData a => NFData (Down a) where rnf (Down x) = rnf x #endif --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData a => NFData (Dual a) where rnf = rnf . getDual --- |/Since: 1.4.0.0/-instance NFData a => NFData (First a) where- rnf = rnf . getFirst+-- |@since 1.4.0.0+instance NFData a => NFData (Mon.First a) where+ rnf = rnf . Mon.getFirst --- |/Since: 1.4.0.0/-instance NFData a => NFData (Last a) where- rnf = rnf . getLast+-- |@since 1.4.0.0+instance NFData a => NFData (Mon.Last a) where+ rnf = rnf . Mon.getLast --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData Any where rnf = rnf . getAny --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData All where rnf = rnf . getAll --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData a => NFData (Sum a) where rnf = rnf . getSum --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData a => NFData (Product a) where rnf = rnf . getProduct --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData (StableName a) where rnf !_ = () -- assumes `data StableName a = StableName (StableName# a)` --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData ThreadId where rnf !_ = () -- assumes `data ThreadId = ThreadId ThreadId#` --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData Unique where rnf !_ = () -- assumes `newtype Unique = Unique Integer` #if MIN_VERSION_base(4,8,0) -- | __NOTE__: Only defined for @base-4.8.0.0@ and later ----- /Since: 1.4.0.0/+-- @since 1.4.0.0 instance NFData TypeRep where rnf tyrep = rnfTypeRep tyrep -- | __NOTE__: Only defined for @base-4.8.0.0@ and later ----- /Since: 1.4.0.0/+-- @since 1.4.0.0 instance NFData TyCon where rnf tycon = rnfTyCon tycon #endif +-- | __NOTE__: Only strict in the reference and not the referenced value.+--+-- @since 1.4.2.0+instance NFData (IORef a) where+ rnf !_ = ()++-- | __NOTE__: Only strict in the reference and not the referenced value.+--+-- @since 1.4.2.0+instance NFData (STRef s a) where+ rnf !_ = ()++-- | __NOTE__: Only strict in the reference and not the referenced value.+--+-- @since 1.4.2.0+instance NFData (MVar a) where+ rnf !_ = ()+ ---------------------------------------------------------------------------- -- GHC Specifics #if __GLASGOW_HASKELL__ >= 702--- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData Fingerprint where rnf (Fingerprint _ _) = () #endif ----------------------------------------------------------------------------+-- Foreign.Ptr++-- |@since 1.4.2.0+instance NFData (Ptr a) where rnf !_ = ()++-- |@since 1.4.2.0+instance NFData (FunPtr a) where rnf !_ = ()++---------------------------------------------------------------------------- -- Foreign.C.Types --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CChar where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CSChar where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CUChar where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CShort where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CUShort where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CInt where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CUInt where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CLong where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CULong where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CPtrdiff where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CSize where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CWchar where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CSigAtomic where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CLLong where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CULLong where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CIntPtr where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CUIntPtr where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CIntMax where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CUIntMax where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CClock where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CTime where rnf !_ = () #if MIN_VERSION_base(4,4,0)--- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CUSeconds where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CSUSeconds where rnf !_ = () #endif --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CFloat where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CDouble where rnf !_ = () -- NOTE: The types `CFile`, `CFPos`, and `CJmpBuf` below are not -- newtype wrappers rather defined as field-less single-constructor -- types. --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CFile where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CFpos where rnf !_ = () --- |/Since: 1.4.0.0/+-- |@since 1.4.0.0 instance NFData CJmpBuf where rnf !_ = ()++----------------------------------------------------------------------------+-- System.Exit++-- |@since 1.4.2.0+instance NFData ExitCode where+ rnf (ExitFailure n) = rnf n+ rnf ExitSuccess = ()++----------------------------------------------------------------------------+-- instances previously provided by semigroups package++#if MIN_VERSION_base(4,9,0)+-- |@since 1.4.2.0+instance NFData a => NFData (NonEmpty a) where+ rnf (x :| xs) = rnf x `seq` rnf xs++-- |@since 1.4.2.0+instance NFData a => NFData (Min a) where+ rnf (Min a) = rnf a++-- |@since 1.4.2.0+instance NFData a => NFData (Max a) where+ rnf (Max a) = rnf a++-- |@since 1.4.2.0+instance (NFData a, NFData b) => NFData (Arg a b) where+ rnf (Arg a b) = rnf a `seq` rnf b `seq` ()++-- |@since 1.4.2.0+instance NFData a => NFData (Semi.First a) where+ rnf (Semi.First a) = rnf a++-- |@since 1.4.2.0+instance NFData a => NFData (Semi.Last a) where+ rnf (Semi.Last a) = rnf a++-- |@since 1.4.2.0+instance NFData m => NFData (WrappedMonoid m) where+ rnf (WrapMonoid a) = rnf a++-- |@since 1.4.2.0+instance NFData a => NFData (Option a) where+ rnf (Option a) = rnf a+#endif++----------------------------------------------------------------------------+-- GHC.Stack++#if MIN_VERSION_base(4,9,0)+-- |@since 1.4.2.0+instance NFData SrcLoc where+ rnf (SrcLoc a b c d e f g) = rnf a `seq` rnf b `seq` rnf c `seq`+ rnf d `seq` rnf e `seq` rnf f `seq` rnf g++-- |@since 1.4.2.0+instance NFData CallStack where+ rnf EmptyCallStack = ()+ rnf (PushCallStack a b c) = rnf a `seq` rnf b `seq` rnf c+ rnf (FreezeCallStack a) = rnf a++#elif MIN_VERSION_base(4,8,1)+-- |@since 1.4.2.0+instance NFData SrcLoc where+ -- base-4.8 didn't expose the 'SrcLoc' constructor+ rnf sl = rnf (srcLocPackage sl) `seq`+ rnf (srcLocModule sl) `seq`+ rnf (srcLocFile sl) `seq`+ rnf (srcLocStartLine sl) `seq`+ rnf (srcLocStartCol sl) `seq`+ rnf (srcLocEndLine sl) `seq`+ rnf (srcLocEndCol sl)++-- |@since 1.4.2.0+instance NFData CallStack where+ rnf = rnf . getCallStack+#endif ---------------------------------------------------------------------------- -- Tuples
changelog.md view
@@ -1,5 +1,27 @@ # Changelog for [`deepseq` package](http://hackage.haskell.org/package/deepseq) +## 1.4.2.0 *Apr 2016*++ * Bundled with GHC 8.0.1++ * New instances for types provided by `semigroups` prior to+ `base-4.9` (i.e. `NonEmpty`, `Min`, `Max`, `Arg`,+ `Semigroup.First`, `Semigroup.Last`, `WrappedMonoid`, and+ `Option`) ([#11](https://github.com/haskell/deepseq/issues/11))++ * New instances for `Ptr` and `FunPtr`+ ([#10](https://github.com/haskell/deepseq/pull/10))++ * New instances for `IORef`, `STRef`, and `MVar`+ ([#6](https://github.com/haskell/deepseq/issues/6))++ * New instance for `ExitCode`+ ([#4](https://github.com/haskell/deepseq/issues/4))++ * New instances for `CallStack` and `SrcLoc`++ * Make `NFData (Proxy a)` instance poly-kinded+ ## 1.4.1.2 *Aug 2015* * Avoid the broken combination of GHC-7.2 with `array>=0.4`
deepseq.cabal view
@@ -1,5 +1,5 @@ name: deepseq-version: 1.4.1.2+version: 1.4.2.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE@@ -22,7 +22,12 @@ data types. build-type: Simple cabal-version: >=1.10-tested-with: GHC==7.11.*, GHC==7.10.1, GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1+tested-with: GHC==8.0.1,+ GHC==7.10.3, GHC==7.10.2, GHC==7.10.1,+ GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1,+ GHC==7.6.3, GHC==7.6.2, GHC==7.6.1,+ GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1,+ GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 extra-source-files: changelog.md @@ -51,7 +56,7 @@ if impl(ghc < 7.4) build-depends: array < 0.4 - build-depends: base >= 4.3 && < 4.9,+ build-depends: base >= 4.3 && < 4.10, array >= 0.3 && < 0.6 ghc-options: -Wall @@ -84,4 +89,4 @@ -- end of packages with inherited version constraints test-framework == 0.8.*, test-framework-hunit == 0.3.*,- HUnit == 1.2.*+ HUnit >= 1.2 && < 1.4