In cases where your results are based on a single function returning an ok/error tuple, the size of the tuple will be the same every time, allowing you to use a plain `Enum.filter`, like Chris already mentioned.
In cases where results in your enum are based on various different functions and you might end up having differently-sized tuples in your enumerable, then you should probably refactor this so it becomes normalized again.
Or, if you don't want to, there are a couple of libraries that already allow the functionality that you are looking for.
My own contribution in this regard is the library
Solution, which has a
Solution.Enum module with functions like `oks`, `combine` (which returns a list of all OK-values, or the first encountered error), etc.
I know that besides Solution and MonEx which was mentioned earlier in this topic, at least the libraries Witchcraft, FunLand, OK, Exceptional, OkJose, HappyWith, ElixirMonad and Towel try to do similar things to make working with ok/error tuples (inside pipes and/or enumerables) easier.
On one hand this does make it seem that maybe there is something there that is so general and ubiquitous that the standard library should adopt it.
On the other (and this is the direction I currently lean towards), it's perfectly fine and nice to have so many different, user-maintained, approaches where for each project the best fit can be chosen.
So no, I don't think we should add this.
~Marten / Qqwy