I cannot seem to find an equivalent of .Somes (for IEnumerable<Option<T>>) for IEnumerable<Validation<Error,T>> where I end up with an IEnumerable<T> (using only the SUCCs and disregarding all the errors of the FAILs).
Is it available? Or is it a conscious choice to leave this out, since there isn't always a clear usecase for this?
It doesn't currently exist, not for any conscious reason, I will add it. There is functionality existing to do it, but it's a little _generic heavy_:
```c#
var vs = new[] {Success
var xs = Choice.rights
```
@louthy Instead of the example you give for a current workaround, you could also do this right?
var vs = new[] {Success<string, int>(1), Success<string, int>(2), Success<string, int>(3)};
var xs = vs.Bind((v) => v.SuccessAsEnumerable());
Or am I missing something?
You could, but personally, I'd just write an extension method whilst you're waiting for the Successes method to exist ;)
```c#
public static class ValidationExt
{
public static IEnumerable Successes
Choice.rights
Validation
Seq
}
Or, if you want the most optimal:
```c#
public static class ValidationExt
{
public static IEnumerable<S> Successes<F, S>(this IEnumerable<Validation<F, S>> vs)
{
foreach(var v in vs)
{
if(v.IsSuccess) yield return (S)v;
}
}
}
The real code for this is here. I'd expect to deploy it to the beta in a day or so.
It's now in the latest beta, which I consider to be stable (it's staying as beta for a while as I'm looking to make this into version 4.0.0 of lang-ext.