From ffea6c276bce695968f1f14b15d4b8acdacfb7a6 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Fri, 17 Aug 2007 17:57:25 +0200 Subject: ShellPrompt: quickcheck related refactoring darcs-hash:20070817155725-32816-b4d794d7fabae947a338aaab6fbe4dbb3729c53a.gz --- ShellPrompt.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ShellPrompt.hs') diff --git a/ShellPrompt.hs b/ShellPrompt.hs index dfa77d0..a2f6465 100644 --- a/ShellPrompt.hs +++ b/ShellPrompt.hs @@ -16,6 +16,8 @@ module XMonadContrib.ShellPrompt ( -- * Usage -- $usage shellPrompt + , rmPath + , split ) where import XMonad @@ -73,8 +75,10 @@ commandCompletionFunction str cl = liftM (nub . rmPath . concat) . mapM fCF . map addToPath . split ':' addToPath = flip (++) ("/" ++ str) fCF = filenameCompletionFunction - rmPath [] = [] - rmPath s = map (last . split '/') s + +rmPath :: [String] -> [String] +rmPath s = + map (reverse . fst . break (=='/') . reverse) s split :: Eq a => a -> [a] -> [[a]] split _ [] = [] -- cgit v1.2.3