reflex-0.5: Higher-order Functional Reactive Programming

Safe HaskellSafe
LanguageHaskell98

Reflex.Patch.Class

Description

The interface for types which represent changes made to other types

Synopsis

Documentation

class Patch p where Source #

A Patch type represents a kind of change made to a datastructure.

If an instance of Patch is also an instance of Semigroup, it should obey the law that applyAlways (f <> g) == applyAlways f . applyAlways g.

Minimal complete definition

apply

Associated Types

type PatchTarget p :: * Source #

Methods

apply :: p -> PatchTarget p -> Maybe (PatchTarget p) Source #

Apply the patch p a to the value a. If no change is needed, return Nothing.

Instances
Patch (Identity a) Source #

Identity can be used as a Patch that always fully replaces the value

Instance details

Defined in Reflex.Patch.Class

Associated Types

type PatchTarget (Identity a) :: * Source #

Patch (PatchIntMap a) Source #

Apply the insertions or deletions to a given IntMap.

Instance details

Defined in Reflex.Patch.IntMap

Associated Types

type PatchTarget (PatchIntMap a) :: * Source #

Additive p => Patch (AdditivePatch p) Source # 
Instance details

Defined in Reflex.Patch

Associated Types

type PatchTarget (AdditivePatch p) :: * Source #

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

Apply the insertions or deletions to a given Map.

Instance details

Defined in Reflex.Patch.Map

Associated Types

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

Methods

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

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

Apply the insertions, deletions, and moves to a given Map

Instance details

Defined in Reflex.Patch.MapWithMove

Associated Types

type PatchTarget (PatchMapWithMove k v) :: * Source #

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

Apply the insertions or deletions to a given DMap.

Instance details

Defined in Reflex.Patch.DMap

Associated Types

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

Methods

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

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

Apply the insertions, deletions, and moves to a given DMap.

Instance details

Defined in Reflex.Patch.DMapWithMove

Associated Types

type PatchTarget (PatchDMapWithMove k2 v) :: * Source #

applyAlways :: Patch p => p -> PatchTarget p -> PatchTarget p Source #

Apply a Patch; if it does nothing, return the original value

composePatchFunctions :: (Patch p, Semigroup p) => (PatchTarget p -> p) -> (PatchTarget p -> p) -> PatchTarget p -> p Source #

Like '(.)', but composes functions that return patches rather than functions that return new values. The Semigroup instance for patches must apply patches right-to-left, like '(.)'.