File tree Expand file tree Collapse file tree
tests/FSharpx.Async.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -506,21 +506,6 @@ module AsyncSeq =
506506 | Choice2Of2 e ->
507507 return Choice2Of2 e }
508508
509- /// Returns an async computation which iterates the async sequence for
510- /// its side-effects.
511- let inline runAsync ( s : AsyncSeq < unit >) : Async < unit > =
512- s |> iter id
513-
514- /// Iterates an async sequence using the specified function until it returns false.
515- let inline iterWhileAsync ( f : 'a -> Async < bool >) ( s : AsyncSeq < 'a >) : Async < unit > =
516- let rec sink () = asyncSeq {
517- let c = new AsyncResultCell<_>()
518- yield ( fun a -> f a |> Async.map ( fun f -> c.RegisterResult( AsyncOk f, true )))
519- let! flag = c.AsyncResult
520- if flag then yield ! sink()
521- else () }
522- zappAsync ( sink()) s |> runAsync
523-
524509 /// Returns elements from an asynchronous sequence while the specified
525510 /// predicate holds. The predicate is evaluated asynchronously.
526511 let rec takeWhileAsync p ( input : AsyncSeq < 'T >) : AsyncSeq < _ > = async {
Original file line number Diff line number Diff line change @@ -99,14 +99,6 @@ let ``AsyncSeq.zipWithAsync``() =
9999 Assert.True( EQ expected actual)
100100
101101
102- [<Test>]
103- let ``AsyncSeq.iterWhileAsync`` () =
104- let s = [ 1 ; 2 ; 3 ; 4 ; 5 ] |> AsyncSeq.ofSeq
105- let seen = ResizeArray<_>()
106- s |> AsyncSeq.iterWhileAsync ( fun x -> seen.Add( x) ; ( x < 3 ) |> async.Return) |> Async.RunSynchronously
107- Assert.True(( seen |> List.ofSeq = [ 1 ; 2 ; 3 ]))
108-
109-
110102[<Test>]
111103let ``AsyncSeq.skipWhileAsync`` () =
112104 let ls = [ 1 ; 2 ; 3 ; 4 ; 5 ]
You can’t perform that action at this time.
0 commit comments