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 6347a7b569
commit d5d39e0078

View file

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