We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
containers-0.8
traverseMapWithKey
1 parent de9ba5c commit 747201bCopy full SHA for 747201b
src/Data/IntMap/NonEmpty/Internal.hs
@@ -716,11 +716,19 @@ insertMaxMap = M.insert
716
-- | /O(n)/. A fixed version of 'Data.IntMap.traverseWithKey' that
717
-- traverses items in ascending order of keys.
718
traverseMapWithKey :: Applicative t => (Key -> a -> t b) -> IntMap a -> t (IntMap b)
719
+#if MIN_VERSION_containers(0,8,0)
720
+traverseMapWithKey f = go
721
+ where
722
+ go Nil = pure Nil
723
+ go (Tip k v) = Tip k <$> f k v
724
+ go (Bin p l r) = liftA2 (flip (Bin p)) (go r) (go l)
725
+#else
726
traverseMapWithKey f = go
727
where
728
go Nil = pure Nil
729
go (Tip k v) = Tip k <$> f k v
730
go (Bin p m l r) = liftA2 (flip (Bin p m)) (go r) (go l)
731
+#endif
732
{-# INLINE traverseMapWithKey #-}
733
734
-- ---------------------------------------------
0 commit comments