demystifyfp/FsToolkit.ErrorHandling

Should List.sequenceValidationA preserve order?

ursenzler opened this issue · 2 comments

Describe the bug
I expected this test to succeed, but it failed because the order of the errors was reversed.

[]
let List.sequenceValidation preserves order of errors () =
let result = [ Result.Error [ "a" ]; Result.Error [ "b" ] ] |> List.sequenceValidationA
test <@ result = Result.Error [ "a"; "b" ] @>

To Reproduce
Run above test

Expected behavior
Order should be preserved

Additional context
It's absolutely okay when you say that this behaviour is by design or because of performance reasons. Then I'll reverse the errors in my code. I just want to ensure that it's not a "bug" that gets fixed eventually, and my errors are wrong again.

Definitely feels like a missed List.rev. Happy to take a contribution for fixing this!

Ok, I'll work on it.