@@ -20,6 +20,7 @@ import qualified Data.Set as Set
2020import Data.Traversable.WithIndex
2121import Data.Type.Coercion
2222import Data.Type.Equality ((:~:)(..))
23+import Prelude hiding (zipWith)
2324import Refined
2425import Refined.Unsafe
2526import Unsafe.Coerce
@@ -259,17 +260,17 @@ disjoint (Map m1) (Map m2)
259260
260261-- | Given two maps proven to have the same keys, for each key apply the
261262-- function to the associated values, to obtain a new map with the same keys.
262−zipWithKey
263+zipWith
263264 :: forall s k a b c. Ord k
264− => (Key s k -> a -> b -> c) -> Map s k a -> Map s k b -> Map s k c
265−zipWithKey f (Map m1) (Map m2) = Map
266− $ Map.mergeWithKey (\k x y -> Just $ f (unsafeKey k) x y)
265+ => (a -> b -> c) -> Map s k a -> Map s k b -> Map s k c
266+zipWith f (Map m1) (Map m2) = Map
267+ $ Map.mergeWithKey (\_ x y -> Just $ f x y)
267268 (\m -> if Map.null m
268269 then Map.empty
269− else error "zipWithKey: bug: Data.Map.Refined has been subverted")
270+ else error "zipWith: bug: Data.Map.Refined has been subverted")
270271 (\m -> if Map.null m
271272 then Map.empty
272− else error "zipWithKey: bug: Data.Map.Refined has been subverted")
273+ else error "zipWith: bug: Data.Map.Refined has been subverted")
273274 -- ^ Work around https://github.com/haskell/containers/issues/979
274275 m1
275276 m2
@@ -519,10 +520,10 @@ instance TraversableWithIndex (Key s k) (Map s k) where
519520 itraverse = traverseWithKey
520521
521522-- | Similar to the instance for functions -- zip corresponding keys. To use
522−-- '<*>'/'Control.Applicative.liftA2' without 'KnownSet' see 'zipWithKey'.
523+-- '<*>'/'Control.Applicative.liftA2' without 'KnownSet' see 'zipWith'.
523524instance (Ord k, KnownSet s k) => Applicative (Map s k) where
524525 pure x = fromSet \_ -> x
525− (<*>) = zipWithKey (const id)
526+ (<*>) = zipWith id
526527
527528-- | @'bind' m f@ is a map that for each key @k :: 'Key' s k@, contains the
528529-- value @f (m '!' k) '!' k@, similar to @'>>='@ for functions.
@@ -542,7 +543,7 @@ instance (Ord k, KnownSet s k) => MonadReader (Key s k) (Map s k) where
542543
543544-- | Append the values at the corresponding keys
544545instance (Ord k, Semigroup a) => Semigroup (Map s k a) where
545− (<>) = zipWithKey (const (<>))
546+ (<>) = zipWith (<>)
546547
547548instance (Ord k, KnownSet s k, Monoid a) => Monoid (Map s k a) where
548549 mempty = fromSet \_ -> mempty