Freezing, thawing, and copy elision http://github.com/glehel/phasechange
|Latest on Hackage:||0.1|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
This library provides a class for types which present the same underlying data in both an immutable (frozen) as well as a mutable (thawed) form, and various functions to manipulate them. Some of the functions allow for copy elision.
Instances are provided for the array types from the
vector packages, but this is mainly for completeness: there is
nothing these instances do which
vector doesn't already do better. The main purpose, rather, is to assist new types, for instance types whose implementation relies on destructive-update foreign imports, and cases when writing a full stream fusion framework isn't practical.
There are three modules:
- This module exports the class without its methods, together with functions which guarantee referential transparency (provided that instances are well-behaved). This is the module you should normally import to work with PhaseChangeable data.
- This module exports functions which can break referential transparency if they are used improperly. Be careful.
- This module exports the class along with its methods. Import it if you want to define a new instance.