@@ -5,37 +5,14 @@ namespace FSharpPlus
55/// Additional operations on ValueTask<'T> 
66[<RequireQualifiedAccess>] 
77module  ValueTask  = 
8-     
9-     open  System.Threading  
8+ 
109    open  System.Threading .Tasks  
1110
1211    let inline  internal  (| Succeeded | Canceled | Faulted |)  ( t :  ValueTask < 'T >)  = 
1312        if  t.IsCompletedSuccessfully then  Succeeded t.Result
1413        elif  t.IsCanceled then  Canceled
15-         else  Faulted ( t.AsTask() .Exception.InnerExceptions) 
16-     
17-     /// <summary>Creates a <see cref="ValueTask{TResult}"/> that's completed successfully with the specified result.</summary> 
18- /// <typeparam name="TResult">The type of the result returned by the task.</typeparam> 
19- /// <param name="result">The result to store into the completed task.</param> 
20- /// <returns>The successfully completed task.</returns> 
21- let  FromResult < 'TResult >  ( result :  'TResult )  =  ValueTask< 'TResult>  result
22-        
23-     /// <summary>Creates a <see cref="ValueTask{TResult}"/> that's completed exceptionally with the specified exception.</summary> 
24- /// <typeparam name="TResult">The type of the result returned by the task.</typeparam> 
25- /// <param name="exception">The exception with which to complete the task.</param> 
26- /// <returns>The faulted task.</returns> 
27- let  FromException < 'TResult >  ( ``exception`` :  exn )  =  ValueTask< 'TResult>  ( Task.FromException< 'TResult>  `` exception `` ) 
14+         else  Faulted ( t.AsTask() .Exception.InnerExceptions)     
2815
29-     /// <summary>Creates a <see cref="ValueTask{TResult}"/> that's completed due to cancellation with the specified token.</summary> 
30- /// <typeparam name="TResult">The type of the result returned by the task.</typeparam> 
31- /// <param name="cancellationToken">The token with which to complete the task.</param> 
32- /// <returns>The canceled task.</returns> 
33- let  FromCanceled < 'TResult >  ( cancellationToken :  CancellationToken )  =  ValueTask< 'TResult>  ( Task.FromCanceled< 'TResult>  cancellationToken) 
34-     
35-     /// <summary>Creates a <see cref="ValueTask{TResult}"/> from a <see cref="Task{TResult}"/>.</summary> 
36- /// <param name="source">Task workflow.</param> 
37- let  FromTask < 'TResult >  ( source :  Task < 'TResult >)  =  ValueTask< 'TResult>  source
38- 
3916    let inline  internal  continueTask   ( tcs :  TaskCompletionSource < 'Result >)  ( x :  ValueTask < 't >)  ( k :  't  ->  unit )  = 
4017        let  f  =  function 
4118        |  Succeeded r ->  k r
@@ -47,6 +24,8 @@ module ValueTask =
4724            aw.OnCompleted ( fun   ()  -> ) 
4825
4926    /// <summary>Creates a ValueTask workflow from 'source' another, mapping its result with 'f'.</summary> 
27+ /// <param name="f">The mapping function.</param> 
28+ /// <param name="source">ValueTask workflow.</param> 
5029let  map   ( f :  'T  ->  'U )  ( source :  ValueTask < 'T >)  :  ValueTask < 'U >  = 
5130        let  tcs  =  TaskCompletionSource< 'U>  () 
5231        continueTask tcs source ( fun  x  -> 
@@ -133,6 +112,6 @@ module ValueTask =
133112
134113
135114    /// Raises an exception in the ValueTask 
136- let  raise   ( e :  exn )  =  FromException e 
115+ let  raise   ( ``exception`` :  exn )  =  ValueTask < 'TResult >   ( Task. FromException< 'TResult >   `` exception `` ) 
137116
138117#endif 
0 commit comments