summaryrefslogtreecommitdiff
path: root/src/Util.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2022-08-10 23:36:32 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2022-08-13 13:06:41 +0200
commitff46d84b08fed346156c1b67478d4090a0b83f7d (patch)
tree2ca845d723c857ae8c251055405c126ac9ece8bf /src/Util.hs
parentefaed91a6007772acf066e7876c06462f4e68fd4 (diff)
Integer expressions and variables
Diffstat (limited to 'src/Util.hs')
-rw-r--r--src/Util.hs5
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