patch-0.0.0.2: Infrastructure for writing patches which act on other types.

Safe HaskellSafe
LanguageHaskell98

Data.Patch.Map

Description

Patches on Map that 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
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 #

(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 #

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 #

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