packages feed

deepseq 1.1.0.2 → 1.2.0.0

raw patch · 2 files changed

+27/−25 lines, 2 filesdep −containersdep ~basenew-uploader

Dependencies removed: containers

Dependency ranges changed: base

Files

Control/DeepSeq.hs view
@@ -1,3 +1,6 @@+#if __GLASGOW_HASKELL__ >= 701+{-# LANGUAGE Safe #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Control.DeepSeq@@ -42,7 +45,7 @@ -- the wrong threads). -- module Control.DeepSeq (-     deepseq,+     deepseq, ($!!), force,      NFData(..),   ) where @@ -50,13 +53,10 @@ import Data.Word import Data.Ratio import Data.Complex-import Data.Map-import Data.Set-import Data.IntMap-import Data.IntSet-import Data.Tree import Data.Array +infixr 0 $!!+ -- | 'deepseq': fully evaluates the first argument, before returning the -- second. --@@ -79,6 +79,23 @@ 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.+($!!) :: (NFData a) => (a -> b) -> a -> b+f $!! x = x `deepseq` f x++-- | a variant of 'deepseq' that is useful in some circumstances:+--+-- > force x = x `deepseq` x+--+-- @force x@ fully evaluates @x@, and then returns it.  Note that+-- @force x@ only performs evaluation when the value of @force x@+-- itself is demanded, so essentially it turns shallow evaluation into+-- deep evaluation.++force :: (NFData a) => a -> a+force x = x `deepseq` x+ -- | A class of types that can be fully evaluated. class NFData a where     -- | rnf should reduce its argument to normal form (that is, fully@@ -130,21 +147,6 @@ instance (NFData a, NFData b) => NFData (Either a b) where     rnf (Left x)  = rnf x     rnf (Right y) = rnf y--instance (NFData k, NFData a) => NFData (Data.Map.Map k a) where-    rnf = rnf . Data.Map.toList--instance NFData a => NFData (Data.Set.Set a) where-    rnf = rnf . Data.Set.toList--instance NFData a => NFData (Data.Tree.Tree a) where-    rnf (Data.Tree.Node r f) = rnf r `seq` rnf f--instance NFData a => NFData (Data.IntMap.IntMap a) where-    rnf = rnf . Data.IntMap.toList--instance NFData Data.IntSet.IntSet where-    rnf = rnf . Data.IntSet.toList  instance NFData a => NFData [a] where     rnf [] = ()
deepseq.cabal view
@@ -1,5 +1,5 @@ name:		deepseq-version:	1.1.0.2+version:        1.2.0.0 license:	BSD3 license-file:	LICENSE maintainer:	libraries@haskell.org@@ -23,13 +23,13 @@ cabal-version:  >=1.6  source-repository head-    type:     darcs-    location: http://darcs.haskell.org/packages/deepseq/+    type:     git+    location: http://darcs.haskell.org/packages/deepseq.git/  library {   exposed-modules: Control.DeepSeq   build-depends: base       >= 3   && < 5, -                 containers >= 0.1 && < 0.5,                  array      >= 0.1 && < 0.4   ghc-options: -Wall+  extensions: CPP }