whats the purpose of Validation.sequence?

51 views
Skip to first unread message

tsechov

unread,
Jun 25, 2015, 4:14:13 AM6/25/15
to functio...@googlegroups.com
hi guys,
could someone please explain the purpose of Validation.sequence (the static one)?
I need something that given a list of validations collects either the failures if there is any or the successes. I thought Validation.sequence was my friend but apparently its not...
thanks

Runar Bjarnason

unread,
Jun 25, 2015, 4:47:03 AM6/25/15
to functio...@googlegroups.com, tse...@gmail.com
Yeah, the implementation of `Validation.sequence` looks completely incorrect.

tsechov

unread,
Jun 25, 2015, 5:03:16 AM6/25/15
to functio...@googlegroups.com
if you can provide me with a specification I could file a pull request

Tony Morris

unread,
Jun 25, 2015, 5:03:16 AM6/25/15
to functio...@googlegroups.com, tse...@gmail.com
I agree. This is a bug in sequence.

--
You received this message because you are subscribed to the Google Groups "Functional Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to functionaljav...@googlegroups.com.
To post to this group, send email to functio...@googlegroups.com.
Visit this group at http://groups.google.com/group/functionaljava.
For more options, visit https://groups.google.com/d/optout.

Tony Morris

unread,
Jun 25, 2015, 5:13:08 AM6/25/15
to functio...@googlegroups.com
Actually the one that is there should possibly stay, though perhaps renamed to indicate that it doesn't accumulate. A rename is ideal as it will ensure that existing clients break (won't compile), because it will accept a new argument (Semigroup).

I have written up a specification in Haskell.

https://gist.github.com/tonymorris/cbc051406b974df69e69

tsechov

unread,
Jun 25, 2015, 5:37:22 AM6/25/15
to functio...@googlegroups.com
thanks
Im gonna send a PR in the upcoming days
last question: what should the old one be renamed to? like sequenceNoncumulate?

Rúnar Bjarnason

unread,
Jun 25, 2015, 5:44:36 AM6/25/15
to functio...@googlegroups.com
Honestly, the old one looks broken. It seems like it would never return anything in the case of any failures in the list.

Mark Perry

unread,
Jun 26, 2015, 8:02:31 PM6/26/15
to functio...@googlegroups.com, tmo...@tmorris.net, tse...@gmail.com

I created two issues, one to fix and rename the existing method and the other to implement sequence with a semigroup.

See:


I look forward to your PR Tsechov covering both issues.

Regards,
Mark
Reply all
Reply to author
Forward
0 new messages