summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMichael Knabe <github@mfkhh.de>2015-12-12 12:37:27 +0100
committerMichael Knabe <github@mfkhh.de>2015-12-12 12:37:27 +0100
commit5c0a79bbbd654615c9ff0743906022d0d02b1538 (patch)
tree554c7cb72dd7f5f0ae8faf7a1329e083d3384be9 /src
parent23aa6876b069f05b7f2c4791bb4b344a3a7387b2 (diff)
downloadxmobar-5c0a79bbbd654615c9ff0743906022d0d02b1538.tar.gz
xmobar-5c0a79bbbd654615c9ff0743906022d0d02b1538.tar.bz2
Move wind speed calculation functions to let clause
Diffstat (limited to 'src')
-rw-r--r--src/Plugins/Monitors/Weather.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Plugins/Monitors/Weather.hs b/src/Plugins/Monitors/Weather.hs
index b2520a9..a25005f 100644
--- a/src/Plugins/Monitors/Weather.hs
+++ b/src/Plugins/Monitors/Weather.hs
@@ -100,6 +100,10 @@ noWind = WindInfo "μ" "μ" "0" "0" "0" "0"
pWind :: Parser WindInfo
pWind =
let tospace = manyTill anyChar (char ' ')
+ toKmh knots = knots $* 1.852
+ toMs knots = knots $* 0.514
+ ($*) :: String -> Double -> String
+ op1 $* op2 = show (round ((read op1::Double) * op2)::Integer)
-- Occasionally there is no wind and a METAR report gives simply, "Wind: Calm:0"
wind0 = do manyTill skipRestOfLine (string "Wind: Calm:0")
@@ -121,11 +125,6 @@ pWind =
manyTill anyChar newline
return $ WindInfo cardinal azimuth mph knot (toKmh knot) (toMs knot)
in try wind0 <|> try windVar <|> try wind <|> return noWind
- where
- toKmh knots = knots $* 1.852
- toMs knots = knots $* 0.514
- ($*) :: String -> Double -> String
- op1 $* op2 = show (round ((read op1::Double) * op2)::Integer)
pTemp :: Parser (Int, Int)
pTemp = do let num = digit <|> char '-' <|> char '.'