summaryrefslogtreecommitdiff
path: root/src/Utility/Split.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utility/Split.hs')
-rw-r--r--src/Utility/Split.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Utility/Split.hs b/src/Utility/Split.hs
index decfe7d3..ffea5d3f 100644
--- a/src/Utility/Split.hs
+++ b/src/Utility/Split.hs
@@ -28,3 +28,7 @@ splitc c s = case break (== c) s of
-- | same as Data.List.Utils.replace
replace :: Eq a => [a] -> [a] -> [a] -> [a]
replace old new = intercalate new . split old
+
+-- | Only traverses the list once while dropping the last n characters.
+dropFromEnd :: Int -> [a] -> [a]
+dropFromEnd n l = zipWith const l (drop n l)