Skip to content

Commit f35a483

Browse files
authored
List.traverseValidationA and List.sequenceValidationA now preserve the order of errors (#192)
* List.traverseValidationA and List.sequenceValidationA now preserve the order of errors * List.traverseValidationA: use Result.eitherMap to preserve order or errors * Formatted List.fs * formatted List.fs
1 parent 135b610 commit f35a483

File tree

2 files changed

+3
-3
lines changed
  • src/FsToolkit.ErrorHandling
  • tests/FsToolkit.ErrorHandling.Tests

2 files changed

+3
-3
lines changed

src/FsToolkit.ErrorHandling/List.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module List =
8989
match xs with
9090
| [] ->
9191
state
92-
|> Result.map List.rev
92+
|> Result.eitherMap List.rev List.rev
9393
| x :: xs ->
9494
let fR = f x
9595

tests/FsToolkit.ErrorHandling.Tests/List.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ let traverseValidationATests =
198198
Expect.equal
199199
actual
200200
(Error [
201-
longerTweetErrMsg
202201
emptyTweetErrMsg
202+
longerTweetErrMsg
203203
])
204204
"traverse the list and return all the errors"
205205
]
@@ -240,8 +240,8 @@ let sequenceValidationATests =
240240
Expect.equal
241241
actual
242242
(Error [
243-
longerTweetErrMsg
244243
emptyTweetErrMsg
244+
longerTweetErrMsg
245245
])
246246
"traverse the list and return all the errors"
247247
]

0 commit comments

Comments
 (0)