Skip to content

Commit aa44a44

Browse files
committed
Avoid sync optimization
1 parent bf49501 commit aa44a44

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/FSharpPlus/Extensions/Task.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ module Task =
5252
/// <param name="source">The source task workflow.</param>
5353
/// <returns>The resulting task workflow.</returns>
5454
let map (mapper: 'T -> 'U) (source: Task<'T>) : Task<'U> =
55-
let source = nullArgCheck (nameof source) source
56-
57-
if source.IsCompleted then
58-
match source with
59-
| Succeeded r -> try result (mapper r) with e -> raise e
60-
| Faulted exn -> raise exn
61-
| Canceled -> canceled
62-
else
55+
// let source = nullArgCheck (nameof source) source
56+
//
57+
// if source.IsCompleted then
58+
// match source with
59+
// | Succeeded r -> try result (mapper r) with e -> raise e
60+
// | Faulted exn -> raise exn
61+
// | Canceled -> canceled
62+
// else
6363
let tcs = TaskCompletionSource<'U> ()
6464
let k = function
6565
| Succeeded r -> try tcs.SetResult (mapper r) with e -> tcs.SetException e

src/FSharpPlus/Extensions/ValueTask.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ module ValueTask =
217217

218218

219219
/// <summary>Creates a ValueTask workflow from 'source' workflow, mapping and flattening its result with 'f'.</summary>
220-
let bind (f: 'T -> ValueTask<'U>) (source: ValueTask<'T>) : ValueTask<'U> =
220+
let bind (f: 'T -> ValueTask<'U>) (source: ValueTask<'T>) : ValueTask<'U> = source |> Unchecked.nonNull |> map f |> join
221221
let tcs = TaskCompletionSource<'U> ()
222222
continueTask tcs source (fun x ->
223223
try

0 commit comments

Comments
 (0)