aboutsummaryrefslogtreecommitdiffstats
path: root/utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'utils.hs')
-rw-r--r--utils.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils.hs b/utils.hs
index 9fcc553..3e6c2b6 100644
--- a/utils.hs
+++ b/utils.hs
@@ -39,4 +39,8 @@ splitToPair f lst =
in (x', y')
count :: (a -> Bool) -> [a] -> Int
-count pred xs = xs $> filter pred .> length \ No newline at end of file
+count pred xs = xs $> filter pred .> length
+
+takeUntil :: (a -> Bool) -> [a] -> [a]
+takeUntil _ [] = []
+takeUntil p (x : xs) = x : if p x then takeUntil p xs else []