diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs index c74694a81d8..d115bb8fde8 100644 --- a/Cabal/Distribution/Simple/Utils.hs +++ b/Cabal/Distribution/Simple/Utils.hs @@ -140,6 +140,7 @@ module Distribution.Simple.Utils ( ordNub, ordNubRight, safeTail, + unintersperse, wrapText, wrapLine, ) where @@ -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)