Skip to content
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

Generalise Service Error Matcher Optics #878

Merged
merged 7 commits into from
Jan 10, 2023

Conversation

endgame
Copy link
Collaborator

@endgame endgame commented Jan 9, 2023

The service error matchers have a type annotation which restricts them to AsError a => Getting (First ServiceError) a ServiceError. Generalise the type signature to the AsError a => Fold a ServiceError that they are, and update the generator to annotate generated matchers correctly also.

The optics actually type-check as AsError a => Traversal' a ServiceError or even AsError a => Prism' a ServiceError, but because they use filtered internally, those optics are only lawful if data written back through them satisfies the predicate. Since their old type signature meant they were only usable for matching and nobody has complained, the ability to write back through them has probably not been missed.

This means we'll have to regenerate everything again, so update botocore and configure new services too. Note that this time existing code will continue to work, but I'll aim to get the regeneration up ASAP.

Copy link
Contributor

@axman6 axman6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, should stop people doing silly things.

@endgame
Copy link
Collaborator Author

endgame commented Jan 9, 2023

People have never been able to do silly things, but now they are able to do more not-silly things with an error matcher than just preview through it. has is the obvious one.

@endgame endgame added this to the 2.0 milestone Jan 9, 2023
@endgame endgame merged commit d5c2838 into brendanhay:main Jan 10, 2023
@endgame endgame deleted the generalise-optics branch January 10, 2023 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants