Skip to content

Commit

Permalink
+ Task.ofValue
Browse files Browse the repository at this point in the history
  • Loading branch information
gusty authored Sep 19, 2023
1 parent 06f04c8 commit bcf9ed8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/FSharpPlus/Extensions/Task.fs
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,12 @@ module Task =
(fun () -> body disp)
(fun () -> if not (isNull (box disp)) then disp.Dispose ())

/// Creates a Task from a value
let ofValue value = Task.FromResult value

/// Raises an exception in the Task
let raise (e: exn) =
let tcs = TaskCompletionSource<'U> ()
tcs.SetException e
tcs.Task
#endif
#endif

0 comments on commit bcf9ed8

Please sign in to comment.