deepseq-1.4.3.0: Deep evaluation of data structures

Copyright | (c) The University of Glasgow 2001-2009
License | BSD-style (see the file LICENSE)
Maintainer | libraries@haskell.org
Stability | stable
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Control.DeepSeq

Contents

- `NFData` class
- Helper functions
- Liftings of the `NFData` class
  - For unary constructors
  - For binary constructors

Description

This module provides overloaded functions, such as `deepseq` and `rnf`, for fully evaluating data structures (that is, evaluating to "Normal Form").

A typical use is to prevent resource leaks in lazy IO programs, by forcing all characters from a file to be read. For example:

    import System.IO
    import Control.DeepSeq
    import Control.Exception (evaluate)

    readFile' :: FilePath -> IO String
    readFile' fn = do
        h <- openFile fn ReadMode
        s <- hGetContents h
        evaluate (rnf s)
        hClose h
        return s

Note: The example above should rather be written in terms of `bracket` to ensure releasing file-descriptors in a timely matter (see the description of `force` for an example).

`deepseq` differs from `seq` as it traverses data structures deeply, for example, `seq` will evaluate only to the first constructor in the list:

    > [1,2,undefined] `seq` 3
    3

While `deepseq` will force evaluation of all the list elements:

    > [1,2,undefined] `deepseq` 3
    *** Exception: Prelude.undefined

Another common use is to ensure any exceptions hidden within lazy fields of a data structure do not leak outside the scope of the exception handler, or to force evaluation of a data structure in one thread, before passing to another thread (preventing work moving to the wrong threads).

Since: 1.1.0.0

Synopsis

- class NFData a where
- deepseq :: NFData a => a -> b -> b
- force :: NFData a => a -> a
- ($!!) :: NFData a => (a -> b) -> a -> b
- (<$!!>) :: (Monad m, NFData b) => (a -> b) -> m a -> m b
- rwhnf :: a -> ()
- class NFData1 f where
- rnf1 :: (NFData1 f, NFData a) => f a -> ()
- class NFData2 p where
- rnf2 :: (NFData2 p, NFData a, NFData b) => p a b -> ()

# `NFData` class

class NFData a where #

A class of types that can be fully evaluated.

Since: 1.1.0.0

Methods

rnf :: a -> () #

`rnf` should reduce its argument to normal form (that is, fully evaluate all sub-components), and then return '()'.

### `Generic` `NFData` deriving

Starting with GHC 7.2, you can automatically derive instances for types possessing a `Generic` instance.

