From f2f228796e9117e8a90fe6f8b8ebebf7d11a9ea1 Mon Sep 17 00:00:00 2001 From: Mario Rogic Date: Mon, 6 May 2024 21:40:39 +1000 Subject: [PATCH] Refine stated/actuals diffs on package dep/constraint mismatches --- builder/src/Elm/Details.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/builder/src/Elm/Details.hs b/builder/src/Elm/Details.hs index 4e9c441f..29af1b51 100644 --- a/builder/src/Elm/Details.hs +++ b/builder/src/Elm/Details.hs @@ -253,8 +253,18 @@ verifyApp env time outline@(Outline.AppOutline elmVersion srcDirs direct _ _ _) if Map.size stated == Map.size actual then verifyDependencies env time (ValidApp srcDirs) actual direct else Task.throw $ Exit.DetailsHandEditedDependencies - $ "The stated and actual dependencies do not match.\n\n" - ++ "Stated: " ++ show stated ++ "\n\nActual: " ++ show actual + $ let + stateds = stated & fmap (\k _ -> k) + actuals = actual & fmap (\k _ -> k) + + -- first, everything in stated that's not in actual + missing = Map.difference stateds actuals & Map.toList & fmap fst & show + -- then, everything in actual that's not in stated + extra = Map.difference actuals stateds & Map.toList & fmap fst & show + in + "The stated and actual dependencies do not match.\n\n" + ++ "Stated missing in actual: " ++ show missing + ++ "\n\nActual missing in stated: " ++ show extra else Task.throw $ Exit.DetailsBadElmInAppOutline elmVersion