You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was always quite weird to me that Raise DSL doesn't include a method that would just execute all validation checks ignoring their results, cause usually I just discard trailing lambda arguments, as above. I now implemented something like this:
I find this approach much cleaner, as adding a new validation check doesn't require adding another lambda argument which is usually discarded anyway. It also reads more declaratively I think: "The result is either accumulated errors or ResultIfValid"
The difference is cosmetic, but few people I've been working with, who had no prior experience with Arrow, got quite scared by the zipOrAccumulate syntax (in the first example we don't even zip anything). It's also annoying that the compiler immediately starts to complain when there are not enough lambda parameters, as it makes experimenting and refactoring harder.
The text was updated successfully, but these errors were encountered:
koswag
changed the title
["Request"]
["Request"] Parallel validation DSL method
Aug 30, 2024
koswag
changed the title
["Request"] Parallel validation DSL method
["Request"] DSL method for validation
Sep 9, 2024
What version are you currently using?
1.2.4
What would you like to see?
Hey guys, first of all I love Arrow and how well it cooperates with Kotlin, hell of a good job!
My main use-case for the
Either
type is parallel validation. For that I usezipOrAccumulate
of course:It was always quite weird to me that Raise DSL doesn't include a method that would just execute all validation checks ignoring their results, cause usually I just discard trailing lambda arguments, as above. I now implemented something like this:
I find this approach much cleaner, as adding a new validation check doesn't require adding another lambda argument which is usually discarded anyway. It also reads more declaratively I think: "The result is either accumulated errors or ResultIfValid"
The difference is cosmetic, but few people I've been working with, who had no prior experience with Arrow, got quite scared by the
zipOrAccumulate
syntax (in the first example we don't even zip anything). It's also annoying that the compiler immediately starts to complain when there are not enough lambda parameters, as it makes experimenting and refactoring harder.The text was updated successfully, but these errors were encountered: