Skip to content

Commit

Permalink
[v5] Updated Uses of Seq.Append (#290)
Browse files Browse the repository at this point in the history
* Removed uses of Seq.append

* Merge branch 'master' into 'v5-2-seq-fixes'
  • Loading branch information
1eyewonder authored Dec 21, 2024
1 parent da766ed commit 025abc3
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions src/FsToolkit.ErrorHandling/Seq.fs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// See here for previous design disccusions:
// 1. https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/277

[<RequireQualifiedAccess>]
module FsToolkit.ErrorHandling.Seq

Expand Down Expand Up @@ -62,10 +65,18 @@ let inline traverseResultA' state ([<InlineIfLambda>] f: 'okInput -> Result<'okO
let folder state x =
match state, f x with
| Error errors, Error e ->
Seq.append errors (Seq.singleton e)
seq {
e
yield! Seq.rev errors
}
|> Seq.rev
|> Error
| Ok oks, Ok ok ->
Seq.append oks (Seq.singleton ok)
seq {
ok
yield! Seq.rev oks
}
|> Seq.rev
|> Ok
| Ok _, Error e ->
Seq.singleton e
Expand Down Expand Up @@ -167,10 +178,18 @@ let inline traverseAsyncResultA'
return
match state, result with
| Error errors, Error e ->
Seq.append errors (Seq.singleton e)
seq {
e
yield! Seq.rev errors
}
|> Seq.rev
|> Error
| Ok oks, Ok ok ->
Seq.append oks (Seq.singleton ok)
seq {
ok
yield! Seq.rev oks
}
|> Seq.rev
|> Ok
| Ok _, Error e ->
Seq.singleton e
Expand Down

0 comments on commit 025abc3

Please sign in to comment.