mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-05 22:51:52 -07:00
XPrompt.hs (uniqSort): new function
Moved from ShellPrompt. There are at least three happy users of this function -- ShellPrompt, SshPrompt, and ManPrompt.
This commit is contained in:
@@ -38,6 +38,7 @@ module XMonadContrib.XPrompt (
|
|||||||
, breakAtSpace
|
, breakAtSpace
|
||||||
, newIndex
|
, newIndex
|
||||||
, newCommand
|
, newCommand
|
||||||
|
, uniqSort
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Graphics.X11.Xlib
|
import Graphics.X11.Xlib
|
||||||
@@ -54,6 +55,7 @@ import Data.Bits
|
|||||||
import Data.Char
|
import Data.Char
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import Data.Set (fromList, toList)
|
||||||
import System.Environment (getEnv)
|
import System.Environment (getEnv)
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Posix.Files
|
import System.Posix.Files
|
||||||
@@ -671,3 +673,7 @@ breakAtSpace s
|
|||||||
| otherwise = (s1, s2)
|
| otherwise = (s1, s2)
|
||||||
where (s1, s2 ) = break isSpace s
|
where (s1, s2 ) = break isSpace s
|
||||||
(s1',s2') = breakAtSpace $ tail s2
|
(s1',s2') = breakAtSpace $ tail s2
|
||||||
|
|
||||||
|
-- | Sort a list and remove duplicates.
|
||||||
|
uniqSort :: Ord a => [a] -> [a]
|
||||||
|
uniqSort = toList . fromList
|
||||||
|
Reference in New Issue
Block a user