summaryrefslogtreecommitdiff
path: root/src/Utility/Split.hs
diff options
context:
space:
mode:
authorJoey Hess2019-01-18 12:08:34 -0400
committerJoey Hess2019-01-18 12:08:34 -0400
commit876458adbc41a94c06d68b70e8b7b27288479592 (patch)
treea04d307b7d6eb0644f51af12285742f9b2f726d5 /src/Utility/Split.hs
parent80af78c2bbbc1684a1085225b5754f4fcda4cbcb (diff)
parentf42a71ab2653707be4fcdaf1ce0f9fff209d8f12 (diff)
Merge branch 'joeyconfig'
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)