on develop help sign in
Add patchMapWithMoveInsertAll
e3e509aRyan Trinkle
src/Reflex/Patch/MapWithMove.hs+7
@@ -48,6 +48,13 @@ patchMapWithMove m = if valid then Just $ PatchMapWithMove m else Nothing
48 From_Move from -> Just (from, to)
48 From_Move from -> Just (from, to)
49 _ -> Nothing
49 _ -> Nothing
50
50
51+-- | Create a 'PatchMapWithMove' that inserts everything in the given 'Map'
52+patchMapWithMoveInsertAll :: Map k v -> PatchMapWithMove k v
53+patchMapWithMoveInsertAll m = PatchMapWithMove $ flip fmap m $ \v -> NodeInfo
54+ { _nodeInfo_from = From_Insert v
55+ , _nodeInfo_to = Nothing
56+ }
57+
51-- | Extract the internal representation of the 'PatchMapWithMove'
58-- | Extract the internal representation of the 'PatchMapWithMove'
52unPatchMapWithMove :: PatchMapWithMove k v -> Map k (NodeInfo k v)
59unPatchMapWithMove :: PatchMapWithMove k v -> Map k (NodeInfo k v)
53unPatchMapWithMove (PatchMapWithMove p) = p
60unPatchMapWithMove (PatchMapWithMove p) = p