You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While writing an example that uses hooks, I noticed that they were very hard to use correctly, and reasonable-looking code would silently ignore the request type you think you're hooking into.
We should provide {add,remove}Hook{,_} variants which are specialised to each hook type and are harder to misuse:
addHookFor and addHookFor_ should be moved to the bottom of the file and marked {-# DEPRECATED #-} with a message recommending the hook-specific functions, and promising removal in 2.2. The export list for Amazonka.Env.Hooks should have a -- * section for deprecated functions.
addAWSRequestHook should be renamed to addRequestHookFor, and addAWSRequestHook should remain as a {-# DEPRECATED #-} alias, also scheduled for removal in 2.2.
addAWSRequestHook_ should be deprecated and scheduled for removal in 2.2.
removeHooksFor and removeHooksFor_ should be moved to the bottom of the file and deprecated, much the same as №1.
For each field in the Hooks record (example requestRetry) that has a forall a, we should have:
An add-for function for this hook: addRequestRetryHookFor :: forall a b. Hook_ (Request a, Text, Retry.RetryStatus) -> Hook_ (Request b, Text, Retry.RetryStatus) -> Hook_ (Request b, Text, Retry.RetryStatus) = addHookFor_ @(Request a, Text, Retry.RetryStatus)
A remove-for function for this hook: removeRequestRetryHookFor :: _ = removeHookFor_
Haddocks for each new function from №5
Export these in a new -- ** Functions for specific hooks first, with an explanatory note:
-- ** Functions for specific hooks-- $functions-specific-hooks (say that the type application for these is the AWS Request type e.g. `@S3.GetObject`.)
addRequestHookFor,
removeRequestsHooksFor,
...-- ** Functions for arbitrary hooks-- $functions-arbitrary-hooks
noHook,
noHook_,
addHook,
addHook_,
...
The text was updated successfully, but these errors were encountered:
This pre-emptively deprecates the generic and easy to misuse hook helpers
`addHook` and `addHook_` before the introduction of the new variants.
Relates to brendanhay#995.
While writing an example that uses hooks, I noticed that they were very hard to use correctly, and reasonable-looking code would silently ignore the request type you think you're hooking into.
We should provide
{add,remove}Hook{,_}
variants which are specialised to each hook type and are harder to misuse:addHookFor
andaddHookFor_
should be moved to the bottom of the file and marked{-# DEPRECATED #-}
with a message recommending the hook-specific functions, and promising removal in 2.2. The export list forAmazonka.Env.Hooks
should have a-- * section
for deprecated functions.addAWSRequestHook
should be renamed toaddRequestHookFor
, andaddAWSRequestHook
should remain as a{-# DEPRECATED #-}
alias, also scheduled for removal in 2.2.addAWSRequestHook_
should be deprecated and scheduled for removal in 2.2.removeHooksFor
andremoveHooksFor_
should be moved to the bottom of the file and deprecated, much the same as №1.Hooks
record (examplerequestRetry
) that has aforall a
, we should have:addRequestRetryHookFor :: forall a b. Hook_ (Request a, Text, Retry.RetryStatus) -> Hook_ (Request b, Text, Retry.RetryStatus) -> Hook_ (Request b, Text, Retry.RetryStatus) = addHookFor_ @(Request a, Text, Retry.RetryStatus)
removeRequestRetryHookFor :: _ = removeHookFor_
-- ** Functions for specific hooks
first, with an explanatory note:The text was updated successfully, but these errors were encountered: