reanimate-1.1.5.0: Animation library based on SVGs.
CopyrightWritten by David Himmelstrup
LicenseUnlicense
Maintainerlemmih@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Reanimate.Memo

Description

With animations defined as SVG images over time, it is unfortunately quite easy to write inefficient code where expensive expressions are re-evaluated for every frame even if nothing has changed. This get around this issue, this module defines a global key-value table that can store expensive expressions such that they are evaluated only once.

There is currently no way to clear values from the table and it is your own responsibility to not consume all available memory.

Synopsis

Documentation

data Key Source #

Keys can either by any boxed object with identity (to be compared with StableNames) or a primitive type with an Eq instance.

Constructors

forall a. Key !a 
forall a.(Typeable a, Eq a, Ord a) => KeyPrim !a 

memo :: Typeable a => [Key] -> a -> a Source #

Cache expensive value in global store. You must guarantee that the key uniquely determines the value.