Module

Data.Incremental.Map

Package
purescript-incremental-functions
Repository
paf31/purescript-incremental-functions

A change structure for maps, and helper functions.

#IMap Source

newtype IMap k v

A change structure for Map which tracks changes for each key.

Constructors

Instances

#MapChanges Source

newtype MapChanges k v dv

A change for each possible key.

Constructors

Instances

#MapChange Source

data MapChange v dv

A change for a single key is an addition, removal, or update.

Constructors

Instances

#insert Source

insert :: forall dv v k. Ord k => Patch v dv => k -> v -> Change (IMap k v)

#remove Source

remove :: forall dv v k. Ord k => Patch v dv => k -> Change (IMap k v)

#updateAt Source

updateAt :: forall dv v k. Ord k => Patch v dv => k -> Change v -> Change (IMap k v)

#static Source

static :: forall dv v k. Ord k => Patch v dv => Map k (Jet v) -> Jet (IMap k v)

Construct a map whose values can change but whose keys are fixed.

#singleton Source

singleton :: forall dv v k. Ord k => Patch v dv => k -> Jet v -> Jet (IMap k v)

Construct a map from a key/value pair.

#map Source

map :: forall db b da a k. Ord k => Patch a da => Patch b db => (Jet a -> Jet b) -> Jet (IMap k a) -> Jet (IMap k b)

Update every key by applying a function.

#modifyAt Source

modifyAt :: forall dv v k. Ord k => Patch v dv => k -> (Jet v -> Jet v) -> Jet (IMap k v) -> Jet (IMap k v)

Update a single key by applying a function.

#size Source

size :: forall da a k. Ord k => Patch a da => Jet (IMap k a) -> Jet (Atomic Int)

Compute the size of an IMap, incrementally.

#zip Source

zip :: forall db b da a k. Ord k => Patch a da => Patch b db => Jet (IMap k a) -> Jet (IMap k b) -> Jet (IMap k (Tuple a b))

Zip two maps, keeping those keys which are common to both input maps.