diff options
author | Tony Morris <tmorris@tmorris.net> | 2014-09-11 15:01:56 +1000 |
---|---|---|
committer | Tony Morris <tmorris@tmorris.net> | 2014-09-11 15:01:56 +1000 |
commit | 2db05384549f463a4a95076e63ddf8acad1c7b33 (patch) | |
tree | 931076e4241385c3696d47df04b976525f71ca78 /src/Plugins/Monitors | |
parent | 00721a6ff57978cf07dcfe4b7369fe26fe938674 (diff) | |
download | xmobar-2db05384549f463a4a95076e63ddf8acad1c7b33.tar.gz xmobar-2db05384549f463a4a95076e63ddf8acad1c7b33.tar.bz2 |
Occasionally there is no wind and a METAR report gives simply, "Wind: 0"
Diffstat (limited to 'src/Plugins/Monitors')
-rw-r--r-- | src/Plugins/Monitors/Weather.hs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Plugins/Monitors/Weather.hs b/src/Plugins/Monitors/Weather.hs index 8119842..7cf68de 100644 --- a/src/Plugins/Monitors/Weather.hs +++ b/src/Plugins/Monitors/Weather.hs @@ -77,6 +77,17 @@ pTime = do y <- getNumbersAsString char ' ' return (y, m, d ,h:hh:":"++mi:mimi) +-- Occasionally there is no wind and a METAR report gives simply, "Wind: 0" +pWind0 :: + ( + String -- cardinal direction + , String -- azimuth direction + , String -- speed (MPH) + , String -- speed (knot) + ) +pWind0 = + ("∘", "0", "0", "0") + pWind :: Parser ( String -- cardinal direction @@ -86,6 +97,8 @@ pWind :: ) pWind = let tospace = manyTill anyChar (char ' ') + wind0 = do manyTill skipRestOfLine (string "Wind: 0") + return pWind0 wind = do manyTill skipRestOfLine (string "Wind: from the ") cardinal <- tospace char '(' @@ -96,7 +109,7 @@ pWind = knot <- tospace manyTill anyChar newline return (cardinal, azimuth, mph, knot) - in try wind <|> return ("a", "b", "c", "d") + in try wind0 <|> wind pTemp :: Parser (Int, Int) pTemp = do let num = digit <|> char '-' <|> char '.' |