on develop help sign in
change MapWithMove2 to be MapWithMove.New
commitfa23898f02b57b30b531bafe5e37931b7beee255 authorE Cardenas <card@obsidian.systems> dateWed 8 Jan 2020, 12:50 (7 years ago) parentbf45826
3 files changed+8−8
reflex.cabal+1−1 src/Reflex/Patch.hs+1−1 src/Reflex/Patch/MapWithMove2.hs → src/Reflex/Patch/MapWithMove/New.hs+6−6
reflex.cabal+1−1
@@ -117,7 +117,7 @@ library
117117 Reflex.Patch.IntMap,
118118 Reflex.Patch.Map,
119119 Reflex.Patch.MapWithMove,
120− Reflex.Patch.MapWithMove2,
120+ Reflex.Patch.MapWithMove.New,
121121 Reflex.PerformEvent.Base,
122122 Reflex.PerformEvent.Class,
123123 Reflex.PostBuild.Base,
src/Reflex/Patch.hs+1−1
@@ -21,7 +21,7 @@ import Reflex.Patch.Map as X
2121import Reflex.Patch.MapWithMove as X (PatchMapWithMove, patchMapWithMoveNewElements,
2222 patchMapWithMoveNewElementsMap, unPatchMapWithMove,
2323 unsafePatchMapWithMove)
24−import Reflex.Patch.MapWithMove2 as X (PatchMapWithMove2, patchMapWithMove2NewElements,
24+import Reflex.Patch.MapWithMove.New as X (PatchMapWithMove2, patchMapWithMove2NewElements,
2525 patchMapWithMove2NewElementsMap, unPatchMapWithMove2,
2626 unsafePatchMapWithMove2)
2727
src/Reflex/Patch/MapWithMove2.hs → src/Reflex/Patch/MapWithMove/New.hsrenamed+6−6
@@ -7,7 +7,7 @@
77{-# LANGUAGE UndecidableInstances #-}
88-- | 'Patch'es on 'Map' that can insert, delete, and move values from one key to
99-- another
10−module Reflex.Patch.MapWithMove2 where
10+module Reflex.Patch.MapWithMove.New where
1111
1212import Reflex.Patch.Class
1313
@@ -25,7 +25,7 @@ import Data.These
2525import Data.Tuple
2626
2727-- | Patch a DMap with additions, deletions, and moves. Invariant: If key @k1@
28−-- is coming from @From_Move k2@, then key @k2@ should be going to @Just k1@,
28+-- is coming from @From_Move k@, then key @k2@ should be going to @Just k1@,
2929-- and vice versa. There should never be any unpaired From/To keys.
3030newtype PatchMapWithMove2 k p = PatchMapWithMove2 (Map k (NodeInfo k p))
3131deriving instance (Show k, Show p, Show (PatchTarget p)) => Show (PatchMapWithMove2 k p)
@@ -47,8 +47,8 @@ deriving instance (Eq k, Eq p, Eq (PatchTarget p)) => Eq (NodeInfo k p)
4747deriving instance (Ord k, Ord p, Ord (PatchTarget p)) => Ord (NodeInfo k p)
4848
4949-- | Create a 'PatchMapWithMove2', validating it
50−patchMapWithMove2 :: Ord k => Map k (NodeInfo k p) -> Maybe (PatchMapWithMove2 k p)
51−patchMapWithMove2 m = if valid then Just $ PatchMapWithMove2 m else Nothing
50+patchMapWithMove :: Ord k => Map k (NodeInfo k p) -> Maybe (PatchMapWithMove2 k p)
51+patchMapWithMove m = if valid then Just $ PatchMapWithMove2 m else Nothing
5252 where valid = forwardLinks == backwardLinks
5353 forwardLinks = Map.mapMaybe _nodeInfo_to m
5454 backwardLinks = Map.fromList $ catMaybes $ flip fmap (Map.toList m) $ \(to, p) ->
@@ -57,8 +57,8 @@ patchMapWithMove2 m = if valid then Just $ PatchMapWithMove2 m else Nothing
5757 _ -> Nothing
5858
5959-- | Create a 'PatchMapWithMove2' that inserts everything in the given 'Map'
60−patchMapWithMove2InsertAll :: Map k (PatchTarget p) -> PatchMapWithMove2 k p
61−patchMapWithMove2InsertAll m = PatchMapWithMove2 $ flip fmap m $ \v -> NodeInfo
60+patchMapWithMoveInsertAll :: Map k (PatchTarget p) -> PatchMapWithMove2 k p
61+patchMapWithMoveInsertAll m = PatchMapWithMove2 $ flip fmap m $ \v -> NodeInfo
6262 { _nodeInfo_from = From_Insert v
6363 , _nodeInfo_to = Nothing
6464 }