on develop help sign in
Using disambiguated ServiceConfig definition
commit2835fc2a9ea5f8527450ea6e5655dcd4278782ba authorBrendan Hay <brendan.g.hay@gmail.com> dateFri 18 Mar 2016, 15:44 (11 years ago) parentbd4bff1
2 files changed+8−9
gogol/src/Network/Google/Env.hs+5−5 gogol/src/Network/Google/Internal/HTTP.hs+3−4
gogol/src/Network/Google/Env.hs+5−5
@@ -22,7 +22,7 @@ import Network.HTTP.Conduit
2222
2323-- | The environment containing the parameters required to make Google requests.
2424data Env = Env
25− { _envOverride :: !(Dual (Endo Service))
25+ { _envOverride :: !(Dual (Endo ServiceConfig))
2626 , _envLogger :: !Logger
2727 , _envManager :: !Manager
2828 , _envStore :: !Store
@@ -36,7 +36,7 @@ class HasEnv a where
3636 {-# MINIMAL environment #-}
3737
3838 -- | The currently applied overrides to all 'Service' configuration.
39− envOverride :: Lens' a (Dual (Endo Service))
39+ envOverride :: Lens' a (Dual (Endo ServiceConfig))
4040
4141 -- | The function used to output log messages.
4242 envLogger :: Lens' a Logger
@@ -61,7 +61,7 @@ instance HasEnv Env where
6161-- To override a specific service, it's suggested you use
6262-- either 'configure' or 'reconfigure' with a modified version of the default
6363-- service, such as @Network.Google.Gmail.gmailService@.
64−override :: HasEnv a => (Service -> Service) -> a -> a
64+override :: HasEnv a => (ServiceConfig -> ServiceConfig) -> a -> a
6565override f = envOverride <>~ Dual (Endo f)
6666
6767-- | Configure a specific service. All requests belonging to the
@@ -71,7 +71,7 @@ override f = envOverride <>~ Dual (Endo f)
7171-- as @Network.Google.Gmail.gmailService@.
7272--
7373-- /See:/ 'reconfigure'.
74−configure :: HasEnv a => Service -> a -> a
74+configure :: HasEnv a => ServiceConfig -> a -> a
7575configure s = override f
7676 where
7777 f x | on (==) _svcId s x = s
@@ -84,7 +84,7 @@ configure s = override f
8484-- as @Network.Google.Gmail.gmailService@.
8585--
8686-- /See:/ 'configure'.
87−reconfigure :: (MonadReader r m, HasEnv r) => Service -> m a -> m a
87+reconfigure :: (MonadReader r m, HasEnv r) => ServiceConfig -> m a -> m a
8888reconfigure = local . configure
8989
9090-- | Scope an action such that any HTTP response will use this timeout value.
gogol/src/Network/Google/Internal/HTTP.hs+3−4
@@ -49,10 +49,9 @@ perform :: (MonadCatch m, MonadResource m, GoogleRequest a)
4949 -> m (Either Error (Rs a))
5050perform Env{..} x = catches go handlers
5151 where
52− Request {..} = _cliRequest
53− Service {..} = _cliService
54−
55− Client {..} = requestClient x
52+ Request {..} = _cliRequest
53+ ServiceConfig {..} = _cliService
54+ Client {..} = requestClient x
5655 & clientService %~ appEndo (getDual _envOverride)
5756
5857 go = liftResourceT $ do