packages feed

deepseq 1.5.0.0 → 1.5.1.0

raw patch · 3 files changed

+69/−14 lines, 3 filesdep −arraydep ~basePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: array

Dependency ranges changed: base

API changes (from Hackage documentation)

- Control.DeepSeq: instance Control.DeepSeq.NFData Data.Void.Void
+ Control.DeepSeq: Unit :: () -> Unit
+ Control.DeepSeq: [runUnit] :: Unit -> ()
+ Control.DeepSeq: instance Control.DeepSeq.NFData (Data.Array.Byte.MutableByteArray s)
+ Control.DeepSeq: instance Control.DeepSeq.NFData Data.Array.Byte.ByteArray
+ Control.DeepSeq: instance Control.DeepSeq.NFData GHC.Base.Void
+ Control.DeepSeq: instance GHC.Base.Monoid Control.DeepSeq.Unit
+ Control.DeepSeq: instance GHC.Base.Semigroup Control.DeepSeq.Unit
+ Control.DeepSeq: newtype Unit

Files

Control/DeepSeq.hs view
@@ -6,7 +6,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE QuantifiedConstraints #-}-{-# LANGUAGE Safe #-}+{-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} @@ -78,6 +78,7 @@   ($!!),   (<$!!>),   rwhnf,+  Unit(..),    -- * Liftings of the 'NFData' class @@ -93,7 +94,6 @@ import Control.Applicative import Control.Concurrent (MVar, ThreadId) import Control.Exception (MaskingState (..))-import Data.Array import Data.Complex import Data.Fixed import Data.Functor.Compose@@ -117,6 +117,8 @@ import Data.Word import Foreign.C.Types import Foreign.Ptr+import GHC.Arr (Array)+import qualified GHC.Arr import GHC.Fingerprint.Type (Fingerprint (..)) import GHC.Generics import GHC.Stack.Types (CallStack (..), SrcLoc (..))@@ -214,14 +216,19 @@ 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.+-- | The deep analogue of '$!'.  @f $!! x@ fully evaluates @x@+-- before returning @f x@. --+-- There is no guarantee about the ordering of evaluation.+-- @f x@ may be evaluated before @x@ is fully evaluated.+-- To impose an actual order on evaluation, use 'pseq' from+-- "Control.Parallel" in the @parallel@ package.+-- -- @since 1.2.0.0 ($!!) :: (NFData a) => (a -> b) -> a -> b f $!! x = x `deepseq` f x --- | a variant of 'deepseq' that is useful in some circumstances:+-- | A variant of 'deepseq' that is useful in some circumstances: -- -- > force x = x `deepseq` x --@@ -397,6 +404,45 @@ rnf2 :: (NFData2 p, NFData a, NFData b) => p a b -> () rnf2 = liftRnf2 rnf rnf +-- | A monoid with @(<>) = seq@.+--+-- Its purpose is to allow reducing structures to normal form using+-- 'foldMap'-like functions.+--+-- ==== __Examples__+--+-- @+-- data Three a = Three a a a+--+-- instance Foldable Three where+--   foldMap f (Three x1 x2 x3) = f x1 <> f x2 <> f x3+--+-- instance NFData a => NFData (Three a) where+--   rnf = runUnit . foldMap (Unit . rnf)+-- @+--+-- @+-- data Tree a b+--   = NodeA a [Tree a b]+--   | NodeB b [Tree a b]+--+-- foldMapTree :: Monoid m => (a -> m) -> (b -> m) -> Tree a b -> m+-- foldMapTree f g = go+--   where+--     go (NodeA x ts) = f x <> foldMap go ts+--     go (NodeB y ts) = g y <> foldMap go ts+--+-- instance NFData2 Tree where+--   liftRnf2 r r' = runUnit . foldMapTree (Unit . r) (Unit . r')+-- @+newtype Unit = Unit { runUnit :: () }++instance Semigroup Unit where+  (<>) = seq++instance Monoid Unit where+  mempty = Unit ()+ instance NFData Int where rnf = rwhnf  instance NFData Word where rnf = rwhnf@@ -583,15 +629,16 @@ -- We should use MIN_VERSION array(0,5,1,1) but that's not possible. -- There isn't an underscore to not break C preprocessor instance (NFData a, NFData b) => NFData (Array a b) where-  rnf x = rnf (bounds x, Data.Array.elems x)+  rnf x = rnf (GHC.Arr.bounds x, GHC.Arr.elems x)  -- | @since 1.4.3.0 instance (NFData a) => NFData1 (Array a) where-  liftRnf r x = rnf (bounds x) `seq` liftRnf r (Data.Array.elems x)+  liftRnf r x = rnf (GHC.Arr.bounds x) `seq` liftRnf r (GHC.Arr.elems x)  -- | @since 1.4.3.0 instance NFData2 Array where-  liftRnf2 r r' x = liftRnf2 r r (bounds x) `seq` liftRnf r' (Data.Array.elems x)+  liftRnf2 r r' x =+    liftRnf2 r r (GHC.Arr.bounds x) `seq` liftRnf r' (GHC.Arr.elems x)  -- | @since 1.4.0.0 instance NFData a => NFData (Down a) where rnf = rnf1
changelog.md view
@@ -4,6 +4,13 @@   +## 1.5.1.0++  * Add Unit monoid with `seq`+    ([#18](https://github.com/haskell/deepseq/issues/18), [#105](https://github.com/haskell/deepseq/issues/105))+  * Drop the dependency on `array`+    ([#102](https://github.com/haskell/deepseq/issues/102), [#107](https://github.com/haskell/deepseq/issues/107))+ ## 1.5.0.0    * Add quantified superclasses to NFData(1,2)
deepseq.cabal view
@@ -1,6 +1,6 @@ cabal-version:  1.12 name:           deepseq-version:        1.5.0.0+version:        1.5.1.0 -- NOTE: Don't forget to update ./changelog.md  license:        BSD3@@ -26,8 +26,11 @@  build-type:     Simple tested-with:-  GHC==9.4.3,-  GHC==9.2.5,+  GHC==9.10.1,+  GHC==9.8.2,+  GHC==9.6.6,+  GHC==9.4.8,+  GHC==9.2.8,   GHC==9.0.2,   GHC==8.10.7,   GHC==8.8.4,@@ -58,8 +61,7 @@   if impl(ghc >=9.0)     build-depends: ghc-prim -  build-depends: base       >= 4.12 && < 4.20,-                 array      >= 0.4 && < 0.6+  build-depends: base       >= 4.12 && < 4.21   ghc-options: -Wall    exposed-modules: Control.DeepSeq@@ -70,7 +72,6 @@   main-is: Main.hs   type: exitcode-stdio-1.0   build-depends:-    array,     base,     deepseq,     ghc-prim