deepseq-bounded-0.7.0.0: Bounded deepseq, including support for generic deriving

CopyrightAndrew G. Seniuk 2014-2015
LicenseBSD-style (see the file LICENSE)
MaintainerAndrew Seniuk <rasfar@gmail.com>
Stabilityprovisional
Portabilityportable (but GHC for a few modules using generics)
Safe HaskellNone
LanguageHaskell2010

Control.DeepSeq.Bounded

Contents

Description

We provide forcing functions which take a non-strict value of a datatype, and force its evaluation in a pricipled way. As with NFData, one should bear in mind the difference between forcing and demand: in order for your forcing to take effect, demand must be placed on the forcing function itself by the course of execution.

Artificial forcing is most commonly used to suppress space leak, but it has many uses besides. Another is to ensure that exceptions hidden within lazy fields of a data structure don't leak outside the scope of the exception handler; another is to force evaluation of a data structure in one thread, before passing it to another thread (preventing work moving to the wrong threads, a form of time leak).

Unlike DeepSeq, potentially infinite values of coinductive data types are supported by principled bounding of deep evaluation.

Refer to comments in the deepseq package for more information on how artificial forcing can be useful.

Recently, control (static or dynamic) of parallelisation has been added. Control of evaluation order is also supported (via pseq).

Synopsis

Forced evaluation to an arbitrary finite depth

Forced evaluation over a pattern (arbitrary finite, or dynamic)

data Rose a Source

Constructors

Node a [Rose a] 

Instances

Functor Rose 
FF Pattern 
Eq a => Eq (Rose a) 
Show a => Show (Rose a) 
NFData a => NFData (Rose a) 
Typeable (* -> *) Rose 
data F Pattern = FPattern v 

Forced evaluation "molecular style"

Generic deriving support via Generics.SOP

Re-exported

"I can has data family?..."

class FF k where Source

Associated Types

data F k :: * -> * Source

Methods

phi :: (Generic v, NFDataN v, NFDataP v) => k -> F k v -> v Source

The constraints could probably shrink to just Generic with a bit of work... In fact, trying it now -- to do away with NFDataN and NFDataP classes, and just "alias the SOP generic functions", as did in Seqable... [Fail. for now]

Instances