repos / handle-examples.hs.git


commit
2343a64
parent
bc90443
author
Evgenii Akentev
date
2021-01-09 19:45:10 +0400 +04
[vinyl-handle]: split methods between providers
3 files changed,  +7, -3
M vinyl-handle/domain/TemperatureProvider.hs
+4, -0
 1@@ -1,5 +1,6 @@
 2 {-# LANGUAGE DataKinds #-}
 3 {-# LANGUAGE OverloadedStrings #-}
 4+{-# LANGUAGE TypeApplications #-}
 5 
 6 module TemperatureProvider where
 7 
 8@@ -11,3 +12,6 @@ type Temperature = Int
 9 type Methods = '[ '("getTemperatureData", (Location -> Day -> IO Temperature)) ]
10 
11 type Handle = HandleRec Methods
12+
13+getTemperatureData :: Handle -> Location -> Day -> IO Temperature
14+getTemperatureData = getMethod @"getTemperatureData"
M vinyl-handle/domain/WeatherProvider.hs
+0, -3
1@@ -22,8 +22,5 @@ type Handle = HandleRec Methods
2 getWeatherData :: Handle -> Location -> Day -> IO WeatherData
3 getWeatherData = getMethod @"getWeatherData"
4 
5-getTemperatureData :: Handle -> Location -> Day -> IO T.Temperature
6-getTemperatureData = getMethod @"getTemperatureData"
7-
8 getWindData :: Handle -> Location -> Day -> IO W.WindSpeed
9 getWindData = getMethod @"getWindData"
M vinyl-handle/domain/WindProvider.hs
+3, -0
 1@@ -1,5 +1,6 @@
 2 {-# LANGUAGE DataKinds #-}
 3 {-# LANGUAGE OverloadedStrings #-}
 4+{-# LANGUAGE TypeApplications #-}
 5 
 6 module WindProvider where
 7 
 8@@ -12,3 +13,5 @@ type Methods = '[ '("getWindData", (Location -> Day -> IO WindSpeed)) ]
 9 
10 type Handle = HandleRec Methods
11 
12+getWindData :: Handle -> Location -> Day -> IO WindSpeed
13+getWindData = getMethod @"getWindData"