patch-0.0.8.0: Data structures for describing changes to other data structures.

Safe HaskellNone
LanguageHaskell2010

Data.Patch.Map

Description

Patches of this type consist only of insertions (including overwrites) and deletions.

Synopsis

Documentation

newtype PatchMap k v Source #

A set of changes to a Map. Any element may be inserted/updated or deleted. Insertions are represented as values wrapped in Just, while deletions are represented as Nothings

Constructors

PatchMap 

Fields

Instances
FunctorWithIndex k (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

imap :: (k -> a -> b) -> PatchMap k a -> PatchMap k b #

FoldableWithIndex k (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

ifoldMap :: Monoid m => (k -> a -> m) -> PatchMap k a -> m #

ifoldMap' :: Monoid m => (k -> a -> m) -> PatchMap k a -> m #

ifoldr :: (k -> a -> b -> b) -> b -> PatchMap k a -> b #

ifoldl :: (k -> b -> a -> b) -> b -> PatchMap k a -> b #

ifoldr' :: (k -> a -> b -> b) -> b -> PatchMap k a -> b #

ifoldl' :: (k -> b -> a -> b) -> b -> PatchMap k a -> b #

TraversableWithIndex k (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

itraverse :: Applicative f => (k -> a -> f b) -> PatchMap k a -> f (PatchMap k b) #

FunctorWithIndex k (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

imap :: (k -> a -> b) -> PatchMap k a -> PatchMap k b #

imapped :: IndexedSetter k (PatchMap k a) (PatchMap k b) a b #

FoldableWithIndex k (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

ifoldMap :: Monoid m => (k -> a -> m) -> PatchMap k a -> m #

ifolded :: IndexedFold k (PatchMap k a) a #

ifoldr :: (k -> a -> b -> b) -> b -> PatchMap k a -> b #

ifoldl :: (k -> b -> a -> b) -> b -> PatchMap k a -> b #

ifoldr' :: (k -> a -> b -> b) -> b -> PatchMap k a -> b #

ifoldl' :: (k -> b -> a -> b) -> b -> PatchMap k a -> b #

TraversableWithIndex k (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

itraverse :: Applicative f => (k -> a -> f b) -> PatchMap k a -> f (PatchMap k b) #

itraversed :: IndexedTraversal k (PatchMap k a) (PatchMap k b) a b #

Functor (PatchMap k) Source #

fmapping a PatchMap will alter all of the values it will insert. Deletions are unaffected.

Instance details

Defined in Data.Patch.Map

Methods

fmap :: (a -> b) -> PatchMap k a -> PatchMap k b #

(<$) :: a -> PatchMap k b -> PatchMap k a #

Foldable (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

fold :: Monoid m => PatchMap k m -> m #

foldMap :: Monoid m => (a -> m) -> PatchMap k a -> m #

foldr :: (a -> b -> b) -> b -> PatchMap k a -> b #

foldr' :: (a -> b -> b) -> b -> PatchMap k a -> b #

foldl :: (b -> a -> b) -> b -> PatchMap k a -> b #

foldl' :: (b -> a -> b) -> b -> PatchMap k a -> b #

foldr1 :: (a -> a -> a) -> PatchMap k a -> a #

foldl1 :: (a -> a -> a) -> PatchMap k a -> a #

toList :: PatchMap k a -> [a] #

null :: PatchMap k a -> Bool #

length :: PatchMap k a -> Int #

elem :: Eq a => a -> PatchMap k a -> Bool #

maximum :: Ord a => PatchMap k a -> a #

minimum :: Ord a => PatchMap k a -> a #

sum :: Num a => PatchMap k a -> a #

product :: Num a => PatchMap k a -> a #

Traversable (PatchMap k) Source # 
Instance details

Defined in Data.Patch.Map

Methods

traverse :: Applicative f => (a -> f b) -> PatchMap k a -> f (PatchMap k b) #

sequenceA :: Applicative f => PatchMap k (f a) -> f (PatchMap k a) #

mapM :: Monad m => (a -> m b) -> PatchMap k a -> m (PatchMap k b) #

sequence :: Monad m => PatchMap k (m a) -> m (PatchMap k a) #

(Eq k, Eq v) => Eq (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

Methods

(==) :: PatchMap k v -> PatchMap k v -> Bool #

(/=) :: PatchMap k v -> PatchMap k v -> Bool #

(Ord k, Ord v) => Ord (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

Methods

compare :: PatchMap k v -> PatchMap k v -> Ordering #

(<) :: PatchMap k v -> PatchMap k v -> Bool #

(<=) :: PatchMap k v -> PatchMap k v -> Bool #

(>) :: PatchMap k v -> PatchMap k v -> Bool #

(>=) :: PatchMap k v -> PatchMap k v -> Bool #

max :: PatchMap k v -> PatchMap k v -> PatchMap k v #

min :: PatchMap k v -> PatchMap k v -> PatchMap k v #

(Ord k, Read k, Read v) => Read (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

(Show k, Show v) => Show (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

Methods

showsPrec :: Int -> PatchMap k v -> ShowS #

show :: PatchMap k v -> String #

showList :: [PatchMap k v] -> ShowS #

Ord k => Semigroup (PatchMap k v) Source #

a <> b will apply the changes of b and then apply the changes of a. If the same key is modified by both patches, the one on the left will take precedence.

Instance details

Defined in Data.Patch.Map

Methods

(<>) :: PatchMap k v -> PatchMap k v -> PatchMap k v #

sconcat :: NonEmpty (PatchMap k v) -> PatchMap k v #

stimes :: Integral b => b -> PatchMap k v -> PatchMap k v #

Ord k => Monoid (PatchMap k v) Source #

The empty PatchMap contains no insertions or deletions

Instance details

Defined in Data.Patch.Map

Methods

mempty :: PatchMap k v #

mappend :: PatchMap k v -> PatchMap k v -> PatchMap k v #

mconcat :: [PatchMap k v] -> PatchMap k v #

Wrapped (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

Associated Types

type Unwrapped (PatchMap k v) :: Type #

Methods

_Wrapped' :: Iso' (PatchMap k v) (Unwrapped (PatchMap k v)) #

Ord k => DecidablyEmpty (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

Methods

isEmpty :: PatchMap k v -> Bool Source #

Ord k => Patch (PatchMap k v) Source #

Apply the insertions or deletions to a given Map.

Instance details

Defined in Data.Patch.Map

Associated Types

type PatchTarget (PatchMap k v) :: Type Source #

Methods

apply :: PatchMap k v -> PatchTarget (PatchMap k v) -> Maybe (PatchTarget (PatchMap k v)) Source #

PatchMap k1 v1 ~ t => Rewrapped (PatchMap k2 v2) t Source # 
Instance details

Defined in Data.Patch.Map

type Unwrapped (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

type Unwrapped (PatchMap k v) = Map k (Maybe v)
type PatchTarget (PatchMap k v) Source # 
Instance details

Defined in Data.Patch.Map

type PatchTarget (PatchMap k v) = Map k v

patchMapNewElements :: PatchMap k v -> [v] Source #

Returns all the new elements that will be added to the Map

patchMapNewElementsMap :: PatchMap k v -> Map k v Source #

Returns all the new elements that will be added to the Map