Note: `Generic1` can be auto-derived starting with GHC 7.4

    {-# LANGUAGE DeriveGeneric #-}

    import GHC.Generics (Generic, Generic1)
    import Control.DeepSeq

    data Foo a = Foo a String
                 deriving (Eq, Generic, Generic1)

    instance NFData a => NFData (Foo a)
    instance NFData1 Foo

    data Colour = Red | Green | Blue
                  deriving Generic

    instance NFData Colour

Starting with GHC 7.10, the example above can be written more concisely by enabling the new `DeriveAnyClass` extension:

    {-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}

    import GHC.Generics (Generic)
    import Control.DeepSeq

    data Foo a = Foo a String
                 deriving (Eq, Generic, Generic1, NFData, NFData1)

    data Colour = Red | Green | Blue
                  deriving (Generic, NFData)

### Compatibility with previous `deepseq` versions

Prior to version 1.4.0.0, the default implementation of the `rnf` method was defined as

    rnf a = seq a ()

However, starting with `deepseq-1.4.0.0`, the default implementation is based on `DefaultSignatures` allowing for more accurate auto-derived `NFData` instances. If you need the previously used exact default `rnf` method implementation semantics, use

    instance NFData Colour where rnf x = seq x ()

or alternatively

    instance NFData Colour where rnf = rwhnf

or

    {-# LANGUAGE BangPatterns #-}
    instance NFData Colour where rnf !_ = ()

rnf :: (Generic a, GNFData Zero (Rep a)) => a -> () #

`rnf` should reduce its argument to normal form (that is, fully evaluate all sub-components), and then return '()'.

### `Generic` `NFData` deriving

Starting with GHC 7.2, you can automatically derive instances for types possessing a `Generic` instance.

Note: `Generic1` can be auto-derived starting with GHC 7.4

    {-# LANGUAGE DeriveGeneric #-}

    import GHC.Generics (Generic, Generic1)
    import Control.DeepSeq

    data Foo a = Foo a String
                 deriving (Eq, Generic, Generic1)

    instance NFData a => NFData (Foo a)
    instance NFData1 Foo

    data Colour = Red | Green | Blue
                  deriving Generic

    instance NFData Colour

Starting with GHC 7.10, the example above can be written more concisely by enabling the new `DeriveAnyClass` extension:

    {-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}

    import GHC.Generics (Generic)
    import Control.DeepSeq

    data Foo a = Foo a String
                 deriving (Eq, Generic, Generic1, NFData, NFData1)

    data Colour = Red | Green | Blue
                  deriving (Generic, NFData)

### Compatibility with previous `deepseq` versions

Prior to version 1.4.0.0, the default implementation of the `rnf` method was defined as

    rnf a = seq a ()

However, starting with `deepseq-1.4.0.0`, the default implementation is based on `DefaultSignatures` allowing for more accurate auto-derived `NFData` instances. If you need the previously used exact default `rnf` method implementation semantics, use

    instance NFData Colour where rnf x = seq x ()

or alternatively

    instance NFData Colour where rnf = rwhnf

or

    {-# LANGUAGE BangPatterns #-}
    instance NFData Colour where rnf !_ = ()

Instances

NFData Bool # |
Methods rnf :: Bool -> () #
NFData Char # |
Methods rnf :: Char -> () #
NFData Double # |
Methods rnf :: Double -> () #
NFData Float # |
Methods rnf :: Float -> () #
NFData Int # |
Methods rnf :: Int -> () #
NFData Int8 # |
Methods rnf :: Int8 -> () #
NFData Int16 # |
Methods rnf :: Int16 -> () #
NFData Int32 # |
Methods rnf :: Int32 -> () #
NFData Int64 # |
Methods rnf :: Int64 -> () #
NFData Integer # |
Methods rnf :: Integer -> () #
NFData Natural # | Since: 1.4.0.0
Methods rnf :: Natural -> () #
NFData Ordering # |
Methods rnf :: Ordering -> () #
NFData Word # |
Methods rnf :: Word -> () #
NFData Word8 # |
Methods rnf :: Word8 -> () #
NFData Word16 # |
Methods rnf :: Word16 -> () #
NFData Word32 # |
Methods rnf :: Word32 -> () #
NFData Word64 # |
Methods rnf :: Word64 -> () #
NFData CallStack # | Since: 1.4.2.0
Methods rnf :: CallStack -> () #
NFData () # |
Methods rnf :: () -> () #
NFData TyCon # | NOTE: Only defined for `base-4.8.0.0` and later Since: 1.4.0.0
Methods rnf :: TyCon -> () #
NFData Void # | Defined as ``rnf` = `absurd``. Since: 1.4.0.0
Methods rnf :: Void -> () #
NFData Unique # | Since: 1.4.0.0
Methods rnf :: Unique -> () #
NFData Version # | Since: 1.3.0.0
Methods rnf :: Version -> () #
NFData ThreadId # | Since: 1.4.0.0
Methods rnf :: ThreadId -> () #
NFData ExitCode # | Since: 1.4.2.0
Methods rnf :: ExitCode -> () #
NFData TypeRep # | NOTE: Only defined for `base-4.8.0.0` and later Since: 1.4.0.0
Methods rnf :: TypeRep -> () #
NFData All # | Since: 1.4.0.0
Methods rnf :: All -> () #
NFData Any # | Since: 1.4.0.0
Methods rnf :: Any -> () #
NFData CChar # | Since: 1.4.0.0
Methods rnf :: CChar -> () #
NFData CSChar # | Since: 1.4.0.0
Methods rnf :: CSChar -> () #
NFData CUChar # | Since: 1.4.0.0
Methods rnf :: CUChar -> () #
NFData CShort # | Since: 1.4.0.0
Methods rnf :: CShort -> () #
NFData CUShort # | Since: 1.4.0.0
Methods rnf :: CUShort -> () #
NFData CInt # | Since: 1.4.0.0
Methods rnf :: CInt -> () #
NFData CUInt # | Since: 1.4.0.0
Methods rnf :: CUInt -> () #
NFData CLong # | Since: 1.4.0.0
Methods rnf :: CLong -> () #
NFData CULong # | Since: 1.4.0.0
Methods rnf :: CULong -> () #
NFData CLLong # | Since: 1.4.0.0
Methods rnf :: CLLong -> () #
NFData CULLong # | Since: 1.4.0.0
Methods rnf :: CULLong -> () #
NFData CBool # | Since: 1.4.3.0
Methods rnf :: CBool -> () #
NFData CFloat # | Since: 1.4.0.0
Methods rnf :: CFloat -> () #
NFData CDouble # | Since: 1.4.0.0
Methods rnf :: CDouble -> () #
NFData CPtrdiff # | Since: 1.4.0.0
Methods rnf :: CPtrdiff -> () #
NFData CSize # | Since: 1.4.0.0
Methods rnf :: CSize -> () #
NFData CWchar # | Since: 1.4.0.0
Methods rnf :: CWchar -> () #
NFData CSigAtomic # | Since: 1.4.0.0
Methods rnf :: CSigAtomic -> () #
NFData CClock # | Since: 1.4.0.0
Methods rnf :: CClock -> () #
NFData CTime # | Since: 1.4.0.0
Methods rnf :: CTime -> () #
NFData CUSeconds # | Since: 1.4.0.0
Methods rnf :: CUSeconds -> () #
NFData CSUSeconds # | Since: 1.4.0.0
Methods rnf :: CSUSeconds -> () #
NFData CFile # | Since: 1.4.0.0
Methods rnf :: CFile -> () #
NFData CFpos # | Since: 1.4.0.0
Methods rnf :: CFpos -> () #
NFData CJmpBuf # | Since: 1.4.0.0
Methods rnf :: CJmpBuf -> () #
NFData CIntPtr # | Since: 1.4.0.0
Methods rnf :: CIntPtr -> () #
NFData CUIntPtr # | Since: 1.4.0.0
Methods rnf :: CUIntPtr -> () #
NFData CIntMax # | Since: 1.4.0.0
Methods rnf :: CIntMax -> () #
NFData CUIntMax # | Since: 1.4.0.0
Methods rnf :: CUIntMax -> () #
NFData Fingerprint # | Since: 1.4.0.0
Methods rnf :: Fingerprint -> () #
NFData SrcLoc # | Since: 1.4.2.0
Methods rnf :: SrcLoc -> () #
NFData a => NFData [a] # |
Methods rnf :: [a] -> () #
NFData a => NFData (Maybe a) # |
Methods rnf :: Maybe a -> () #
NFData a => NFData (Ratio a) # |
Methods rnf :: Ratio a -> () #
NFData (Ptr a) # | Since: 1.4.2.0
Methods rnf :: Ptr a -> () #
NFData (FunPtr a) # | Since: 1.4.2.0
Methods rnf :: FunPtr a -> () #
NFData a => NFData (Complex a) # |
Methods rnf :: Complex a -> () #
NFData (Fixed a) # | Since: 1.3.0.0
Methods rnf :: Fixed a -> () #
NFData a => NFData (Min a) # | Since: 1.4.2.0
Methods rnf :: Min a -> () #
NFData a => NFData (Max a) # | Since: 1.4.2.0
Methods rnf :: Max a -> () #
NFData a => NFData (First a) # | Since: 1.4.2.0
Methods rnf :: First a -> () #
NFData a => NFData (Last a) # | Since: 1.4.2.0
Methods rnf :: Last a -> () #
NFData m => NFData (WrappedMonoid m) # | Since: 1.4.2.0
Methods rnf :: WrappedMonoid m -> () #
NFData a => NFData (Option a) # | Since: 1.4.2.0
Methods rnf :: Option a -> () #
NFData a => NFData (NonEmpty a) # | Since: 1.4.2.0
Methods rnf :: NonEmpty a -> () #
NFData (StableName a) # | Since: 1.4.0.0
Methods rnf :: StableName a -> () #
NFData a => NFData (ZipList a) # | Since: 1.4.0.0
Methods rnf :: ZipList a -> () #
NFData a => NFData (Identity a) # | Since: 1.4.0.0
Methods rnf :: Identity a -> () #
NFData (IORef a) # | NOTE: Only strict in the reference and not the referenced value. Since: 1.4.2.0
Methods rnf :: IORef a -> () #
NFData a => NFData (Dual a) # | Since: 1.4.0.0
Methods rnf :: Dual a -> () #
NFData a => NFData (Sum a) # | Since: 1.4.0.0
Methods rnf :: Sum a -> () #
NFData a => NFData (Product a) # | Since: 1.4.0.0
Methods rnf :: Product a -> () #
NFData a => NFData (First a) # | Since: 1.4.0.0
Methods rnf :: First a -> () #
NFData a => NFData (Last a) # | Since: 1.4.0.0
Methods rnf :: Last a -> () #
NFData a => NFData (Down a) # | Since: 1.4.0.0
Methods rnf :: Down a -> () #
NFData (MVar a) # | NOTE: Only strict in the reference and not the referenced value. Since: 1.4.2.0
Methods rnf :: MVar a -> () #
NFData (a -> b) # | This instance is for convenience and consistency with `seq`. This assumes that WHNF is equivalent to NF for functions. Since: 1.3.0.0
Methods rnf :: (a -> b) -> () #
(NFData a, NFData b) => NFData (Either a b) # |
Methods rnf :: Either a b -> () #
(NFData a, NFData b) => NFData (a, b) # |
Methods rnf :: (a, b) -> () #
(NFData a, NFData b) => NFData (Array a b) # |
Methods rnf :: Array a b -> () #
(NFData a, NFData b) => NFData (Arg a b) # | Since: 1.4.2.0
Methods rnf :: Arg a b -> () #
NFData (Proxy k a) # | Since: 1.4.0.0
Methods rnf :: Proxy k a -> () #
NFData (STRef s a) # | NOTE: Only strict in the reference and not the referenced value. Since: 1.4.2.0
Methods rnf :: STRef s a -> () #
(NFData a1, NFData a2, NFData a3) => NFData (a1, a2, a3) # |
Methods rnf :: (a1, a2, a3) -> () #
NFData a => NFData (Const k a b) # | Since: 1.4.0.0
Methods rnf :: Const k a b -> () #
NFData ((:~:) k a b) # | Since: 1.4.3.0
Methods rnf :: (k :~: a) b -> () #
(NFData a1, NFData a2, NFData a3, NFData a4) => NFData (a1, a2, a3, a4) # |
Methods rnf :: (a1, a2, a3, a4) -> () #
(NFData1 f, NFData1 g, NFData a) => NFData (Product * f g a) # | Since: 1.4.3.0
Methods rnf :: Product * f g a -> () #
(NFData1 f, NFData1 g, NFData a) => NFData (Sum * f g a) # | Since: 1.4.3.0
Methods rnf :: Sum * f g a -> () #
NFData ((:~~:) k1 k2 a b) # | Since: 1.4.3.0
Methods rnf :: (k1 :~~: k2) a b -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5) # |
Methods rnf :: (a1, a2, a3, a4, a5) -> () #
(NFData1 f, NFData1 g, NFData a) => NFData (Compose * * f g a) # | Since: 1.4.3.0
Methods rnf :: Compose * * f g a -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6) # |
Methods rnf :: (a1, a2, a3, a4, a5, a6) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7) # |
Methods rnf :: (a1, a2, a3, a4, a5, a6, a7) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8) # |
Methods rnf :: (a1, a2, a3, a4, a5, a6, a7, a8) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9) # |
Methods rnf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> () #

