fix wrong numeric types

This commit is contained in:
Szymon Szczubkowski 2024-05-26 19:08:56 +02:00
parent 16981d9d3f
commit 6772bc97e5
2 changed files with 5 additions and 5 deletions

View File

@ -15,9 +15,6 @@ main :: IO ()
main = do
apiKey <- getWeatherKey
generatePlot 20 35 25 --example
openPlot
putStrLn "Enter a city name: "
city <- getLine
@ -50,6 +47,9 @@ main = do
tomorrowDecoded <- DT.weatherDecode $ getResponseBody tomorrowResponse
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
getWeatherKey :: IO String

View File

@ -4,11 +4,11 @@ import Graphics.Rendering.Chart.Backend.Diagrams
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)]
generatePlot :: Double -> Double -> Double -> IO ()
generatePlot :: Float -> Float -> Float -> IO ()
generatePlot yday tday tmrw = toFile def "plot/weather.svg" $ do
layout_title .= "Yesterday, Today, and Tomorrow's Temperatures"
layout_margin .= 30