pmapUnionWith optimization

There is no reason to have `ps` unless the current key is a duplicate
entry.
This commit is contained in:
Seungheon Oh 2022-04-13 14:25:10 -04:00
parent 5d1aee3ccf
commit 480f25b2f2

View file

@ -217,11 +217,10 @@ pmapUnionWith = phoistAcyclic $
# plam
( \p -> P.do
pf <- plet $ pfstBuiltin # p
ps <- plet $ psndBuiltin # p
pmatch (plookup # pf # ys) $ \case
PJust v ->
-- Data conversions here are silly, aren't they?
ppairDataBuiltin # pf # pdata (f # pfromData ps # pfromData v)
ppairDataBuiltin # pf # pdata (f # pfromData (psndBuiltin # p) # pfromData v)
PNothing -> p
)
# xs