Parallelism
Bombe opened this issue · comments
In your talk (great talk, by the way) you mentioned combining several validators into a kind of parallel validator. However, for that to work (and to be able to tell you that neither name nor email address are allowed to be blank) you would need to collect failures in a list, wouldn’t you? I don’t see that reflected in the code so I’m wondering whether I’m wrong about this or whether it simply doesn’t exist in the code. :)
Hi David,
Yes, I do mention it here: http://www.slideshare.net/ScottWlaschin/railway-oriented-programming/138. And you're right, the answer is have the failure part be a list rather than a single error.
I didn't go into detail on how to do this in the talk, but the example code shows how it works:
- Here's the definition and here's the key piece of code that combines errors
- Here's an example of doing validation
- Here's an example of combining the validations
The use of <!>
and <*>
symbols is explained in much more detail in this other post:
Hope that helps!
-- Scott
Yes, I believe it does help. Thank you!