-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accumulate errors a la Validation #103
Comments
Like maybe a variant that uses |
We should be able to do this. It might take a fair bit to not break the current style, but I thing it is doable and worth it. There is a pattern by which you can build an applicative structure using a CPS'd reader that would give you the behavior even for current flatMap style. Also now is probably a good time to do it. We will have to make a few incompatible changes for 6.1 as anyway. |
the CPSed reader sounds interesting, do you know where i could find a description of this technique? |
@ritschwumm Not sure of any good references beside some code -https://github.com/pcapriotti/optparse-applicative/blob/master/Options/Applicative/Types.hs#L189-201 |
This is a really nice feature that I miss a lot - any plans on incorporating this in argonaut-6.1? |
@eirirlar Well if it were to make it into a release it would be 6.2, but since the core lib in that doesn't depend on Scalaz at the very least it wouldn't be Validation. As far as doing this without that it's probably still possible. |
If I have
case class Person(name: String, age: Int)
, and then I runParse.decode[Person]("{}"})
, I want "missing fields: name, age", not just "missing field: name"Like maybe a cursor variant that returns Validation not /, so one could write a Decode instance like
((c --\ "name").as[String] |@| (c --\ "age").as[Int])(Person)
, to get notified of both fields missing?The text was updated successfully, but these errors were encountered: