ghc-mod/Language/Haskell/GhcMod/Utils.hs

6 lines
216 B
Haskell

module Language.Haskell.GhcMod.Utils where
-- dropWhileEnd is not provided prior to base 4.5.0.0.
dropWhileEnd :: (a -> Bool) -> [a] -> [a]
dropWhileEnd p = foldr (\x xs -> if p x && null xs then [] else x : xs) []