[langsec-discuss] New Play validation API

Brian McKenna brian at brianmckenna.org
Sun Jan 26 20:05:05 UTC 2014


This is similar to scalaz' Validation structure:

https://github.com/scalaz/scalaz/blob/scalaz-seven/core/src/main/scala/scalaz/Validation.scala

One thing I noticed about Play's API is that it has a flatMap method.
The problem with providing this is it can't accumulate errors, as
demonstrated here:

    Failure(Seq("Something", "went")) *> Failure(Seq("wrong"))
    // Failure(Seq("Something", "went", "wrong"))

    Failure(Seq("Something", "went")) flatMap { _ => Failure(Seq("wrong")) }
    // Failure(Seq("Something", "went"))

So flatMap can silently ignore errors. Really not nice. This used to
be a problem in scalaz but it has been deprecated and will be deleted
in the next release.


On 23 January 2014 13:27, Will Sargent <will.sargent at gmail.com> wrote:
> Tweeted about this earlier, but figure langsec may be interested as a group:
>
> http://jto.github.io/articles/play_new_validation_api/
>
> Will.
>
> _______________________________________________
> langsec-discuss mailing list
> langsec-discuss at mail.langsec.org
> https://mail.langsec.org/cgi-bin/mailman/listinfo/langsec-discuss
>


More information about the langsec-discuss mailing list