diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-08 12:03:20 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-08 12:03:20 +0200 |
commit | c88df2b5d3cabc8e8171a422a48d0f811549f512 (patch) | |
tree | e25f1bfde5b70e7d8fed45624b2b387b828e0dc5 | |
parent | 562bf90aa4d9d2987c6bb132dbb99184e7e93b1e (diff) | |
download | xmobar-c88df2b5d3cabc8e8171a422a48d0f811549f512.tar.gz xmobar-c88df2b5d3cabc8e8171a422a48d0f811549f512.tar.bz2 |
better error handling when parsing weather information
darcs-hash:20070708100320-d6583-0ec0ec78a84313390467e6596239421d022a2863.gz
-rw-r--r-- | Monitors/Weather.hs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Monitors/Weather.hs b/Monitors/Weather.hs index d643bb0..2d957bd 100644 --- a/Monitors/Weather.hs +++ b/Monitors/Weather.hs @@ -102,20 +102,15 @@ parseData = ss <- getAllBut "(" skipRestOfLine >> getAllBut "/" (y,m,d,h) <- pTime - skipRestOfLine >> string "Wind: " - w <- manyTill anyChar $ newline - manyTill skipRestOfLine $ string "Visibility: " - v <- manyTill anyChar $ newline - manyTill skipRestOfLine $ string "Sky conditions: " - sk <- manyTill anyChar $ newline - manyTill skipRestOfLine $ string "Temperature" + w <- getAfterString "Wind: " + v <- getAfterString "Visibility: " + sk <- getAfterString "Sky conditions: " + skipTillString "Temperature" temp <- pTemp - manyTill skipRestOfLine $ string "Dew Point: " - dp <- manyTill anyChar $ newline - manyTill skipRestOfLine $ string "Relative Humidity" + dp <- getAfterString "Dew Point: " + skipTillString "Relative Humidity" rh <- pRh - manyTill skipRestOfLine $ string "Pressure (altimeter): " - p <- manyTill anyChar $ newline + p <- getAfterString "Pressure (altimeter): " manyTill skipRestOfLine eof return $ [WI st ss y m d h w v sk temp dp rh p] |