tweak-0.1.0.1: A library for incremental computing

Safe HaskellNone

Control.Tweak.Tweakable

Contents

Description

Tweakable expressions can be updated incrementally. This module exports the central expression type for incremental computations. However, the Tweakable expressions are meant to be created with Maker.

Use readCache to retrieve the value of an Tweakable at anytime.

Synopsis

The Main Expression Type

data Tweakable a whereSource

An expression that can be incrementally updated. Tweakable is basically an simple Applicative with a cached value.

Constructors

App :: Var b -> Tweakable (a -> b) -> Tweakable a -> Tweakable b 
Pure :: Var a -> Tweakable a 

Accessors

getVar :: Tweakable a -> Var aSource

Get the cache i.e. the Var from the Tweakable

getAnyVar :: Tweakable a -> AnyVarSource

Get the cache and put in an AnyVar existential wrapper

readCache :: Tweakable a -> IO aSource

Read the cache of a Tweakable. This is nothing more than

 
   readCache = atomically . readCacheSTM  

readCacheSTM :: Tweakable a -> STM aSource

Read the cache of a Tweakable. See readCache for an IO version.