diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2025-08-01 21:40:32 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-08-01 21:40:32 +0200 |
commit | 857f08c6bc6cf911d853dce1e8a5392e7dd5ea3f (patch) | |
tree | 905d85b1cf7e4f56b13279e45e3d3e86878c2c6f /src/Erebos/Util.hs | |
parent | e8c6b4431e254971449e64cfbf966818235e37cf (diff) |
Fix recursive call of mergeUniqBy
Diffstat (limited to 'src/Erebos/Util.hs')
-rw-r--r-- | src/Erebos/Util.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Erebos/Util.hs b/src/Erebos/Util.hs index 0381c3e..0d53e98 100644 --- a/src/Erebos/Util.hs +++ b/src/Erebos/Util.hs @@ -22,15 +22,16 @@ mergeBy cmp (x : xs) (y : ys) = case cmp x y of mergeBy _ xs [] = xs mergeBy _ [] ys = ys -mergeUniqBy :: (a -> a -> Ordering) -> [a] -> [a] -> [a] -mergeUniqBy cmp (x : xs) (y : ys) = case cmp x y of - LT -> x : mergeBy cmp xs (y : ys) - EQ -> x : mergeBy cmp xs ys - GT -> y : mergeBy cmp (x : xs) ys +mergeUniqBy :: (a -> a -> Ordering) -> [ a ] -> [ a ] -> [ a ] +mergeUniqBy cmp (x : xs) (y : ys) = + case cmp x y of + LT -> x : mergeUniqBy cmp xs (y : ys) + EQ -> x : mergeUniqBy cmp xs ys + GT -> y : mergeUniqBy cmp (x : xs) ys mergeUniqBy _ xs [] = xs mergeUniqBy _ [] ys = ys -mergeUniq :: Ord a => [a] -> [a] -> [a] +mergeUniq :: Ord a => [ a ] -> [ a ] -> [ a ] mergeUniq = mergeUniqBy compare diffSorted :: Ord a => [a] -> [a] -> [a] |