mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
fix diff/ ordering of cased packages with consistent use of toCaseFold
fixes #315 Thank you to @alaendle and @andreasabel
This commit is contained in:
parent
19de58f2ab
commit
b3e7fcbfe1
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user