|
uniqueNames = length allExplanationIdStrings == length (nub allExplanationIdStrings) |
Spotted by @Bodigrim when reviewing #11825. Please see the thread starting with #11825 (comment) for more detail.
Functions to check and mentioned in that thread are the above and the following;
|
hasNoDups :: Ord a => [a] -> Bool |
|
hasNoDups = loop Set.empty |
|
where |
|
loop _ [] = True |
|
loop s (x:xs) | s' <- Set.insert x s, Set.size s' > Set.size s |
|
= loop s' xs |
|
| otherwise |
|
= False |
|
listUnique :: Ord a => [a] -> Bool |
|
listUnique xs = |
|
let sorted = sort xs |
|
in nub sorted == xs |
|
isSorted :: Ord a => [a] -> Bool |
|
isSorted (x1 : xs@(x2 : _)) = x1 <= x2 && isSorted xs |
|
isSorted _ = True |
|
allEqual :: Eq a => [a] -> Bool |
|
allEqual xs = length (nub xs) == 1 |
|
allEqual :: Eq a => [a] -> Bool |
|
allEqual [] = True |
|
allEqual [_] = True |
|
allEqual (x:y:ys) = x == y && allEqual (y:ys) |
cabal/Cabal-tests/tests/UnitTests/Distribution/PackageDescription/Check.hs
Line 29 in c3c060f
Spotted by @Bodigrim when reviewing #11825. Please see the thread starting with #11825 (comment) for more detail.
Functions to check and mentioned in that thread are the above and the following;
cabal/Cabal-tests/tests/UnitTests/Distribution/Compat/Graph.hs
Lines 64 to 71 in e7aaad8
cabal/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs
Lines 93 to 96 in e7aaad8
cabal/cabal-install/tests/UnitTests/Distribution/Solver/Modular/WeightedPSQ.hs
Lines 52 to 54 in e7aaad8
cabal/solver-benchmarks/HackageBenchmark.hs
Lines 351 to 352 in e7aaad8
cabal/cabal-install-solver/src/Distribution/Solver/Modular/Linking.hs
Lines 518 to 521 in e7aaad8