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 where
- toKey :: x -> key
- newtype Keyed x = Keyed x
- data VariableSetUpdate x
- newtype VariableSet x = VariableSet (Broadcaster (VariableSetData x) (VariableSetUpdate x))
- newEmptyVariableSet :: HasKey x key => IO (VariableSet x)
- newVariableSet :: HasKey x key => [x] -> IO (VariableSet x)
- updateSet :: HasKey x key => VariableSet x -> VariableSetUpdate x -> IO ()
- setVariableSet :: HasKey x key => VariableSet x -> [x] -> IO ()
- type VariableSetSource x = Source [x] (VariableSetUpdate x)
- emptyVariableSetSource :: VariableSetSource x
- mapVariableSetSourceIO' :: (x -> IO (Maybe y)) -> VariableSetSource x -> VariableSetSource y
- concatVariableSetSource :: VariableSetSource x -> VariableSetSource x -> VariableSetSource x
- mapVariableSetSource :: (x -> y) -> VariableSetSource x -> VariableSetSource y
- singletonSetSource :: SimpleSource x -> VariableSetSource x
- listToSetSource :: Ord x => SimpleSource [x] -> VariableSetSource x
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).
Create a new variable set with given contents
Update a variable set in some way.
Set the elements of the variable set.