Skip to content

Commit

Permalink
Simple.Utils: add unintersperse
Browse files Browse the repository at this point in the history
  • Loading branch information
ttuegel committed Sep 1, 2016
1 parent 118c709 commit 8cd7d24
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Cabal/Distribution/Simple/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ module Distribution.Simple.Utils (
ordNub,
ordNubRight,
safeTail,
unintersperse,
wrapText,
wrapLine,
) where
Expand Down Expand Up @@ -1547,3 +1548,11 @@ equating p x y = p x == p y

lowercase :: String -> String
lowercase = map toLower

unintersperse :: Char -> String -> [String]
unintersperse mark = unfoldr unintersperse1 where
unintersperse1 str
| null str = Nothing
| otherwise =
let (this, rest) = break (== mark) str in
Just (this, safeTail rest)

0 comments on commit 8cd7d24

Please sign in to comment.