data-kiln- Sculpt mutable recursive data with reference equality; bake it using a data kiln into an immutable lazy structure

Safe HaskellNone




data Squishy s a Source

The Squishy monad is a monad with mutable references and optional reference identity


runSquishy :: forall a. (forall s. Squishy s a) -> a Source

Runs a Squishy computation, returning a pure value

data Identifier s Source

A unique identifier. Only possible to create while making a Distinct value.


data Distinct s a Source

Data with faked reference equality; the interface provided guarantees that every Distinct value has a unique Identifier.


Eq (Distinct s a) 
Ord (Distinct s a) 

distinguish :: a -> Squishy s (Distinct s a) Source

The only way to create a Distinct value is to generate a new identifier for it in the Squishy monad.

conflate :: Distinct s a -> a Source

Extracts the value stored in a Distinct

identify :: Distinct s a -> Identifier s Source

Extracts the unique identifier for a Distinct

data Ref s a Source

A mutable reference in the Squishy monad.

newRef :: a -> Squishy s (Ref s a) Source

Make a new reference.

readRef :: Ref s a -> Squishy s a Source

Read the value of a reference.

writeRef :: Ref s a -> a -> Squishy s () Source

Write a new value to a reference.

modifyRef :: Ref s a -> (a -> a) -> Squishy s () Source

Use the provided function to modify the contained value in a reference.