From ff46d84b08fed346156c1b67478d4090a0b83f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 10 Aug 2022 23:36:32 +0200 Subject: Integer expressions and variables --- src/Util.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Util.hs') 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 -- cgit v1.2.3