@@ -111,8 +111,8 @@ pattern Coerce x <- (coerce -> x)
111
111
112
112
{-# COMPLETE PatchMapWithMove #-}
113
113
pattern PatchMapWithMove :: Map k (NodeInfo k v ) -> PatchMapWithMove k v
114
- -- | Extract the representation of the 'PatchMapWithMove' as a map of
115
- -- 'NodeInfo'.
114
+ -- | Extract the representation of the t 'PatchMapWithMove' as a map of
115
+ -- t 'NodeInfo'.
116
116
unPatchMapWithMove :: PatchMapWithMove k v -> Map k (NodeInfo k v )
117
117
pattern PatchMapWithMove { unPatchMapWithMove } = PatchMapWithMove' (PatchMapWithPatchingMove (Coerce unPatchMapWithMove))
118
118
@@ -147,27 +147,27 @@ instance L.FoldableWithIndex k (PatchMapWithMove k) where ifoldMap = Data.Fold
147
147
instance L. TraversableWithIndex k (PatchMapWithMove k ) where itraverse = Data.Traversable.WithIndex. itraverse
148
148
#endif
149
149
150
- -- | Create a 'PatchMapWithMove', validating it
150
+ -- | Create a t 'PatchMapWithMove', validating it
151
151
patchMapWithMove :: Ord k => Map k (NodeInfo k v ) -> Maybe (PatchMapWithMove k v )
152
152
patchMapWithMove = fmap PatchMapWithMove' . PM. patchMapWithPatchingMove . coerce
153
153
154
- -- | Create a 'PatchMapWithMove' that inserts everything in the given 'Map'
154
+ -- | Create a t 'PatchMapWithMove' that inserts everything in the given 'Map'
155
155
patchMapWithMoveInsertAll :: Map k v -> PatchMapWithMove k v
156
156
patchMapWithMoveInsertAll = PatchMapWithMove' . PM. patchMapWithPatchingMoveInsertAll
157
157
158
- -- | Make a @'PatchMapWithMove' k v@ which has the effect of inserting or updating a value @v@ to the given key @k@, like 'Map.insert'.
158
+ -- | Make a @t 'PatchMapWithMove' k v@ which has the effect of inserting or updating a value @v@ to the given key @k@, like 'Map.insert'.
159
159
insertMapKey :: k -> v -> PatchMapWithMove k v
160
160
insertMapKey k v = PatchMapWithMove' $ PM. insertMapKey k v
161
161
162
- -- | Make a @'PatchMapWithMove' k v@ which has the effect of moving the value from the first key @k@ to the second key @k@, equivalent to:
162
+ -- | Make a @t 'PatchMapWithMove' k v@ which has the effect of moving the value from the first key @k@ to the second key @k@, equivalent to:
163
163
--
164
164
-- @
165
165
-- 'Map.delete' src (maybe map ('Map.insert' dst) (Map.lookup src map))
166
166
-- @
167
167
moveMapKey :: Ord k => k -> k -> PatchMapWithMove k v
168
168
moveMapKey src dst = PatchMapWithMove' $ PM. moveMapKey src dst
169
169
170
- -- | Make a @'PatchMapWithMove' k v@ which has the effect of swapping two keys in the mapping, equivalent to:
170
+ -- | Make a @t 'PatchMapWithMove' k v@ which has the effect of swapping two keys in the mapping, equivalent to:
171
171
--
172
172
-- @
173
173
-- let aMay = Map.lookup a map
@@ -179,13 +179,13 @@ moveMapKey src dst = PatchMapWithMove' $ PM.moveMapKey src dst
179
179
swapMapKey :: Ord k => k -> k -> PatchMapWithMove k v
180
180
swapMapKey src dst = PatchMapWithMove' $ PM. swapMapKey src dst
181
181
182
- -- | Make a @'PatchMapWithMove' k v@ which has the effect of deleting a key in the mapping, equivalent to 'Map.delete'.
182
+ -- | Make a @t 'PatchMapWithMove' k v@ which has the effect of deleting a key in the mapping, equivalent to 'Map.delete'.
183
183
deleteMapKey :: k -> PatchMapWithMove k v
184
184
deleteMapKey = PatchMapWithMove' . PM. deleteMapKey
185
185
186
- -- | Wrap a @'Map' k (NodeInfo k v)@ representing patch changes into a @'PatchMapWithMove' k v@, without checking any invariants.
186
+ -- | Wrap a @'Map' k (NodeInfo k v)@ representing patch changes into a @t 'PatchMapWithMove' k v@, without checking any invariants.
187
187
--
188
- -- __Warning:__ when using this function, you must ensure that the invariants of 'PatchMapWithMove' are preserved; they will not be checked.
188
+ -- __Warning:__ when using this function, you must ensure that the invariants of t 'PatchMapWithMove' are preserved; they will not be checked.
189
189
unsafePatchMapWithMove :: Map k (NodeInfo k v ) -> PatchMapWithMove k v
190
190
unsafePatchMapWithMove = coerce PM. unsafePatchMapWithPatchingMove
191
191
@@ -198,25 +198,25 @@ instance Ord k => Patch (PatchMapWithMove k v) where
198
198
patchMapWithMoveNewElements :: PatchMapWithMove k v -> [v ]
199
199
patchMapWithMoveNewElements = PM. patchMapWithPatchingMoveNewElements . unPatchMapWithMove'
200
200
201
- -- | Return a @'Map' k v@ with all the inserts/updates from the given @'PatchMapWithMove' k v@.
201
+ -- | Return a @'Map' k v@ with all the inserts/updates from the given @t 'PatchMapWithMove' k v@.
202
202
patchMapWithMoveNewElementsMap :: PatchMapWithMove k v -> Map k v
203
203
patchMapWithMoveNewElementsMap = PM. patchMapWithPatchingMoveNewElementsMap . unPatchMapWithMove'
204
204
205
- -- | Create a 'PatchMapWithMove' that, if applied to the given 'Map', will sort
205
+ -- | Create a t 'PatchMapWithMove' that, if applied to the given 'Map', will sort
206
206
-- its values using the given ordering function. The set keys of the 'Map' is
207
207
-- not changed.
208
208
patchThatSortsMapWith :: Ord k => (v -> v -> Ordering ) -> Map k v -> PatchMapWithMove k v
209
209
patchThatSortsMapWith cmp = PatchMapWithMove' . PM. patchThatSortsMapWith cmp
210
210
211
- -- | Create a 'PatchMapWithMove' that, if applied to the first 'Map' provided,
211
+ -- | Create a t 'PatchMapWithMove' that, if applied to the first 'Map' provided,
212
212
-- will produce a 'Map' with the same values as the second 'Map' but with the
213
213
-- values sorted with the given ordering function.
214
214
patchThatChangesAndSortsMapWith :: (Ord k , Ord v ) => (v -> v -> Ordering ) -> Map k v -> Map k v -> PatchMapWithMove k v
215
215
patchThatChangesAndSortsMapWith cmp oldByIndex newByIndexUnsorted = patchThatChangesMap oldByIndex newByIndex
216
216
where newList = Map. toList newByIndexUnsorted
217
217
newByIndex = Map. fromList $ zip (fst <$> newList) $ sortBy cmp $ snd <$> newList
218
218
219
- -- | Create a 'PatchMapWithMove' that, if applied to the first 'Map' provided,
219
+ -- | Create a t 'PatchMapWithMove' that, if applied to the first 'Map' provided,
220
220
-- will produce the second 'Map'.
221
221
patchThatChangesMap :: (Ord k , Ord v ) => Map k v -> Map k v -> PatchMapWithMove k v
222
222
patchThatChangesMap oldByIndex newByIndex = PatchMapWithMove' $
@@ -262,6 +262,7 @@ instance Foldable (NodeInfo k) where
262
262
instance Traversable (NodeInfo k ) where
263
263
traverse = bitraverseNodeInfo pure
264
264
265
+ -- | Like 'Data.Bitraversable.bitraverse'
265
266
bitraverseNodeInfo
266
267
:: Applicative f
267
268
=> (k0 -> f k1 )
@@ -271,11 +272,11 @@ bitraverseNodeInfo fk fv = fmap NodeInfo'
271
272
. PM. bitraverseNodeInfo fk (\ ~ Proxy -> pure Proxy ) fv
272
273
. coerce
273
274
274
- -- | Change the 'From' value of a 'NodeInfo'
275
+ -- | Change the 'From' value of a t 'NodeInfo'
275
276
nodeInfoMapFrom :: (From k v -> From k v ) -> NodeInfo k v -> NodeInfo k v
276
277
nodeInfoMapFrom f = coerce $ PM. nodeInfoMapFrom (unFrom' . f . From' )
277
278
278
- -- | Change the 'From' value of a 'NodeInfo', using a 'Functor' (or
279
+ -- | Change the 'From' value of a t 'NodeInfo', using a 'Functor' (or
279
280
-- 'Applicative', 'Monad', etc.) action to get the new value
280
281
nodeInfoMapMFrom
281
282
:: Functor f
@@ -285,7 +286,7 @@ nodeInfoMapMFrom f = fmap NodeInfo'
285
286
. PM. nodeInfoMapMFrom (fmap unFrom' . f . From' )
286
287
. coerce
287
288
288
- -- | Set the 'To' field of a 'NodeInfo'
289
+ -- | Set the 'To' field of a t 'NodeInfo'
289
290
nodeInfoSetTo :: To k -> NodeInfo k v -> NodeInfo k v
290
291
nodeInfoSetTo = coerce . PM. nodeInfoSetTo
291
292
@@ -310,6 +311,7 @@ pattern From_Delete = From' PM.From_Delete
310
311
pattern From_Move :: k -> From k v
311
312
pattern From_Move k = From' (PM. From_Move k Proxy )
312
313
314
+ -- | Like 'Data.Bitraversable.bitraverse'
313
315
bitraverseFrom
314
316
:: Applicative f
315
317
=> (k0 -> f k1 )
0 commit comments