@@ -7,6 +7,7 @@
77-- insert/update or delete of associations.
88module Data.Patch.IntMap where
99
10+import Control.Lens
1011import Data.IntMap.Strict (IntMap)
1112import qualified Data.IntMap.Strict as IntMap
1213import Data.Maybe
@@ -34,6 +35,11 @@ instance Semigroup (PatchIntMap v) where
3435 -- PatchMap is idempotent, so stimes n is id for every n
3536 stimes = stimesIdempotentMonoid
3637
38+instance FunctorWithIndex Int PatchIntMap
39+instance FoldableWithIndex Int PatchIntMap
40+instance TraversableWithIndex Int PatchIntMap where
41+ itraversed = _Wrapped . itraversed . traversed
42+
3743-- | Map a function @Int -> a -> b@ over all @a@s in the given @'PatchIntMap' a@
3844-- (that is, all inserts/updates), producing a @PatchIntMap b@.
3945mapIntMapPatchWithKey :: (Int -> a -> b) -> PatchIntMap a -> PatchIntMap b