diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-11 20:22:21 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-11 20:22:21 +0200 |
commit | 067f7992c48538661a68bb7814482bc18efc45dd (patch) | |
tree | 28b64e31c0806164e4eb5173947d740a85249cf2 /Monitors | |
parent | db04be1995a4b83906bdd1277d6405aa44e29c0d (diff) | |
download | xmobar-067f7992c48538661a68bb7814482bc18efc45dd.tar.gz xmobar-067f7992c48538661a68bb7814482bc18efc45dd.tar.bz2 |
Weather.hs: code clean up
darcs-hash:20070711182221-d6583-fe5690eacc540e209c3ccea2b17ad08a2db9f162.gz
Diffstat (limited to 'Monitors')
-rw-r--r-- | Monitors/Weather.hs | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/Monitors/Weather.hs b/Monitors/Weather.hs index 1647ae5..fb00d0b 100644 --- a/Monitors/Weather.hs +++ b/Monitors/Weather.hs @@ -70,15 +70,13 @@ pTime = do y <- getNumbersAsString return (y, m, d ,([h]++[hh]++":"++[mi]++mimi)) pTemp :: Parser Float -pTemp = do string ": " - manyTill anyChar $ char '(' +pTemp = do manyTill anyChar $ char '(' s <- manyTill digit $ (char ' ' <|> char '.') skipRestOfLine return $read s pRh :: Parser Float -pRh = do string ": " - s <- manyTill digit $ (char '%' <|> char '.') +pRh = do s <- manyTill digit $ (char '%' <|> char '.') return $ read s parseData :: Parser [WeatherInfo] @@ -91,10 +89,10 @@ parseData = w <- getAfterString "Wind: " v <- getAfterString "Visibility: " sk <- getAfterString "Sky conditions: " - skipTillString "Temperature" + skipTillString "Temperature: " temp <- pTemp dp <- getAfterString "Dew Point: " - skipTillString "Relative Humidity" + skipTillString "Relative Humidity: " rh <- pRh p <- getAfterString "Pressure (altimeter): " manyTill skipRestOfLine eof @@ -129,13 +127,3 @@ runWeather str = do d <- io $ getData $ head str i <- io $ runP parseData d formatWeather i - -package :: String -package = "xmb-weather" - -{- -main :: IO () -main = - do let af = return "No station ID specified" - runMonitor weatherConfig af runWeather --} |