From b3e7fcbfe1f198069666d68a2bb641e6bbdc6f75 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Sun, 25 Jun 2023 15:55:36 +0800 Subject: [PATCH] fix diff/ ordering of cased packages with consistent use of toCaseFold fixes #315 Thank you to @alaendle and @andreasabel --- src/Stackage/Snapshot/Diff.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Stackage/Snapshot/Diff.hs b/src/Stackage/Snapshot/Diff.hs index 8256a78..641812c 100644 --- a/src/Stackage/Snapshot/Diff.hs +++ b/src/Stackage/Snapshot/Diff.hs @@ -75,14 +75,14 @@ snapshotDiff -> [(PackageNameP, VersionP)] -> SnapshotDiff snapshotDiff as0 bs0 = - SnapshotDiff $ map (second VersionChange) $ go (sortEm as0) (sortEm bs0) + SnapshotDiff $ map (second VersionChange) $ go (sortOn cmp as0) (sortOn cmp bs0) where - sortEm = sortOn (toCaseFold . textDisplay . fst) + cmp = toCaseFold . textDisplay . fst go as [] = map (second This) as go [] bs = map (second That) bs go (a:as) (b:bs) = - case compare (fst a) (fst b) of + case (compare `on` cmp) a b of EQ | snd a == snd b -> go as bs | otherwise -> (fst a, These (snd a) (snd b)) : go as bs