Generalize PagedQuery to allow its reuse by preview github APIs #439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been greatly enjoying the GitHub package as well as the principled approach when considering new APIs and changes. Users pop up from time to time wanting to use another API and GitHub's insistence that many APIs remain beta for an extended period of time has been an hinderance - the machine-man-preview and shadowcat APIs for example.
Github- style packages can be made to support these APIs - it would be great to benefit from all the rich machinery developed here in the github package when doing so. This PR has one small change that doesn't appear to impact the github package's major Haskell APIs, but helps tremendously with reusing github (package) on some preview github (web service) APIs.
Enough preamble! This pull request relaxes PagedQuery from vector to any semigroup foldable. That is:
To:
The consumer of PagedQuery already was generalized to Semigroup but the predicate used vector length, so the consumer only needed to drop
V.
- using foldable length - and everything works as before. That's all that is required for re-use of the pagination machinery for several not-yet-standard APIs.