diff options
author | Jochen Keil <jochen.keil@gmail.com> | 2012-08-10 11:37:22 +0200 |
---|---|---|
committer | Jochen Keil <jochen.keil@gmail.com> | 2012-08-10 11:37:22 +0200 |
commit | 1f603c25eea15d302a4aa1ebb879bbd8198a3b82 (patch) | |
tree | d431e434b0b86a1b3197a3996f15d34743e7ae48 /src/Plugins | |
parent | a7158c426ae008fb268f603f75d027683f726757 (diff) | |
download | xmobar-1f603c25eea15d302a4aa1ebb879bbd8198a3b82.tar.gz xmobar-1f603c25eea15d302a4aa1ebb879bbd8198a3b82.tar.bz2 |
Move safeHead to Plugins.Utils
safeHead is a very general utility function with suits better into a
common Util module.
Diffstat (limited to 'src/Plugins')
-rw-r--r-- | src/Plugins/Utils.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Plugins/Utils.hs b/src/Plugins/Utils.hs index 1dbcd40..bbfa84f 100644 --- a/src/Plugins/Utils.hs +++ b/src/Plugins/Utils.hs @@ -15,7 +15,7 @@ ------------------------------------------------------------------------------ -module Plugins.Utils (expandHome, changeLoop) where +module Plugins.Utils (expandHome, changeLoop, safeHead) where import Control.Monad import Control.Concurrent.STM @@ -37,3 +37,7 @@ changeLoop s f = atomically s >>= go new <- s guard (new /= old) return new) + +safeHead :: [a] -> Maybe a +safeHead [] = Nothing +safeHead (x:_) = Just x |