I've really struggled with Haskell's lack of support of pagination, and worked on at least two "inner-source" libraries that offer what the author is calling "Key Set" or limit/offset and Cursor Based as Servant combinators.
What I've found, is that "Key Set" is much more ergonomic for library authors to implement, if they have to write the database/sql calls themselves, although "Cursor Based" is technically more efficient.
It's my opinion that the standard, out of the box behavior for an endpoint should be to paginate every single endpoint that returns a list of results, but in order to do that easily you'll need some framework support. More mature frameworks have this right now, and IMO this is one of the weak points in using a less supported language like Haskell. You'll either have to roll your own solution, or rely on spotty library support that does that pagination operation in CPU.
I've really struggled with Haskell's lack of support of pagination, and worked on at least two "inner-source" libraries that offer what the author is calling "Key Set" or limit/offset and Cursor Based as Servant combinators.
What I've found, is that "Key Set" is much more ergonomic for library authors to implement, if they have to write the database/sql calls themselves, although "Cursor Based" is technically more efficient.
It's my opinion that the standard, out of the box behavior for an endpoint should be to paginate every single endpoint that returns a list of results, but in order to do that easily you'll need some framework support. More mature frameworks have this right now, and IMO this is one of the weak points in using a less supported language like Haskell. You'll either have to roll your own solution, or rely on spotty library support that does that pagination operation in CPU.