on develop help sign in
Removing extraneous comments
commit847dacf80b3dc2ef9afc06ec28b4f94a77b68d44 authorBrendan Hay <brendan.g.hay@gmail.com> dateMon 12 Oct 2015, 13:20 (11 years ago) parent1535b35
3 files changed+20−69
gogol/gogol.cabal+10−11 gogol/src/Network/Google/Env.hs+9−27 gogol/src/Network/Google/Internal/HTTP.hs+1−31
gogol/gogol.cabal+10−11
@@ -36,22 +36,21 @@ library
3636 , Network.Google.Internal.Types
3737
3838 build-depends:
39− base >= 4.7 && < 5
39+ base >= 4.7 && < 5
40+ , bifunctors
41+ , conduit
42+ , data-default-class >= 0.0.1
4043 , exceptions
41− , gogol-core == 0.0.1.*
44+ , gogol-core == 0.0.1.*
4245 , http-conduit
46+ , http-media
47+ , http-types
4348 , lens
49+ , mmorph
4450 , monad-control
4551 , mtl
4652 , resourcet
47− , retry
53+ , text
4854 , time
4955 , transformers
50− , data-default-class >= 0.0.1
51− , transformers-base
52− , http-types
53− , http-media
54− , text
55− , mmorph
56− , conduit
57− , bifunctors
56+ , transformers-base
gogol/src/Network/Google/Env.hs+9−27
@@ -15,7 +15,6 @@ import Control.Monad
1515import Control.Monad.Catch
1616import Control.Monad.IO.Class
1717import Control.Monad.Reader
18−import Control.Retry
1918import Data.Monoid
2019import Network.Google.Auth
2120import Network.Google.Internal.Types
@@ -35,48 +34,33 @@ data Env = Env
3534-- total field initialisation.
3635
3736class HasEnv a where
38− environment :: Lens' a Env
37+ environment :: Lens' a Env
3938 {-# MINIMAL environment #-}
4039
41− -- -- | The function used to determine if an 'HttpException' should be retried.
42− -- envRetryCheck :: Lens' a (Int -> HttpException -> Bool)
43−
44− -- -- | TODO
45− -- envRetryPolicy :: Lens' a RetryPolicy
46−
4740 -- | TODO
48− envTimeout :: Lens' a (Maybe Seconds)
41+ envTimeout :: Lens' a (Maybe Seconds)
4942
5043 -- | The 'Manager' used to create and manage open HTTP connections.
51− envManager :: Lens' a Manager
44+ envManager :: Lens' a Manager
5245
5346 -- | The credentials used to sign requests for authentication with Google.
54− envAuth :: Lens' a Auth
47+ envAuth :: Lens' a Auth
5548
56− -- envRetryCheck = environment . lens _envRetryCheck (\s a -> s { _envRetryCheck = a })
57− -- envRetryPolicy = environment . lens _envRetryPolicy (\s a -> s { _envRetryPolicy = a })
58− envTimeout = environment . lens _envTimeout (\s a -> s { _envTimeout = a })
59− envManager = environment . lens _envManager (\s a -> s { _envManager = a })
60− envAuth = environment . lens _envAuth (\s a -> s { _envAuth = a })
49+ envTimeout = environment . lens _envTimeout (\s a -> s { _envTimeout = a })
50+ envManager = environment . lens _envManager (\s a -> s { _envManager = a })
51+ envAuth = environment . lens _envAuth (\s a -> s { _envAuth = a })
6152
6253instance HasEnv Env where
6354 environment = id
6455
65−-- -- | Scope an action such that any retry logic for the 'Env' is
66−-- -- ignored and any requests will at most be sent once.
67−-- once :: (MonadReader r m, HasEnv r) => m a -> m a
68−-- once = policy (limitRetries 0)
69−
70−-- -- | TODO
71−-- policy :: (MonadReader r m, HasEnv r) => RetryPolicy -> m a -> m a
72−-- policy r = local (envRetryPolicy <>~ r)
73−
7456-- | Scope an action such that any HTTP response will use this timeout value.
7557--
7658-- Default timeouts are chosen by considering:
7759--
7860-- * This 'timeout', if set.
7961--
62+-- * The related 'Service' timeout for the sent request if set. (Usually 70s)
63+--
8064-- * The 'envManager' timeout if set.
8165--
8266-- * The default 'ClientRequest' timeout. (Approximately 30s)
@@ -94,5 +78,3 @@ newEnv c = liftIO (newManager conduitManagerSettings) >>= newEnvWith c
9478-- | /See:/ 'newEnv'
9579newEnvWith :: (MonadIO m, MonadCatch m) => Credentials -> Manager -> m Env
9680newEnvWith c m = Env Nothing m <$> getAuth c
97− -- where
98− -- check _ _ = True
gogol/src/Network/Google/Internal/HTTP.hs+1−31
@@ -38,7 +38,6 @@ import qualified Network.HTTP.Conduit as Client
3838import Network.HTTP.Media
3939import Network.HTTP.Types
4040
41−-- | The 'Service' is configured + unwrapped at this point.
4241perform :: (MonadCatch m, MonadResource m, GoogleRequest a)
4342 => Env
4443 -> a
@@ -105,33 +104,4 @@ perform Env{..} x = catches go handlers
105104 , Handler $ err . TransportError
106105 ]
107106 where
108− err e = return (Left e) -- logError _envLogger e >>
109−
110− -- success rs = do
111− -- let s = Client.responseStatus rs
112− -- b = Client.responseBody rs
113− -- hs = Client.responseHeaders rs
114− -- case content hs of
115− -- unless (matches respCT (acceptCT)) $
116− -- left $ UnsupportedContentType respCT respBody
117−
118− -- Nothing -> failure (SerializeError' (SerializeError hs))
119−
120− -- Just _ | statusInvalid s -> do
121− -- lbs <- sinkLBS b
122− -- failure (ServiceError' (ServiceError s c hs lbs))
123−
124− -- Just c | contentInvalid c -> do
125− -- lbs <- sinkLBS b
126− -- failure (SerializeError' (SerializeError s c hs lbs))
127−
128−
129− -- Just c -> first SerializeError' <$> f b
130−
131− -- content :: [Header] -> Maybe c
132− -- content = parseAccept
133− -- . fromMaybe "application/octet-stream"
134− -- . lookup hContentType
135−
136− -- statusCheck s = fromEnum s `elem` ns
137− -- contentCheck = matches a
107+ err e = return (Left e)