Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Data.Map.Diff.Strict.Internal
Description
See the module documentation for Data.Map.Diff.Strict.
Synopsis
- data Delta v
- newtype DeltaHistory v = DeltaHistory {
- getDeltaHistory :: NESeq (Delta v)
- newtype Diff k v = Diff (Map k (DeltaHistory v))
- keysSet :: Diff k v -> Set k
- diff :: (Ord k, Eq v) => Map k v -> Map k v -> Diff k v
- empty :: Diff k v
- fromMap :: Map k (Delta v) -> Diff k v
- fromMapDeletes :: Map k v -> Diff k v
- fromMapInserts :: Map k v -> Diff k v
- fromList :: Ord k => [(k, Delta v)] -> Diff k v
- fromListDeletes :: Ord k => [k] -> Diff k v
- fromListDeltaHistories :: Ord k => [(k, DeltaHistory v)] -> Diff k v
- fromListInserts :: Ord k => [(k, v)] -> Diff k v
- singleton :: Delta v -> DeltaHistory v
- singletonDelete :: DeltaHistory v
- singletonInsert :: v -> DeltaHistory v
- last :: DeltaHistory v -> Delta v
- null :: Diff k v -> Bool
- numDeletes :: Diff k v -> Int
- numInserts :: Diff k v -> Int
- size :: Diff k v -> Int
- applyDiff :: Ord k => Map k v -> Diff k v -> Map k v
- applyDiffForKeys :: Ord k => Map k v -> Set k -> Diff k v -> Map k v
- foldMapDelta :: Monoid m => (Delta v -> m) -> Diff k v -> m
- mapMaybeDiff :: (v -> Maybe v') -> Diff k v -> Diff k v'
- traverseDeltaWithKey_ :: Applicative t => (k -> Delta v -> t a) -> Diff k v -> t ()
- filterOnlyKey :: (k -> Bool) -> Diff k v -> Diff k v
Types
A change to a value in a key-value store.
Instances
Foldable Delta Source # | |
Defined in Data.Map.Diff.Strict.Internal Methods fold :: Monoid m => Delta m -> m # foldMap :: Monoid m => (a -> m) -> Delta a -> m # foldMap' :: Monoid m => (a -> m) -> Delta a -> m # foldr :: (a -> b -> b) -> b -> Delta a -> b # foldr' :: (a -> b -> b) -> b -> Delta a -> b # foldl :: (b -> a -> b) -> b -> Delta a -> b # foldl' :: (b -> a -> b) -> b -> Delta a -> b # foldr1 :: (a -> a -> a) -> Delta a -> a # foldl1 :: (a -> a -> a) -> Delta a -> a # elem :: Eq a => a -> Delta a -> Bool # maximum :: Ord a => Delta a -> a # minimum :: Ord a => Delta a -> a # | |
Traversable Delta Source # | |
Functor Delta Source # | |
Generic (Delta v) Source # | |
Show v => Show (Delta v) Source # | |
Eq v => Eq (Delta v) Source # | |
NoThunks v => NoThunks (Delta v) Source # | |
type Rep (Delta v) Source # | |
Defined in Data.Map.Diff.Strict.Internal type Rep (Delta v) = D1 ('MetaData "Delta" "Data.Map.Diff.Strict.Internal" "diff-containers-1.3.0.0-inplace" 'False) (C1 ('MetaCons "Insert" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 v)) :+: C1 ('MetaCons "Delete" 'PrefixI 'False) (U1 :: Type -> Type)) |
newtype DeltaHistory v Source #
A non-empty history of changes to a value in a key-value store.
A history has an implicit sense of ordering according to time: from left to right. This means that the leftmost element in the history is the earliest change, while the rightmost element in the history is the latest change.
Constructors
DeltaHistory | |
Fields
|
Instances
A diff for key-value stores.
Constructors
Diff (Map k (DeltaHistory v)) |
Instances
Conversion
Construction
diff :: (Ord k, Eq v) => Map k v -> Map k v -> Diff k v Source #
Compute the difference between
s.Map
Maps
fromMapDeletes :: Map k v -> Diff k v Source #
creates a fromMapDeletes
m
that deletes all values in Diff
m
.
fromMapInserts :: Map k v -> Diff k v Source #
creates a fromMapInserts
m
that inserts all values in Diff
m
.
Lists
fromListDeletes :: Ord k => [k] -> Diff k v Source #
creates a fromListDeletes
xs
that deletes all values in Diff
xs
.
fromListDeltaHistories :: Ord k => [(k, DeltaHistory v)] -> Diff k v Source #
fromListInserts :: Ord k => [(k, v)] -> Diff k v Source #
creates a fromListInserts
xs
that inserts all values in Diff
xs
.
Delta history
singleton :: Delta v -> DeltaHistory v Source #
singletonInsert :: v -> DeltaHistory v Source #
Deconstruction
Delta history
last :: DeltaHistory v -> Delta v Source #
Query
Size
numDeletes :: Diff k v -> Int Source #
returns the number of deletes in the diff numDeletes
dd
.
Note: that is, the number of diff histories that have deletes as their last change.
numInserts :: Diff k v -> Int Source #
returns the number of inserts in the diff numInserts
dd
.
Note: that is, the number of diff histories that have inserts as their last change.
Applying diffs
applyDiffForKeys :: Ord k => Map k v -> Set k -> Diff k v -> Map k v Source #
Applies a diff to a
for a specific set of keys.Map
Folds and traversals
foldMapDelta :: Monoid m => (Delta v -> m) -> Diff k v -> m Source #
over the last delta in each delta history.foldMap
traverseDeltaWithKey_ :: Applicative t => (k -> Delta v -> t a) -> Diff k v -> t () Source #
Traversal with keys over the last delta in each delta history.