Created
September 21, 2021 15:56
-
-
Save nomisRev/2e4f06bcffd01833df612114814eefa0 to your computer and use it in GitHub Desktop.
Arrow Computation block `eager` vs `suspend`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The DSL uses the suspension system, but the Restricted version uses @RestrictSuspension. | |
This disallows any suspend function to be called inside the DSL except for the functions defined inside RestrictOptionEffect. | |
This means that the DSL can be evaluated immediately, or eagerly. Instead of requiring suspend. | |
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/-restricts-suspension/ | |
If you’re already inside a suspend context then it makes most sense to just use the suspend version. That’ll also allow you to use other suspending code inside the DSL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment