1{-# LANGUAGE TypeFamilies #-}
6-- This module defines the 'Patch' class, which is used by Reflex to manage
7-- changes to 'Reflex.Class.Incremental' values.
13import Reflex.Patch.Class as X
14import Reflex.Patch.DMap as X hiding (getDeletions)
15import Reflex.Patch.DMapWithMove as X (PatchDMapWithMove, const2PatchDMapWithMoveWith, mapPatchDMapWithMove,
16 patchDMapWithMoveToPatchMapWithMoveWith,
17 traversePatchDMapWithMoveWithKey, unPatchDMapWithMove,
18 unsafePatchDMapWithMove, weakenPatchDMapWithMoveWith)
19import Reflex.Patch.IntMap as X hiding (getDeletions)
20import Reflex.Patch.Map as X
21import Reflex.Patch.MapWithMove as X (PatchMapWithMove, patchMapWithMoveNewElements,
22 patchMapWithMoveNewElementsMap, unPatchMapWithMove,
23 unsafePatchMapWithMove)
24import Data.Map.Monoidal (MonoidalMap)
25import Data.Semigroup (Semigroup (..), (<>))
27-- | A 'Group' is a 'Monoid' where every element has an inverse.
28class (Semigroup q, Monoid q) => Group q where
31 r ~~ s = r <> negateG s
33-- | An 'Additive' 'Semigroup' is one where (<>) is commutative
34class Semigroup q => Additive q where
36-- | The elements of an 'Additive' 'Semigroup' can be considered as patches of their own type.
37newtype AdditivePatch p = AdditivePatch { unAdditivePatch :: p }
39instance Additive p => Patch (AdditivePatch p) where
40 type PatchTarget (AdditivePatch p) = p
41 apply (AdditivePatch p) q = Just $ p <> q
43instance (Ord k, Group q) => Group (MonoidalMap k q) where
44 negateG = fmap negateG
46instance (Ord k, Additive q) => Additive (MonoidalMap k q)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list