From: Evgenii Akentev Date: Sat, 9 Jan 2021 15:45:10 +0000 (+0500) Subject: [vinyl-handle]: split methods between providers X-Git-Url: https://git.ak3n.com/?a=commitdiff_plain;h=2343a640bfe97191be7641462da40780bfe75d3c;p=handle-examples.git [vinyl-handle]: split methods between providers --- 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"