Skip to content

Commit

Permalink
Refine stated/actuals diffs on package dep/constraint mismatches
Browse files Browse the repository at this point in the history
  • Loading branch information
supermario committed May 6, 2024
1 parent b0a036e commit f2f2287
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions builder/src/Elm/Details.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f2f2287

Please sign in to comment.