fix wrong numeric types
This commit is contained in:
parent
16981d9d3f
commit
6772bc97e5
@ -15,9 +15,6 @@ main :: IO ()
|
|||||||
main = do
|
main = do
|
||||||
apiKey <- getWeatherKey
|
apiKey <- getWeatherKey
|
||||||
|
|
||||||
generatePlot 20 35 25 --example
|
|
||||||
openPlot
|
|
||||||
|
|
||||||
putStrLn "Enter a city name: "
|
putStrLn "Enter a city name: "
|
||||||
city <- getLine
|
city <- getLine
|
||||||
|
|
||||||
@ -50,6 +47,9 @@ main = do
|
|||||||
tomorrowDecoded <- DT.weatherDecode $ getResponseBody tomorrowResponse
|
tomorrowDecoded <- DT.weatherDecode $ getResponseBody tomorrowResponse
|
||||||
print ("Tomorrow's temperature: ", DT.getTemperature tomorrowDecoded)
|
print ("Tomorrow's temperature: ", DT.getTemperature tomorrowDecoded)
|
||||||
|
|
||||||
|
generatePlot (DT.getTemperature yesterdayDecoded) (DT.getTemperature todayDecoded) (DT.getTemperature tomorrowDecoded)
|
||||||
|
openPlot
|
||||||
|
|
||||||
|
|
||||||
--apiKey is stored in an env variable, not something that should be pushed onto git
|
--apiKey is stored in an env variable, not something that should be pushed onto git
|
||||||
getWeatherKey :: IO String
|
getWeatherKey :: IO String
|
||||||
|
@ -4,11 +4,11 @@ import Graphics.Rendering.Chart.Backend.Diagrams
|
|||||||
import System.Process (callCommand)
|
import System.Process (callCommand)
|
||||||
|
|
||||||
|
|
||||||
formatData :: Double -> Double -> Double -> [(Int, Double)]
|
formatData :: Float -> Float -> Float -> [(Int, Float)]
|
||||||
formatData yday tday tmrw = [(0, yday), (1, tday), (2, tmrw)]
|
formatData yday tday tmrw = [(0, yday), (1, tday), (2, tmrw)]
|
||||||
|
|
||||||
|
|
||||||
generatePlot :: Double -> Double -> Double -> IO ()
|
generatePlot :: Float -> Float -> Float -> IO ()
|
||||||
generatePlot yday tday tmrw = toFile def "plot/weather.svg" $ do
|
generatePlot yday tday tmrw = toFile def "plot/weather.svg" $ do
|
||||||
layout_title .= "Yesterday, Today, and Tomorrow's Temperatures"
|
layout_title .= "Yesterday, Today, and Tomorrow's Temperatures"
|
||||||
layout_margin .= 30
|
layout_margin .= 30
|
||||||
|
Loading…
Reference in New Issue
Block a user