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

Copyright(c) 2014, Andrew G. Seniuk
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.

A typical use of bounded forcing is to prevent resource leaks in lazy streaming, by forcing chunks of data of bounded but sufficient depth for the consumer to make progress.

Another use is to ensure any exceptions hidden within lazy fields of a data structure do not 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). Unlike DeepSeq, potentially infinite 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 should also be possible (using 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 
Eq a => Eq (Rose a) 
Show a => Show (Rose a) 
Generic (Rose a) 
NFData a => NFData (Rose a) 
Typeable (* -> *) Rose 
type Rep (Rose a) 

Forced evaluation "molecular style"

Generic deriving support via Generics.SOP

Re-exported