planet-mitchell-0.0.0: Planet Mitchell

Safe HaskellNone
LanguageHaskell2010

Eval

Contents

Synopsis

Weak head normal form

seq :: a -> b -> b #

The value of seq a b is bottom if a is bottom, and otherwise equal to b. In other words, it evaluates the first argument a to weak head normal form (WHNF). seq is usually introduced to improve performance by avoiding unneeded laziness.

A note on evaluation order: the expression seq a b does not guarantee that a will be evaluated before b. The only guarantee given by seq is that the both a and b will be evaluated before seq returns a value. In particular, this means that b may be evaluated before a. If you need to guarantee a specific order of evaluation, you must use the function pseq from the "parallel" package.

lazy :: a -> a #

The lazy function restrains strictness analysis a little. The call lazy e means the same as e, but lazy has a magical property so far as strictness analysis is concerned: it is lazy in its first argument, even though its semantics is strict. After strictness analysis has run, calls to lazy are inlined to be the identity function.

This behaviour is occasionally useful when controlling evaluation order. Notably, lazy is used in the library definition of par:

par :: a -> b -> b
par x y = case (par# x) of _ -> lazy y

If lazy were not lazy, par would look strict in y which would defeat the whole purpose of par.

Like seq, the argument of lazy can have an unboxed type.

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

Strict (call-by-value) application operator. It takes a function and an argument, evaluates the argument to weak head normal form (WHNF), then calls the function with that value.

evaluate :: a -> IO a #

Evaluate the argument to weak head normal form.

evaluate is typically used to uncover any exceptions that a lazy value may contain, and possibly handle them.

evaluate only evaluates to weak head normal form. If deeper evaluation is needed, the force function from Control.DeepSeq may be handy:

evaluate $ force x

There is a subtle difference between evaluate x and return $! x, analogous to the difference between throwIO and throw. If the lazy value x throws an exception, return $! x will fail to return an IO action and will throw an exception instead. evaluate x, on the other hand, always produces an IO action; that action will throw an exception upon execution iff x throws an exception upon evaluation.

The practical implication of this difference is that due to the imprecise exceptions semantics,

(return $! error "foo") >> error "bar"

may throw either "foo" or "bar", depending on the optimizations performed by the compiler. On the other hand,

evaluate (error "foo") >> error "bar"

is guaranteed to throw "foo".

The rule of thumb is to use evaluate to force or handle exceptions in lazy values. If, on the other hand, you are forcing a lazy value for efficiency reasons only and do not care about exceptions, you may use return $! x.

Normal form

data NF a #

NF is an abstract data type representing data which has been evaluated to normal form. Specifically, if a value of type NF a is in weak head normal form, then it is in reduced normal form; alternatively, it is only necessary to seq an NF a to assure that it is fully evaluated.

Instances
Eq a => Eq (NF a) 
Instance details

Defined in Data.NF.Internal

Methods

(==) :: NF a -> NF a -> Bool #

(/=) :: NF a -> NF a -> Bool #

Ord a => Ord (NF a) 
Instance details

Defined in Data.NF.Internal

Methods

compare :: NF a -> NF a -> Ordering #

(<) :: NF a -> NF a -> Bool #

(<=) :: NF a -> NF a -> Bool #

(>) :: NF a -> NF a -> Bool #

(>=) :: NF a -> NF a -> Bool #

max :: NF a -> NF a -> NF a #

min :: NF a -> NF a -> NF a #

NFData (NF a) 
Instance details

Defined in Data.NF.Internal

Methods

rnf :: NF a -> () #

makeNF :: NFData a => a -> NF a #

Creates a value of type NF. The first time the result is evaluated to whnf, the value will be rnfed. To avoid this rnf, see UnsafeNF.

getNF :: NF a -> a #

Retrieves a from a value of type NF a; this value is guaranteed to be in normal form.

class NFData a where #

A class of types that can be fully evaluated.

Since: deepseq-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 !_ = ()
Instances
NFData Bool 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Bool -> () #

NFData Char 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Char -> () #

NFData Double 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Double -> () #

NFData Float 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Float -> () #

NFData Int 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Int -> () #

NFData Int8 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Int8 -> () #

NFData Int16 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Int16 -> () #

NFData Int32 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Int32 -> () #

NFData Int64 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Int64 -> () #

NFData Integer 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Integer -> () #

NFData Natural

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Natural -> () #

NFData Ordering 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Ordering -> () #

NFData Word 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Word -> () #

NFData Word8 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Word8 -> () #

NFData Word16 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Word16 -> () #

NFData Word32 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Word32 -> () #

NFData Word64 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Word64 -> () #

NFData CallStack

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CallStack -> () #

NFData () 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: () -> () #

NFData TyCon

NOTE: Only defined for base-4.8.0.0 and later

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: TyCon -> () #

NFData ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

rnf :: ByteString -> () #

NFData ByteString 
Instance details

Defined in Data.ByteString.Lazy.Internal

Methods

rnf :: ByteString -> () #

NFData Scientific 
Instance details

Defined in Data.Scientific

Methods

rnf :: Scientific -> () #

NFData UTCTime 
Instance details

Defined in Data.Time.Clock.Internal.UTCTime

Methods

rnf :: UTCTime -> () #

NFData JSONPathElement 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

rnf :: JSONPathElement -> () #

NFData Value 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

rnf :: Value -> () #

NFData ThreadId

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: ThreadId -> () #

NFData Void

Defined as rnf = absurd.

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Void -> () #

NFData Unique

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Unique -> () #

NFData Version

Since: deepseq-1.3.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Version -> () #

NFData ExitCode

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: ExitCode -> () #

NFData TypeRep

NOTE: Only defined for base-4.8.0.0 and later

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: TypeRep -> () #

NFData All

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: All -> () #

NFData Any

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Any -> () #

NFData CChar

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CChar -> () #

NFData CSChar

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CSChar -> () #

NFData CUChar

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CUChar -> () #

NFData CShort

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CShort -> () #

NFData CUShort

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CUShort -> () #

NFData CInt

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CInt -> () #

NFData CUInt

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CUInt -> () #

NFData CLong

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CLong -> () #

NFData CULong

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CULong -> () #

NFData CLLong

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CLLong -> () #

NFData CULLong

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CULLong -> () #

NFData CBool

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CBool -> () #

NFData CFloat

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CFloat -> () #

NFData CDouble

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CDouble -> () #

NFData CPtrdiff

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CPtrdiff -> () #

NFData CSize

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CSize -> () #

NFData CWchar

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CWchar -> () #

NFData CSigAtomic

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CSigAtomic -> () #

NFData CClock

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CClock -> () #

NFData CTime

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CTime -> () #

NFData CUSeconds

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CUSeconds -> () #

NFData CSUSeconds

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CSUSeconds -> () #

NFData CFile

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CFile -> () #

NFData CFpos

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CFpos -> () #

NFData CJmpBuf

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CJmpBuf -> () #

NFData CIntPtr

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CIntPtr -> () #

NFData CUIntPtr

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CUIntPtr -> () #

NFData CIntMax

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CIntMax -> () #

NFData CUIntMax

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: CUIntMax -> () #

NFData Fingerprint

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Fingerprint -> () #

NFData SrcLoc

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: SrcLoc -> () #

NFData ShortByteString 
Instance details

Defined in Data.ByteString.Short.Internal

Methods

rnf :: ShortByteString -> () #

NFData IntSet 
Instance details

Defined in Data.IntSet.Internal

Methods

rnf :: IntSet -> () #

NFData Half 
Instance details

Defined in Numeric.Half

Methods

rnf :: Half -> () #

NFData Pos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

rnf :: Pos -> () #

NFData InvalidPosException 
Instance details

Defined in Text.Megaparsec.Pos

Methods

rnf :: InvalidPosException -> () #

NFData SourcePos 
Instance details

Defined in Text.Megaparsec.Pos

Methods

rnf :: SourcePos -> () #

NFData IntMultiSet 
Instance details

Defined in Data.IntMultiSet

Methods

rnf :: IntMultiSet -> () #

NFData URI 
Instance details

Defined in Network.URI

Methods

rnf :: URI -> () #

NFData URIAuth 
Instance details

Defined in Network.URI

Methods

rnf :: URIAuth -> () #

NFData Doc 
Instance details

Defined in Text.PrettyPrint.HughesPJ

Methods

rnf :: Doc -> () #

NFData TextDetails 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

rnf :: TextDetails -> () #

NFData UnicodeException 
Instance details

Defined in Data.Text.Encoding.Error

Methods

rnf :: UnicodeException -> () #

NFData ShortText 
Instance details

Defined in Data.Text.Short.Internal

Methods

rnf :: ShortText -> () #

NFData ZonedTime 
Instance details

Defined in Data.Time.LocalTime.Internal.ZonedTime

Methods

rnf :: ZonedTime -> () #

NFData LocalTime 
Instance details

Defined in Data.Time.LocalTime.Internal.LocalTime

Methods

rnf :: LocalTime -> () #

NFData TimeOfDay 
Instance details

Defined in Data.Time.LocalTime.Internal.TimeOfDay

Methods

rnf :: TimeOfDay -> () #

NFData TimeZone 
Instance details

Defined in Data.Time.LocalTime.Internal.TimeZone

Methods

rnf :: TimeZone -> () #

NFData UniversalTime 
Instance details

Defined in Data.Time.Clock.Internal.UniversalTime

Methods

rnf :: UniversalTime -> () #

NFData NominalDiffTime 
Instance details

Defined in Data.Time.Clock.Internal.NominalDiffTime

Methods

rnf :: NominalDiffTime -> () #

NFData DiffTime 
Instance details

Defined in Data.Time.Clock.Internal.DiffTime

Methods

rnf :: DiffTime -> () #

NFData Day 
Instance details

Defined in Data.Time.Calendar.Days

Methods

rnf :: Day -> () #

NFData UUID 
Instance details

Defined in Data.UUID.Types.Internal

Methods

rnf :: UUID -> () #

NFData Action 
Instance details

Defined in Weigh

Methods

rnf :: Action -> () #

NFData a => NFData [a] 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: [a] -> () #

NFData a => NFData (Maybe a) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Maybe a -> () #

NFData a => NFData (Ratio a) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Ratio a -> () #

NFData (Ptr a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Ptr a -> () #

NFData (FunPtr a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: FunPtr a -> () #

NFData a => NFData (IResult a) 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

rnf :: IResult a -> () #

NFData a => NFData (Result a) 
Instance details

Defined in Data.Aeson.Types.Internal

Methods

rnf :: Result a -> () #

NFData a => NFData (Approximate a) 
Instance details

Defined in Data.Approximate.Type

Methods

rnf :: Approximate a -> () #

NFData (IORef a)

NOTE: Only strict in the reference and not the referenced value.

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: IORef a -> () #

NFData a => NFData (Complex a) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Complex a -> () #

NFData (Fixed a)

Since: deepseq-1.3.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Fixed a -> () #

NFData a => NFData (Min a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Min a -> () #

NFData a => NFData (Max a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Max a -> () #

NFData a => NFData (First a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: First a -> () #

NFData a => NFData (Last a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Last a -> () #

NFData m => NFData (WrappedMonoid m)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: WrappedMonoid m -> () #

NFData a => NFData (Option a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Option a -> () #

NFData (StableName a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: StableName a -> () #

NFData a => NFData (ZipList a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: ZipList a -> () #

NFData a => NFData (Identity a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Identity a -> () #

NFData a => NFData (First a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: First a -> () #

NFData a => NFData (Last a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Last a -> () #

NFData a => NFData (Dual a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Dual a -> () #

NFData a => NFData (Sum a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Sum a -> () #

NFData a => NFData (Product a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Product a -> () #

NFData a => NFData (Down a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Down a -> () #

NFData (MVar a)

NOTE: Only strict in the reference and not the referenced value.

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: MVar a -> () #

NFData a => NFData (NonEmpty a)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: NonEmpty a -> () #

NFData s => NFData (CI s) 
Instance details

Defined in Data.CaseInsensitive.Internal

Methods

rnf :: CI s -> () #

NFData (Dict c) 
Instance details

Defined in Data.Constraint

Methods

rnf :: Dict c -> () #

NFData a => NFData (IntMap a) 
Instance details

Defined in Data.IntMap.Internal

Methods

rnf :: IntMap a -> () #

NFData a => NFData (SCC a) 
Instance details

Defined in Data.Graph

Methods

rnf :: SCC a -> () #

NFData a => NFData (Tree a) 
Instance details

Defined in Data.Tree

Methods

rnf :: Tree a -> () #

NFData a => NFData (Seq a) 
Instance details

Defined in Data.Sequence.Internal

Methods

rnf :: Seq a -> () #

NFData a => NFData (FingerTree a) 
Instance details

Defined in Data.Sequence.Internal

Methods

rnf :: FingerTree a -> () #

NFData a => NFData (Digit a) 
Instance details

Defined in Data.Sequence.Internal

Methods

rnf :: Digit a -> () #

NFData a => NFData (Node a) 
Instance details

Defined in Data.Sequence.Internal

Methods

rnf :: Node a -> () #

NFData a => NFData (Elem a) 
Instance details

Defined in Data.Sequence.Internal

Methods

rnf :: Elem a -> () #

NFData a => NFData (Set a) 
Instance details

Defined in Data.Set.Internal

Methods

rnf :: Set a -> () #

NFData a => NFData (DList a) 
Instance details

Defined in Data.DList

Methods

rnf :: DList a -> () #

NFData a => NFData (Hashed a) 
Instance details

Defined in Data.Hashable.Class

Methods

rnf :: Hashed a -> () #

NFData (Vector a) 
Instance details

Defined in Data.Vector.Primitive

Methods

rnf :: Vector a -> () #

NFData (Vector a) 
Instance details

Defined in Data.Vector.Storable

Methods

rnf :: Vector a -> () #

NFData (Vector a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

rnf :: Vector a -> () #

NFData a => NFData (HashSet a) 
Instance details

Defined in Data.HashSet

Methods

rnf :: HashSet a -> () #

NFData a => NFData (Vector a) 
Instance details

Defined in Data.Vector

Methods

rnf :: Vector a -> () #

NFData a => NFData (Log a) 
Instance details

Defined in Numeric.Log

Methods

rnf :: Log a -> () #

NFData t => NFData (ErrorItem t) 
Instance details

Defined in Text.Megaparsec.Error

Methods

rnf :: ErrorItem t -> () #

NFData a => NFData (ErrorFancy a) 
Instance details

Defined in Text.Megaparsec.Error

Methods

rnf :: ErrorFancy a -> () #

NFData s => NFData (State s) 
Instance details

Defined in Text.Megaparsec.State

Methods

rnf :: State s -> () #

NFData a => NFData (MultiSet a) 
Instance details

Defined in Data.MultiSet

Methods

rnf :: MultiSet a -> () #

NFData (NF a) 
Instance details

Defined in Data.NF.Internal

Methods

rnf :: NF a -> () #

NFData a => NFData (Doc a) 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

rnf :: Doc a -> () #

NFData a => NFData (AnnotDetails a) 
Instance details

Defined in Text.PrettyPrint.Annotated.HughesPJ

Methods

rnf :: AnnotDetails a -> () #

NFData a => NFData (Grouped a) 
Instance details

Defined in Weigh

Methods

rnf :: Grouped a -> () #

NFData (a -> b)

This instance is for convenience and consistency with seq. This assumes that WHNF is equivalent to NF for functions.

Since: deepseq-1.3.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a -> b) -> () #

(NFData a, NFData b) => NFData (Either a b) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Either a b -> () #

(NFData a, NFData b) => NFData (a, b) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a, b) -> () #

(NFData k, NFData v) => NFData (HashMap k v) 
Instance details

Defined in Data.HashMap.Base

Methods

rnf :: HashMap k v -> () #

(NFData k, NFData a) => NFData (Map k a) 
Instance details

Defined in Data.Map.Internal

Methods

rnf :: Map k a -> () #

(NFData a, NFData b) => NFData (Array a b) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: Array a b -> () #

(NFData a, NFData b) => NFData (Arg a b)

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Arg a b -> () #

NFData (Proxy a)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Proxy a -> () #

NFData (STRef s a)

NOTE: Only strict in the reference and not the referenced value.

Since: deepseq-1.4.2.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: STRef s a -> () #

a => NFData (a :- b) 
Instance details

Defined in Data.Constraint

Methods

rnf :: (a :- b) -> () #

(NFData a, NFData b) => NFData (Gr a b) 
Instance details

Defined in Data.Graph.Inductive.PatriciaTree

Methods

rnf :: Gr a b -> () #

(NFData a, NFData b) => NFData (Heap a b) 
Instance details

Defined in Data.Graph.Inductive.Internal.Heap

Methods

rnf :: Heap a b -> () #

(NFData t, NFData e) => NFData (ParseError t e) 
Instance details

Defined in Text.Megaparsec.Error

Methods

rnf :: ParseError t e -> () #

(NFData p, NFData v) => NFData (IntPSQ p v) 
Instance details

Defined in Data.IntPSQ.Internal

Methods

rnf :: IntPSQ p v -> () #

(NFData k, NFData v) => NFData (Leaf k v) 
Instance details

Defined in Data.HashMap.Base

Methods

rnf :: Leaf k v -> () #

NFData (MVector s a) 
Instance details

Defined in Data.Vector.Unboxed.Base

Methods

rnf :: MVector s a -> () #

NFData (MVector s a) 
Instance details

Defined in Data.Vector.Storable.Mutable

Methods

rnf :: MVector s a -> () #

NFData (MVector s a) 
Instance details

Defined in Data.Vector.Primitive.Mutable

Methods

rnf :: MVector s a -> () #

(NFData a1, NFData a2, NFData a3) => NFData (a1, a2, a3) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a1, a2, a3) -> () #

NFData a => NFData (Const a b)

Since: deepseq-1.4.0.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Const a b -> () #

NFData (a :~: b)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a :~: b) -> () #

(NFData k, NFData p, NFData v) => NFData (Bucket k p v) 
Instance details

Defined in Data.HashPSQ.Internal

Methods

rnf :: Bucket k p v -> () #

(NFData k, NFData p, NFData v) => NFData (LTree k p v) 
Instance details

Defined in Data.OrdPSQ.Internal

Methods

rnf :: LTree k p v -> () #

(NFData k, NFData p, NFData v) => NFData (Elem k p v) 
Instance details

Defined in Data.OrdPSQ.Internal

Methods

rnf :: Elem k p v -> () #

(NFData p, NFData k, NFData v) => NFData (HashPSQ k p v) 
Instance details

Defined in Data.HashPSQ.Internal

Methods

rnf :: HashPSQ k p v -> () #

(NFData k, NFData p, NFData v) => NFData (OrdPSQ k p v) 
Instance details

Defined in Data.OrdPSQ.Internal

Methods

rnf :: OrdPSQ k p v -> () #

NFData b => NFData (Tagged s b) 
Instance details

Defined in Data.Tagged

Methods

rnf :: Tagged s b -> () #

(NFData a1, NFData a2, NFData a3, NFData a4) => NFData (a1, a2, a3, a4) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a1, a2, a3, a4) -> () #

(NFData1 f, NFData1 g, NFData a) => NFData (Product f g a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Product f g a -> () #

(NFData1 f, NFData1 g, NFData a) => NFData (Sum f g a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: Sum f g a -> () #

NFData (a :~~: b)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a :~~: b) -> () #

(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a1, a2, a3, a4, a5) -> () #

(NFData1 f, NFData1 g, NFData a) => NFData (Compose f g a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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) 
Instance details

Defined in Control.DeepSeq

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) 
Instance details

Defined in Control.DeepSeq

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) 
Instance details

Defined in Control.DeepSeq

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) 
Instance details

Defined in Control.DeepSeq

Methods

rnf :: (a1, a2, a3, a4, a5, a6, a7, a8, a9) -> () #

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: deepseq-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: deepseq-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: deepseq-1.2.0.0

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

Deeply strict version of <$>.

Since: deepseq-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: deepseq-1.4.3.0

class NFData1 (f :: * -> *) where #

A class of functors that can be fully evaluated.

Since: deepseq-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.

Instances
NFData1 []

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> [a] -> () #

NFData1 Maybe

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Ratio

Available on base >=4.9

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Ptr

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 FunPtr

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 IORef

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Fixed

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Min

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Max

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 First

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Last

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 WrappedMonoid

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Option

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 StableName

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 ZipList

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Identity

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 First

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Last

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Dual

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Sum

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Product

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 Down

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 MVar

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 NonEmpty

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData a => NFData1 (Either a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> Either a a0 -> () #

NFData a => NFData1 ((,) a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> (a, a0) -> () #

NFData a => NFData1 (Array a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> Array a a0 -> () #

NFData a => NFData1 (Arg a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> Arg a a0 -> () #

NFData1 (Proxy :: * -> *)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 (STRef s)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> STRef s a -> () #

(NFData a1, NFData a2) => NFData1 ((,,) a1 a2)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> (a1, a2, a) -> () #

NFData a => NFData1 (Const a :: * -> *)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> Const a a0 -> () #

NFData1 ((:~:) a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> (a :~: a0) -> () #

(NFData a1, NFData a2, NFData a3) => NFData1 ((,,,) a1 a2 a3)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> (a1, a2, a3, a) -> () #

(NFData1 f, NFData1 g) => NFData1 (Product f g)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

(NFData1 f, NFData1 g) => NFData1 (Sum f g)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData1 ((:~~:) a :: * -> *)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a0 -> ()) -> (a :~~: a0) -> () #

(NFData a1, NFData a2, NFData a3, NFData a4) => NFData1 ((,,,,) a1 a2 a3 a4)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf :: (a -> ()) -> (a1, a2, a3, a4, a) -> () #

(NFData1 f, NFData1 g) => NFData1 (Compose f g)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData1 ((,,,,,) a1 a2 a3 a4 a5)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

class NFData2 (p :: * -> * -> *) where #

A class of bifunctors that can be fully evaluated.

Since: deepseq-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: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData2 (,)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData2 Array

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData2 Arg

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData2 STRef

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData a1 => NFData2 ((,,) a1)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a, b) -> () #

NFData2 (Const :: * -> * -> *)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

NFData2 ((:~:) :: * -> * -> *)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

(NFData a1, NFData a2) => NFData2 ((,,,) a1 a2)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a, b) -> () #

NFData2 ((:~~:) :: * -> * -> *)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

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

(NFData a1, NFData a2, NFData a3) => NFData2 ((,,,,) a1 a2 a3)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf2 :: (a -> ()) -> (b -> ()) -> (a1, a2, a3, a, b) -> () #

(NFData a1, NFData a2, NFData a3, NFData a4) => NFData2 ((,,,,,) a1 a2 a3 a4)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

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: deepseq-1.4.3.0

Evaluation strategies

data Eval a #

Eval is a Monad that makes it easier to define parallel strategies. It is a strict identity monad: that is, in

m >>= f

m is evaluated before the result is passed to f.

instance Monad Eval where
  return  = Done
  m >>= k = case m of
              Done x -> k x

If you wanted to construct a Strategy for a pair that sparked the first component in parallel and then evaluated the second component, you could write

myStrat :: Strategy (a,b)
myStrat (a,b) = do { a' <- rpar a; b' <- rseq b; return (a',b') }

Alternatively, you could write this more compactly using the Applicative style as

myStrat (a,b) = (,) <$> rpar a <*> rseq b
Instances
Monad Eval 
Instance details

Defined in Control.Parallel.Strategies

Methods

(>>=) :: Eval a -> (a -> Eval b) -> Eval b #

(>>) :: Eval a -> Eval b -> Eval b #

return :: a -> Eval a #

fail :: String -> Eval a #

Functor Eval 
Instance details

Defined in Control.Parallel.Strategies

Methods

fmap :: (a -> b) -> Eval a -> Eval b #

(<$) :: a -> Eval b -> Eval a #

MonadFix Eval 
Instance details

Defined in Control.Parallel.Strategies

Methods

mfix :: (a -> Eval a) -> Eval a #

Applicative Eval 
Instance details

Defined in Control.Parallel.Strategies

Methods

pure :: a -> Eval a #

(<*>) :: Eval (a -> b) -> Eval a -> Eval b #

liftA2 :: (a -> b -> c) -> Eval a -> Eval b -> Eval c #

(*>) :: Eval a -> Eval b -> Eval b #

(<*) :: Eval a -> Eval b -> Eval a #

runEval :: Eval a -> a #

Pull the result out of the monad.

type Strategy a = a -> Eval a #

A Strategy is a function that embodies a parallel evaluation strategy. The function traverses (parts of) its argument, evaluating subexpressions in parallel or in sequence.

A Strategy may do an arbitrary amount of evaluation of its argument, but should not return a value different from the one it was passed.

Parallel computations may be discarded by the runtime system if the program no longer requires their result, which is why a Strategy function returns a new value equivalent to the old value. The intention is that the program applies the Strategy to a structure, and then uses the returned value, discarding the old value. This idiom is expressed by the using function.

using :: a -> Strategy a -> a infixl 0 #

Evaluate a value using the given Strategy.

x `using` s = runEval (s x)

withStrategy :: Strategy a -> a -> a #

evaluate a value using the given Strategy. This is simply using with the arguments reversed.

dot :: Strategy a -> Strategy a -> Strategy a infixr 9 #

Compose two strategies sequentially. This is the analogue to function composition on strategies.

For any strategies strat1, strat2, and strat3,

(strat1 `dot` strat2) `dot` strat3 == strat1 `dot` (strat2 `dot` strat3)
strat1 `dot` strat1 = strat1
strat1 `dot` r0 == strat1
strat2 `dot` strat1 == strat2 . withStrategy strat1

rseq :: Strategy a #

rseq evaluates its argument to weak head normal form.

rseq == evalSeq Control.Seq.rseq

rdeepseq :: NFData a => Strategy a #

rdeepseq fully evaluates its argument.

rdeepseq == evalSeq Control.Seq.rdeepseq

evalTraversable :: Traversable t => Strategy a -> Strategy (t a) #

Evaluate the elements of a traversable data structure according to the given strategy.

evalList :: Strategy a -> Strategy [a] #

Evaluate each element of a list according to the given strategy. Equivalent to evalTraversable at the list type.

evalTuple2 :: Strategy a -> Strategy b -> Strategy (a, b) #

evalTuple3 :: Strategy a -> Strategy b -> Strategy c -> Strategy (a, b, c) #

evalTuple4 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy (a, b, c, d) #

evalTuple5 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy (a, b, c, d, e) #

evalTuple6 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy (a, b, c, d, e, f) #

evalTuple7 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy (a, b, c, d, e, f, g) #

evalTuple8 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy (a, b, c, d, e, f, g, h) #

evalTuple9 :: Strategy a -> Strategy b -> Strategy c -> Strategy d -> Strategy e -> Strategy f -> Strategy g -> Strategy h -> Strategy i -> Strategy (a, b, c, d, e, f, g, h, i) #