-
Notifications
You must be signed in to change notification settings - Fork 333
[Polysemy] Introduce the row type variable in Brig #2140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
163db4d
to
651ca90
Compare
@@ -399,8 +399,7 @@ withOptLock u c ma = go (10 :: Int) | |||
execDyn' e m conv cmd = recovering policy handlers (const run) | |||
where | |||
run = execCatch e cmd >>= either handleErr (return . conv) | |||
handlers = httpHandlers --TODO: Figure out why it needs a constraint Typeable effs | |||
-- handlers = httpHandlers ++ [const $ EL.handler_ AWS._ConditionalCheckFailedException (pure True)] | |||
handlers = httpHandlers ++ [const $ Handler $ pure . const True . preview (AWS._ConditionalCheckFailedException @SomeException)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right. The prism doesn't actually get used, so this will catch any exception, rather than the one identified by the prism.
I'm not sure why handler_
requires a typeable constraint (probably a limitation of Control.Monad.Catch
), but that means this code should run in IO
(or some simple monad stack over IO
), and later be lifted to the AppIO
/polysemy monad.
Or, for the time being, you can add a Typeable
instance to AppIO
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting this. I'll take a look at how to fix this.
We didn't want to introduce the Typeable
constraint on AppIO
as that would propagate the constraint further up the call stack, and this doesn't look like the right thing to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for the noise, adding Typeable
constraints is trivial and easy, and the reason it needs to be added explicitly is rather technical. I wouldn't spend any effort trying to avoid it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry, I keep on forgetting not to rebase once a PR is under review.)
I took Paolo's suggestion and turned the helper function to run in IO
instead of running in a constrained monad m
. See 1abfd3c for details.
@fisx , @pcapriotti , is that OK now?
1ba08e7
to
ddb4225
Compare
- This is to work around the issue of an otherwise imposed constraint of `Typeable effs`
ddb4225
to
1abfd3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This is the first PR in a series of PRs that introduce Polysemy to Brig. It introduces the row type variable to several monads in the service.
Checklist
changelog.d
.