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

Safe HaskellNone
LanguageHaskell2010

Data.Patch.DMap

Description

Patches on DMap that consist only of insertions (or overwrites) and deletions.

Synopsis

Documentation

newtype PatchDMap k v Source #

A set of changes to a DMap. Any element may be inserted/updated or deleted. Insertions are represented as ComposeMaybe (Just value), while deletions are represented as ComposeMaybe Nothing.

Constructors

PatchDMap 

Fields

Instances
GCompare k2 => Semigroup (PatchDMap k2 v) Source # 
Instance details

Defined in Data.Patch.DMap

Methods

(<>) :: PatchDMap k2 v -> PatchDMap k2 v -> PatchDMap k2 v #

sconcat :: NonEmpty (PatchDMap k2 v) -> PatchDMap k2 v #

stimes :: Integral b => b -> PatchDMap k2 v -> PatchDMap k2 v #

GCompare k2 => Monoid (PatchDMap k2 v) Source # 
Instance details

Defined in Data.Patch.DMap

Methods

mempty :: PatchDMap k2 v #

mappend :: PatchDMap k2 v -> PatchDMap k2 v -> PatchDMap k2 v #

mconcat :: [PatchDMap k2 v] -> PatchDMap k2 v #

GCompare k2 => DecidablyEmpty (PatchDMap k2 v) Source # 
Instance details

Defined in Data.Patch.DMap

Methods

isEmpty :: PatchDMap k2 v -> Bool Source #

GCompare k2 => Patch (PatchDMap k2 v) Source #

Apply the insertions or deletions to a given DMap.

Instance details

Defined in Data.Patch.DMap

Associated Types

type PatchTarget (PatchDMap k2 v) :: Type Source #

Methods

apply :: PatchDMap k2 v -> PatchTarget (PatchDMap k2 v) -> Maybe (PatchTarget (PatchDMap k2 v)) Source #

type PatchTarget (PatchDMap k2 v) Source # 
Instance details

Defined in Data.Patch.DMap

type PatchTarget (PatchDMap k2 v) = DMap k2 v

mapPatchDMap :: (forall a. v a -> v' a) -> PatchDMap k v -> PatchDMap k v' Source #

Map a function v a -> v' a over any inserts/updates in the given PatchDMap k v to produce a PatchDMap k v'.

traversePatchDMap :: Applicative f => (forall a. v a -> f (v' a)) -> PatchDMap k v -> f (PatchDMap k v') Source #

Map an effectful function v a -> f (v' a) over any inserts/updates in the given PatchDMap k v to produce a PatchDMap k v'.

traversePatchDMapWithKey :: Applicative m => (forall a. k a -> v a -> m (v' a)) -> PatchDMap k v -> m (PatchDMap k v') Source #

Map an effectful function k a -> v a -> f (v' a) over any inserts/updates in the given PatchDMap k v to produce a PatchDMap k v'.

weakenPatchDMapWith :: (forall a. v a -> v') -> PatchDMap k v -> PatchMap (Some k) v' Source #

Weaken a PatchDMap k v to a PatchMap (Some k) v' using a function v a -> v' to weaken each value contained in the patch.

patchDMapToPatchMapWith :: (v a -> v') -> PatchDMap (Const2 k a) v -> PatchMap k v' Source #

Convert a weak PatchDMap (Const2 k a) v where the a is known by way of the Const2 into a PatchMap k v' using a rank 1 function v a -> v'.

const2PatchDMapWith :: forall k v v' a. (v -> v' a) -> PatchMap k v -> PatchDMap (Const2 k a) v' Source #

Convert a PatchMap k v into a PatchDMap (Const2 k a) v' using a function v -> v' a.

const2IntPatchDMapWith :: forall v f a. (v -> f a) -> PatchIntMap v -> PatchDMap (Const2 Key a) f Source #

Convert a PatchIntMap v into a PatchDMap (Const2 Int a) v' using a function v -> v' a.

getDeletions :: GCompare k => PatchDMap k v -> DMap k v' -> DMap k v' Source #

Get the values that will be replaced or deleted if the given patch is applied to the given DMap.