Skip to content

Commit

Permalink
f sequenceResultM docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bartelink committed Feb 15, 2024
1 parent b254b92 commit 99d629a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gitbook/seq/sequenceResultM.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ let isPrime (x: int) =
else isPrime' x (i + 1)
isPrime' x 2
// int seq -> Result<bool, string list>
// int seq -> Result<bool, string[]>
let checkIfAllPrime (numbers: seq<int>) =
numbers
|> Seq.map isPrime // Result<bool, string> list
|> Seq.sequenceResultM // Result<bool list, string>
|> Seq.map isPrime // seq<Result<bool, string>>
|> Seq.sequenceResultM // Result<bool[], string>
|> Result.map (Array.forall id) // shortened version of '|> Result.map (fun bools -> bools |> Array.forall (fun x -> x = true))'
let a = [ 1; 2; 3; 4; 5 ] |> checkIfAllPrime
Expand Down

0 comments on commit 99d629a

Please sign in to comment.