uni-util- Utilities for the uniform workbench



VariableSet allow us to track changes to an unordered mutable set. The elements of the set are keyed by instancing HasKey with some Ord instance; this allows us to set up a special HasKey instance for this module without committing us to that Ord instance everywhere.



class Ord key => HasKey x key | x -> key whereSource


toKey :: x -> keySource

newtype Keyed x Source


Keyed x 


HasKey x key => Eq (Keyed x)

HasKey specifies the ordering to use (without committing us to a particular Ord instance elsewhere).

HasKey x key => Ord (Keyed x) 

data VariableSetUpdate x Source

Encodes the updates to a variable set. BeginGroup does not actually alter the set itself, but indicate that a group of updates is about to begin, terminated by EndGroup. This prevents the client from trying to recalculate the state after every single update.

BeginGroup/EndGroup may be nested (though I don't have any application for that yet).


Functor VariableSetUpdate 
HasKey x key => HasSource (VariableSet x) [x] (VariableSetUpdate x) 
Ord key => HasSource (VariableMapSet key elt element) [element] (VariableSetUpdate element) 

newtype VariableSet x Source


VariableSet (Broadcaster (VariableSetData x) (VariableSetUpdate x)) 

newEmptyVariableSet :: HasKey x key => IO (VariableSet x)Source

Create a new empty variable set.

newVariableSet :: HasKey x key => [x] -> IO (VariableSet x)Source

Create a new variable set with given contents

updateSet :: HasKey x key => VariableSet x -> VariableSetUpdate x -> IO ()Source

Update a variable set in some way.

setVariableSet :: HasKey x key => VariableSet x -> [x] -> IO ()Source

Set the elements of the variable set.

listToSetSource :: Ord x => SimpleSource [x] -> VariableSetSource xSource

Creates a VariableSetSource whose elements are the same as those of the corresponding list.