You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked the source code and did not see these rules defined, but I imagine they should be beneficial for performance. Below are the rewrite rules I mean:
{-# RULES
"intersectionWith/mapWithKey/1"
forall f g m n
. intersectionWithKey f (mapWithKey g m) n
= intersectionWithKey (\i a b -> f i (g i a) b) m n
"intersectionWith/mapWithKey/2"
forall f g m n
. intersectionWithKey f m (mapWithKey g n)
= intersectionWithKey (\i a b -> f i a (g i b)) m n
#-}
In theory, they should be able to eliminate one intermediate IntMap, but I do not know enough of the internals of this library nor GHC optimisation passes to be sure.