on develop help sign in
Merge pull request #7 from reflex-frp/jam@fix-docs
139e64eJohn Ericson
README.md+10
@@ -1,3 +1,13 @@
1## Patch
1## Patch
2
2
3Infrastructure for writing patches which act on other types.
3Infrastructure for writing patches which act on other types.
4+
5+A `Patch` type represents a kind of change made to a datastructure.
6+
7+```haskell
8+class Patch p where
9+ type PatchTarget p :: *
10+ -- | Apply the patch p a to the value a. If no change is needed, return
11+ -- 'Nothing'.
12+ apply :: p -> PatchTarget p -> Maybe (PatchTarget p)
13+```
src/Data/Patch/MapWithMove.hs+1−1
@@ -25,7 +25,7 @@ import qualified Data.Set as Set
25import Data.These (These(..))
25import Data.These (These(..))
26import Data.Tuple
26import Data.Tuple
27
27
28−-- | Patch a DMap with additions, deletions, and moves. Invariant: If key @k1@
28+-- | Patch a Map with additions, deletions, and moves. Invariant: If key @k1@
29-- is coming from @From_Move k2@, then key @k2@ should be going to @Just k1@,
29-- is coming from @From_Move k2@, then key @k2@ should be going to @Just k1@,
30-- and vice versa. There should never be any unpaired From/To keys.
30-- and vice versa. There should never be any unpaired From/To keys.
31newtype PatchMapWithMove k v = PatchMapWithMove (Map k (NodeInfo k v)) deriving (Show, Eq, Ord, Functor, Foldable, Traversable)
31newtype PatchMapWithMove k v = PatchMapWithMove (Map k (NodeInfo k v)) deriving (Show, Eq, Ord, Functor, Foldable, Traversable)