aboutsummaryrefslogtreecommitdiffstats
path: root/utils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'utils.hs')
-rw-r--r--utils.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/utils.hs b/utils.hs
index 740a58f..ee89ea1 100644
--- a/utils.hs
+++ b/utils.hs
@@ -30,4 +30,10 @@ slice from to xs = take (to - from + 1) (drop from xs)
splitEvery _ [] = []
splitEvery n list = first : splitEvery n rest
where
- (first, rest) = splitAt n list \ No newline at end of file
+ (first, rest) = splitAt n list
+
+splitToPair :: (Show a) => (a -> Bool) -> [a] -> ([a], [a])
+splitToPair f lst =
+ let x' = takeWhile (not . f) lst
+ y' = dropWhile (not . f) lst $> drop 1
+ in (x', y')