Copyright | © 2021-2023 IOHK 2024 Cardano Foundation |
---|---|
License | Apache-2.0 |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.Delta.Set
Contents
Description
Delta types for Set
.
Single element
Delta type for Set
where a single element is deleted or added.
Instances
Show a => Show (DeltaSet1 a) Source # | |
Ord a => Delta (DeltaSet1 a) Source # | |
Eq a => Eq (DeltaSet1 a) Source # | |
Ord a => Ord (DeltaSet1 a) Source # | |
Defined in Data.Delta.Set | |
type Base (DeltaSet1 a) Source # | |
Defined in Data.Delta.Set |
The following cancellation laws hold:
apply [Insert a, Delete a] = apply (Insert a)
apply [Insert a, Insert a] = apply (Insert a)
apply [Delete a, Insert a] = apply (Delete a)
apply [Delete a, Delete a] = apply (Delete a)
Multiple elements
Delta type for a Set
where
collections of elements are inserted or deleted.
Instances
Ord a => Monoid (DeltaSet a) Source # | |
Ord a => Semigroup (DeltaSet a) Source # | Remember that the semigroup instance is required to satisfy the following properties: apply mempty = id apply (d1 <> d2) = apply d1 . apply d2 |
Ord a => Delta (DeltaSet a) Source # | |
Eq a => Eq (DeltaSet a) Source # | |
type Base (DeltaSet a) Source # | |
Defined in Data.Delta.Set |
diffSet :: Ord a => Set a -> Set a -> DeltaSet a Source #
The smallest delta that changes the second argument to the first argument.
new = apply (diffSet new old) old
diffSet (Set.fromList "ac") (Set.fromList "ab") = deltaSetFromList [Insert 'c', Delete 'b']
listFromDeltaSet :: DeltaSet a -> [DeltaSet1 a] Source #