File tree Expand file tree Collapse file tree 5 files changed +20
-19
lines changed
FSharp.Control.TaskSeq.Test Expand file tree Collapse file tree 5 files changed +20
-19
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ let ``CE taskSeq: use 'let!' with all kinds of overloads at once`` () =
127127 return value
128128 }
129129
130- let! b = // eq 2
130+ let! b = // eq 2
131131 task {
132132 do ! Task.Delay 50
133133 do value <- value + 1
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ type TaskSeqStateMachineData<'T>() =
8080 member data.PushDispose ( disposer : unit -> Task ) =
8181 if isNull data.disposalStack then
8282 data.disposalStack <- ResizeArray()
83+
8384 data.disposalStack.Add disposer
8485
8586 member data.PopDispose () =
Original file line number Diff line number Diff line change @@ -134,8 +134,10 @@ type TaskSeqBuilder =
134134 member inline TryFinally : body : ResumableTSC < 'T > * compensationAction : ( unit -> unit ) -> ResumableTSC < 'T >
135135 member inline TryFinallyAsync : body : ResumableTSC < 'T > * compensationAction : ( unit -> Task ) -> ResumableTSC < 'T >
136136 member inline TryWith : body : ResumableTSC < 'T > * catch : ( exn -> ResumableTSC < 'T >) -> ResumableTSC < 'T >
137+
137138 member inline Using :
138139 disp : 'Disp * body : ( 'Disp -> ResumableTSC < 'T >) -> ResumableTSC < 'T > when 'Disp :> IAsyncDisposable
140+
139141 member inline While : condition : ( unit -> bool ) * body : ResumableTSC < 'T > -> ResumableTSC < 'T >
140142 /// Used by `For`. F # currently doesn't support `while ! ` , so this cannot be called directly from the CE
141143 member inline WhileAsync : condition : ( unit -> ValueTask < bool >) * body : ResumableTSC < 'T > -> ResumableTSC < 'T >
@@ -179,6 +181,7 @@ module MediumPriority =
179181 // NOTE: syntax with '#Disposable' won't work properly in FSI
180182 member inline Using :
181183 dispensation : 'Disp * body : ( 'Disp -> ResumableTSC < 'T >) -> ResumableTSC < 'T > when 'Disp :> IDisposable
184+
182185 member inline For : sequence : seq < 'TElement > * body : ( 'TElement -> ResumableTSC < 'T >) -> ResumableTSC < 'T >
183186 member inline YieldFrom : source : seq < 'T > -> ResumableTSC < 'T >
184187 member inline For : source : #taskSeq < 'TElement > * body : ( 'TElement -> ResumableTSC < 'T >) -> ResumableTSC < 'T >
Original file line number Diff line number Diff line change @@ -120,15 +120,15 @@ module internal TaskSeqInternal =
120120 i <- i + 1 // update before moving: we are counting, not indexing
121121 go <- step
122122
123- | Some ( Predicate predicate) ->
123+ | Some( Predicate predicate) ->
124124 while go do
125125 if predicate e.Current then
126126 i <- i + 1
127127
128128 let! step = e.MoveNextAsync()
129129 go <- step
130130
131- | Some ( PredicateAsync predicate) ->
131+ | Some( PredicateAsync predicate) ->
132132 while go do
133133 match ! predicate e.Current with
134134 | true -> i <- i + 1
@@ -197,7 +197,7 @@ module internal TaskSeqInternal =
197197 // multiple threads access the same item through the same enumerator (which is
198198 // bad practice, but hey, who're we to judge).
199199 if isNull value then
200- value <- Lazy<_>. Create ( fun () -> init i)
200+ value <- Lazy<_>. Create( fun () -> init i)
201201
202202 yield value.Force()
203203 value <- Unchecked.defaultof<_>
Original file line number Diff line number Diff line change @@ -74,18 +74,16 @@ module Task =
7474 :> Task
7575
7676 /// Map a Task<'T>
77- let inline map mapper ( task : Task < 'T >) : Task < 'U > =
78- TaskBuilder.task {
79- let! result = task
80- return mapper result
81- }
77+ let inline map mapper ( task : Task < 'T >) : Task < 'U > = TaskBuilder.task {
78+ let! result = task
79+ return mapper result
80+ }
8281
8382 /// Bind a Task<'T>
84- let inline bind binder ( task : Task < 'T >) : Task < 'U > =
85- TaskBuilder.task {
86- let! t = task
87- return ! binder t
88- }
83+ let inline bind binder ( task : Task < 'T >) : Task < 'U > = TaskBuilder.task {
84+ let! t = task
85+ return ! binder t
86+ }
8987
9088 /// Create a task from a value
9189 let inline fromResult ( value : 'U ) : Task < 'U > = TaskBuilder.task { return value }
@@ -107,11 +105,10 @@ module Async =
107105 }
108106
109107 /// Map an Async<'T>
110- let inline map mapper ( async : Async < 'T >) : Async < 'U > =
111- ExtraTopLevelOperators.async {
112- let! result = async
113- return mapper result
114- }
108+ let inline map mapper ( async : Async < 'T >) : Async < 'U > = ExtraTopLevelOperators.async {
109+ let! result = async
110+ return mapper result
111+ }
115112
116113 /// Bind an Async<'T>
117114 let inline bind binder ( task : Async < 'T >) : Async < 'U > = ExtraTopLevelOperators.async { return ! binder task }
You can’t perform that action at this time.
0 commit comments