getWeatherData :: Handle -> Location -> Day -> IO WeatherData
getWeatherData = getMethod @"getWeatherData"
-
-getWindData :: Handle -> Location -> Day -> IO W.WindSpeed
-getWindData = getMethod @"getWindData"
+{-# LANGUAGE RecordWildCards #-}
+
module SuperWeatherProvider where
import Data.Vinyl
import QueryTypes
new :: WindProvider.Handle -> TemperatureProvider.Handle -> Handle
-new wp tp = Field getSuperWeatherData
- :& RNil <+> wp <+> tp
+new wp tp = Field (getSuperWeatherData wp tp) :& RNil <+> wp <+> tp
-- | This is some concrete implementation `WeatherProvider` interface
-getSuperWeatherData :: Location -> Day -> IO WeatherData
-getSuperWeatherData _ _ = return $ WeatherData 30 10
+getSuperWeatherData :: WindProvider.Handle -> TemperatureProvider.Handle -> Location -> Day -> IO WeatherData
+getSuperWeatherData wp tp loc day = do
+ temperature <- TemperatureProvider.getTemperatureData tp loc day
+ wind <- WindProvider.getWindData wp loc day
+ return $ WeatherData{..}