diff options
author | jao <jao@gnu.org> | 2018-11-25 00:58:21 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-11-25 00:58:21 +0000 |
commit | 0b7b43ef83a2ab6fd894c20e028b9d69372c7266 (patch) | |
tree | 8ce2b4d7efbd97bca387cbf7613ca9863a14d59e /src/lib/Xmobar/Plugins/Utils.hs | |
parent | 7d11e5b47d06d38b23fc1190aba640de9daa76e0 (diff) | |
download | xmobar-0b7b43ef83a2ab6fd894c20e028b9d69372c7266.tar.gz xmobar-0b7b43ef83a2ab6fd894c20e028b9d69372c7266.tar.bz2 |
Plugins.Utils -> Utils
Diffstat (limited to 'src/lib/Xmobar/Plugins/Utils.hs')
-rw-r--r-- | src/lib/Xmobar/Plugins/Utils.hs | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/lib/Xmobar/Plugins/Utils.hs b/src/lib/Xmobar/Plugins/Utils.hs deleted file mode 100644 index 6546c15..0000000 --- a/src/lib/Xmobar/Plugins/Utils.hs +++ /dev/null @@ -1,43 +0,0 @@ ------------------------------------------------------------------------------- --- | --- Module: Plugins.Utils --- Copyright: (c) 2010 Jose Antonio Ortega Ruiz --- License: BSD3-style (see LICENSE) --- --- Maintainer: Jose A Ortega Ruiz <jao@gnu.org> --- Stability: unstable --- Portability: unportable --- Created: Sat Dec 11, 2010 20:55 --- --- --- Miscellaneous utility functions --- ------------------------------------------------------------------------------- - - -module Xmobar.Plugins.Utils (expandHome, changeLoop, safeHead) where - -import Control.Monad -import Control.Concurrent.STM - -import System.Environment -import System.FilePath - - -expandHome :: FilePath -> IO FilePath -expandHome ('~':'/':path) = fmap (</> path) (getEnv "HOME") -expandHome p = return p - -changeLoop :: Eq a => STM a -> (a -> IO ()) -> IO () -changeLoop s f = atomically s >>= go - where - go old = do - f old - go =<< atomically (do - new <- s - guard (new /= old) - return new) - -safeHead :: [a] -> Maybe a -safeHead [] = Nothing -safeHead (x:_) = Just x |