# Helper functions

deepseq :: NFData a => a -> b -> b #

`deepseq`: fully evaluates the first argument, before returning the second.

The name `deepseq` is used to illustrate the relationship to `seq`: where `seq` is shallow in the sense that it only evaluates the top level of its argument, `deepseq` traverses the entire data structure evaluating it completely.

`deepseq` can be useful for forcing pending exceptions, eradicating space leaks, or forcing lazy I/O to happen. It is also useful in conjunction with parallel Strategies (see the `parallel` package).

There is no guarantee about the ordering of evaluation. The implementation may evaluate the components of the structure in any order or in parallel. To impose an actual order on evaluation, use `pseq` from Control.Parallel in the `parallel` package.

Since: 1.1.0.0

force :: NFData a => a -> a #

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` 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 `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 ()

Finally, here's an exception safe variant of the `readFile'` example:

    readFile' :: FilePath -> IO String
    readFile' fn = bracket (openFile fn ReadMode) hClose $ \h ->
                           evaluate . force =<< hGetContents h

Since: 1.2.0.0

($!!) :: NFData a => (a -> b) -> a -> b infixr 0 #

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

(<$!!>) :: (Monad m, NFData b) => (a -> b) -> m a -> m b infixl 4 #

Deeply strict version of `<$>`.

Since: 1.4.3.0

rwhnf :: a -> () #

Reduce to weak head normal form

Equivalent to `\x -> `seq` x ()`.

Useful for defining `NFData` for types for which NF=WHNF holds.

    data T = C1 | C2 | C3
    instance NFData T where rnf = rwhnf

Since: 1.4.3.0

# Liftings of the `NFData` class

## For unary constructors

class NFData1 f where #

A class of functors that can be fully evaluated.

Since: 1.4.3.0

Methods

liftRnf :: (a -> ()) -> f a -> () #

`liftRnf` should reduce its argument to normal form (that is, fully evaluate all sub-components), given an argument to reduce `a` arguments, and then return '()'.

See `rnf` for the generic deriving.

liftRnf :: (Generic1 f, GNFData One (Rep1 f)) => (a -> ()) -> f a -> () #

`liftRnf` should reduce its argument to normal form (that is, fully evaluate all sub-components), given an argument to reduce `a` arguments, and then return '()'.

See `rnf` for the generic deriving.

Instances

NFData1 [] # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> [a] -> () #
NFData1 Maybe # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Maybe a -> () #
NFData1 Ratio # | Available on `base >=4.9` Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Ratio a -> () #
NFData1 Ptr # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Ptr a -> () #
NFData1 FunPtr # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> FunPtr a -> () #
NFData1 Fixed # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Fixed a -> () #
NFData1 Min # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Min a -> () #
NFData1 Max # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Max a -> () #
NFData1 First # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> First a -> () #
NFData1 Last # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Last a -> () #
NFData1 WrappedMonoid # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> WrappedMonoid a -> () #
NFData1 Option # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Option a -> () #
NFData1 NonEmpty # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> NonEmpty a -> () #
NFData1 StableName # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> StableName a -> () #
NFData1 ZipList # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> ZipList a -> () #
NFData1 Identity # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Identity a -> () #
NFData1 IORef # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> IORef a -> () #
NFData1 Dual # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Dual a -> () #
NFData1 Sum # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Sum a -> () #
NFData1 Product # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Product a -> () #
NFData1 First # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> First a -> () #
NFData1 Last # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Last a -> () #
NFData1 Down # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Down a -> () #
NFData1 MVar # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> MVar a -> () #
NFData a => NFData1 (Either a) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Either a a -> () #
NFData a => NFData1 ((,) a) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a, a) -> () #
NFData a => NFData1 (Array a) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Array a a -> () #
NFData a => NFData1 (Arg a) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Arg a a -> () #
NFData1 (Proxy *) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Proxy * a -> () #
NFData1 (STRef s) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> STRef s a -> () #
(NFData a1, NFData a2) => NFData1 ((,,) a1 a2) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a1, a2, a) -> () #
NFData a => NFData1 (Const * a) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Const * a a -> () #
NFData1 ((:~:) * a) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (* :~: a) a -> () #
(NFData a1, NFData a2, NFData a3) => NFData1 ((,,,) a1 a2 a3) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a1, a2, a3, a) -> () #
(NFData1 f, NFData1 g) => NFData1 (Product * f g) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Product * f g a -> () #
(NFData1 f, NFData1 g) => NFData1 (Sum * f g) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Sum * f g a -> () #
NFData1 ((:~~:) k1 * a) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (k1 :~~: *) a a -> () #
(NFData a1, NFData a2, NFData a3, NFData a4) => NFData1 ((,,,,) a1 a2 a3 a4) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a1, a2, a3, a4, a) -> () #
(NFData1 f, NFData1 g) => NFData1 (Compose * * f g) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> Compose * * f g a -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData1 ((,,,,,) a1 a2 a3 a4 a5) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a1, a2, a3, a4, a5, a) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData1 ((,,,,,,) a1 a2 a3 a4 a5 a6) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a1, a2, a3, a4, a5, a6, a) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData1 ((,,,,,,,) a1 a2 a3 a4 a5 a6 a7) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a1, a2, a3, a4, a5, a6, a7, a) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData1 ((,,,,,,,,) a1 a2 a3 a4 a5 a6 a7 a8) # | Since: 1.4.3.0
Methods liftRnf :: (a -> ()) -> (a1, a2, a3, a4, a5, a6, a7, a8, a) -> () #

rnf1 :: (NFData1 f, NFData a) => f a -> () #

Lift the standard `rnf` function through the type constructor.

Since: 1.4.3.0

## For binary constructors

class NFData2 p where #

A class of bifunctors that can be fully evaluated.

Since: 1.4.3.0

Minimal complete definition

liftRnf2

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> p a b -> () #

`liftRnf2` should reduce its argument to normal form (that is, fully evaluate all sub-components), given functions to reduce `a` and `b` arguments respectively, and then return '()'.

Note: Unlike for the unary `liftRnf`, there is currently no support for generically deriving `liftRnf2`.

Instances

NFData2 Either # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> Either a b -> () #
NFData2 (,) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a, b) -> () #
NFData2 Array # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> Array a b -> () #
NFData2 Arg # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> Arg a b -> () #
NFData2 STRef # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> STRef a b -> () #
NFData a1 => NFData2 ((,,) a1) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a, b) -> () #
NFData2 (Const *) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> Const * a b -> () #
NFData2 ((:~:) *) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (* :~: a) b -> () #
(NFData a1, NFData a2) => NFData2 ((,,,) a1 a2) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a, b) -> () #
NFData2 ((:~~:) * *) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (* :~~: *) a b -> () #
(NFData a1, NFData a2, NFData a3) => NFData2 ((,,,,) a1 a2 a3) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a3, a, b) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4) => NFData2 ((,,,,,) a1 a2 a3 a4) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a3, a4, a, b) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData2 ((,,,,,,) a1 a2 a3 a4 a5) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a3, a4, a5, a, b) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData2 ((,,,,,,,) a1 a2 a3 a4 a5 a6) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a3, a4, a5, a6, a, b) -> () #
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData2 ((,,,,,,,,) a1 a2 a3 a4 a5 a6 a7) # | Since: 1.4.3.0
Methods liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a3, a4, a5, a6, a7, a, b) -> () #

rnf2 :: (NFData2 p, NFData a, NFData b) => p a b -> () #

Lift the standard `rnf` function through the type constructor.

Since: 1.4.3.0