From 480f25b2f27c36c2351af3b385dbf5d19f144cd7 Mon Sep 17 00:00:00 2001 From: Seungheon Oh Date: Wed, 13 Apr 2022 14:25:10 -0400 Subject: [PATCH] `pmapUnionWith` optimization There is no reason to have `ps` unless the current key is a duplicate entry. --- agora/Agora/Utils.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/agora/Agora/Utils.hs b/agora/Agora/Utils.hs index 5ac101c..83ac342 100644 --- a/agora/Agora/Utils.hs +++ b/agora/Agora/Utils.hs @@ -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