add minimal support for resolve function returning IO #987
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.
Add experimental support for cats effect IO in a new experimental module.
The base classes are depending on
Async
, so it should be possible to support any effect library compatible with it.The support is very minimal as the
Async
will be converted to a standard scalaFuture
for the moment.How to use it:
first import the library:
to use
IO
in resolve functions:to get an
IO
when executing a query:FAQ
What happens if I don't use the same effect type in resolve and in the execution scheme?
This will fail miserably.
Making this type safe will probably never be implemented. I've tried, and the code is impacted at too many places.
What's the point of this change if we are still relying on
Future
under the hood?Resolver
without Future in a later phase.When will we have a
Resolver
totally implemented withAsync
?I don't know. If you want to join the party, you're welcome.
Does this change also provide better support for fs2 streams?
Not yet. I first focus on
IO
.Why is the code in the sangria main library and not in a separated code base?
I have to change the structure of the code of sangria to enable this integration:
Those changes are easier if the implementations live in the same code base for the moment. Once this is stable, we can extract it into another library.
Is sangria depending on cats-effect now?
No, sangria does not have any dependency on cats-effect. Only the new library has this dependency.