File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
src/FSharpPlus/Extensions Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -530,8 +530,13 @@ module Task =
530530 /// <returns >The resulting Task.</returns >
531531 let ofResult ( source : Result < 'T , exn >) : Task < 'T > =
532532 match source with
533+ #if ! NET45
534+ | Ok x -> Task.FromResult x
535+ | Error exn -> Task.FromException< 'T> exn
536+ #else
533537 | Ok x -> result x
534538 | Error exn -> raise exn
539+ #endif
535540
536541
537542/// Workaround to fix signatures without breaking binary compatibility.
Original file line number Diff line number Diff line change @@ -428,7 +428,12 @@ module ValueTask =
428428 /// <returns >The resulting Task.</returns >
429429 let ofResult ( source : Result < 'T , exn >) : ValueTask < 'T > =
430430 match source with
431+ #if NET5_ 0_ OR_ GREATER
432+ | Ok x -> ValueTask.FromResult x
433+ | Error exn -> ValueTask.FromException< 'T> exn
434+ #else
431435 | Ok x -> result x
432436 | Error exn -> raise exn
437+ #endif
433438
434439#endif
You can’t perform that action at this time.
0 commit comments