From 2343a640bfe97191be7641462da40780bfe75d3c Mon Sep 17 00:00:00 2001 From: Evgenii Akentev Date: Sat, 9 Jan 2021 20:45:10 +0500 Subject: [PATCH] [vinyl-handle]: split methods between providers --- vinyl-handle/domain/TemperatureProvider.hs | 4 ++++ vinyl-handle/domain/WeatherProvider.hs | 3 --- vinyl-handle/domain/WindProvider.hs | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/vinyl-handle/domain/TemperatureProvider.hs b/vinyl-handle/domain/TemperatureProvider.hs index 8a2eec5..8dacb91 100644 --- a/vinyl-handle/domain/TemperatureProvider.hs +++ b/vinyl-handle/domain/TemperatureProvider.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} module TemperatureProvider where @@ -11,3 +12,6 @@ type Temperature = Int type Methods = '[ '("getTemperatureData", (Location -> Day -> IO Temperature)) ] type Handle = HandleRec Methods + +getTemperatureData :: Handle -> Location -> Day -> IO Temperature +getTemperatureData = getMethod @"getTemperatureData" diff --git a/vinyl-handle/domain/WeatherProvider.hs b/vinyl-handle/domain/WeatherProvider.hs index 90da696..6dd7245 100644 --- a/vinyl-handle/domain/WeatherProvider.hs +++ b/vinyl-handle/domain/WeatherProvider.hs @@ -22,8 +22,5 @@ type Handle = HandleRec Methods getWeatherData :: Handle -> Location -> Day -> IO WeatherData getWeatherData = getMethod @"getWeatherData" -getTemperatureData :: Handle -> Location -> Day -> IO T.Temperature -getTemperatureData = getMethod @"getTemperatureData" - getWindData :: Handle -> Location -> Day -> IO W.WindSpeed getWindData = getMethod @"getWindData" diff --git a/vinyl-handle/domain/WindProvider.hs b/vinyl-handle/domain/WindProvider.hs index bab1fb7..01f2a62 100644 --- a/vinyl-handle/domain/WindProvider.hs +++ b/vinyl-handle/domain/WindProvider.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE TypeApplications #-} module WindProvider where @@ -12,3 +13,5 @@ type Methods = '[ '("getWindData", (Location -> Day -> IO WindSpeed)) ] type Handle = HandleRec Methods +getWindData :: Handle -> Location -> Day -> IO WindSpeed +getWindData = getMethod @"getWindData" -- 2.34.1