diff options
Diffstat (limited to 'src/Util.hs')
-rw-r--r-- | src/Util.hs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Util.hs b/src/Util.hs index 99d51f6..4200e20 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -4,3 +4,8 @@ uniq :: Eq a => [a] -> [a] uniq (x:y:xs) | x == y = uniq (x:xs) | otherwise = x : uniq (y:xs) uniq xs = xs + +uniqOn :: Eq b => (a -> b) -> [a] -> [a] +uniqOn f (x:y:xs) | f x == f y = uniqOn f (x:xs) + | otherwise = x : uniqOn f (y:xs) +uniqOn _ xs = xs |