summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Config/Template.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-10-01 02:58:23 +0100
committerjao <jao@gnu.org>2022-10-01 02:58:23 +0100
commitac3b8212a68052f99eba2bd74a2dd8aa9ca2dcb2 (patch)
tree85900083aec42915c3ebab1af352f48ca4f690c6 /src/Xmobar/Config/Template.hs
parentef380c045957413948d390c152f6401869526285 (diff)
downloadxmobar-ac3b8212a68052f99eba2bd74a2dd8aa9ca2dcb2.tar.gz
xmobar-ac3b8212a68052f99eba2bd74a2dd8aa9ca2dcb2.tar.bz2
a couple of superfluous IO usages removed
Diffstat (limited to 'src/Xmobar/Config/Template.hs')
-rw-r--r--src/Xmobar/Config/Template.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Xmobar/Config/Template.hs b/src/Xmobar/Config/Template.hs
index 28ccbe1..67ed061 100644
--- a/src/Xmobar/Config/Template.hs
+++ b/src/Xmobar/Config/Template.hs
@@ -21,23 +21,21 @@ import Control.Monad (guard, mzero)
import Data.Maybe (fromMaybe)
import Text.Parsec ((<|>))
+import Text.Read (readMaybe)
+
import qualified Text.Parsec as P
import qualified Text.Parsec.Combinator as C
-import Text.ParserCombinators.Parsec (Parser)
-import Text.Read (readMaybe)
+import Text.ParserCombinators.Parsec (Parser)
import Xmobar.Config.Types
-- | Runs the template string parser
-parseString :: Config -> String -> IO [Segment]
+parseString :: Config -> String -> [Segment]
parseString c s =
case P.parse (stringParser ci 0 Nothing) "" s of
- Left _ -> return [(Text $ "Could not parse string: " ++ s
- , ci
- , 0
- , Nothing)]
- Right x -> return (concat x)
+ Left _ -> [(Text $ "Could not parse string: " ++ s , ci , 0 , Nothing)]
+ Right x -> concat x
where ci = TextRenderInfo (fgColor c) 0 0 []
allParsers :: TextRenderInfo -> FontIndex -> Maybe [Action] -> Parser [Segment]