@@ -697,15 +697,6 @@ module CancellableTaskResultBuilderBase =
697
697
continuation = ( fun v -> this.Return v)
698
698
)
699
699
700
-
701
- // [<NoEagerConstraintApplication>]
702
- // member inline this.BindReturn
703
- // (
704
- // [<InlineIfLambda>] getAwaiterT: CancellationToken -> 'Awaiter,
705
- // mapper: 'TResult1 -> 'TResult2
706
- // ) : CancellableTaskResultBuilderBaseCode<_, _, _, _> =
707
- // this.Bind((fun ct -> getAwaiterT ct), (fun v -> this.Return(mapper v)))
708
-
709
700
/// <summary>
710
701
/// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code.
711
702
/// </summary>
@@ -828,124 +819,12 @@ module CancellableTaskResultBuilderBase =
828
819
: CancellableTaskResultBuilderBaseCode < _ , _ , _ , 'Builder > =
829
820
this.Bind( awaiterT = awaiterT, continuation = ( fun v -> this.Return v))
830
821
831
- // [<NoEagerConstraintApplication>]
832
- // member inline this.BindReturn
833
- // (
834
- // awaiterT: 'Awaiter,
835
- // [<InlineIfLambda>] mapper: 'a -> 'TResult2
836
- // ) : CancellableTaskResultBuilderBaseCode<'TResult2, 'TResult2, 'Error, 'Builder> =
837
- // this.Bind(awaiterT = awaiterT, continuation = (fun v -> this.Return(mapper v)))
838
-
839
-
840
822
/// <exclude/>
841
823
[<AutoOpen>]
842
824
module LowPriority =
843
825
// Low priority extensions
844
826
type CancellableTaskResultBuilderBase with
845
827
846
- // /// <summary>
847
- // /// The entry point for the dynamic implementation of the corresponding operation. Do not use directly, only used when executing quotations that involve tasks or other reflective execution of F# code.
848
- // /// </summary>
849
- // [<NoEagerConstraintApplication>]
850
- // static member inline BindDynamic
851
- // (
852
- // sm:
853
- // byref<ResumableStateMachine<CancellableTaskResultBuilderBaseStateMachineData<'TOverall, 'Error, 'Builder>>>,
854
- // [<InlineIfLambda>] getAwaiter: CancellationToken -> 'Awaiter,
855
- // continuation:
856
- // ('TResult1
857
- // -> CancellableTaskResultBuilderBaseCode<'TOverall, 'TResult2, 'Error, 'Builder>)
858
- // ) : bool =
859
- // sm.Data.ThrowIfCancellationRequested()
860
-
861
- // let mutable awaiter = getAwaiter sm.Data.CancellationToken
862
-
863
- // let cont =
864
- // (CancellableTaskResultBuilderBaseResumptionFunc<'TOverall, 'Error, _>(fun sm ->
865
- // let result = Awaiter.GetResult awaiter
866
-
867
- // match result with
868
- // | Ok result -> (continuation result).Invoke(&sm)
869
- // | Error e ->
870
- // sm.Data.Result <- Error e
871
- // true
872
- // ))
873
-
874
- // // shortcut to continue immediately
875
- // if Awaiter.IsCompleted awaiter then
876
- // cont.Invoke(&sm)
877
- // else
878
- // sm.ResumptionDynamicInfo.ResumptionData <-
879
- // (awaiter :> ICriticalNotifyCompletion)
880
-
881
- // sm.ResumptionDynamicInfo.ResumptionFunc <- cont
882
- // false
883
-
884
- // /// <summary>Creates A CancellableTask that runs computation, and when
885
- // /// computation generates a result T, runs binder res.</summary>
886
- // ///
887
- // /// <remarks>A cancellation check is performed when the computation is executed.
888
- // ///
889
- // /// The existence of this method permits the use of let! in the
890
- // /// cancellableTask { ... } computation expression syntax.</remarks>
891
- // ///
892
- // /// <param name="getAwaiter">The computation to provide an unbound result.</param>
893
- // /// <param name="continuation">The function to bind the result of computation.</param>
894
- // ///
895
- // /// <returns>A CancellableTask that performs a monadic bind on the result
896
- // /// of computation.</returns>
897
- // [<NoEagerConstraintApplication>]
898
- // member inline _.Bind
899
- // (
900
- // [<InlineIfLambda>] getAwaiterTResult: CancellationToken -> 'Awaiter,
901
- // continuation:
902
- // ('TResult1
903
- // -> CancellableTaskResultBuilderBaseCode<'TOverall, 'TResult2, 'Error, 'Builder>)
904
- // ) : CancellableTaskResultBuilderBaseCode<'TOverall, 'TResult2, 'Error, 'Builder> =
905
-
906
- // CancellableTaskResultBuilderBaseCode<'TOverall, 'TResult2, 'Error, 'Builder>(fun sm ->
907
- // if __useResumableCode then
908
- // //-- RESUMABLE CODE START
909
- // sm.Data.ThrowIfCancellationRequested()
910
- // // Get an awaiter from the Awaiter
911
- // let mutable awaiter = getAwaiterTResult sm.Data.CancellationToken
912
-
913
- // let mutable __stack_fin = true
914
-
915
- // if not (Awaiter.IsCompleted awaiter) then
916
- // // This will yield with __stack_yield_fin = false
917
- // // This will resume with __stack_yield_fin = true
918
- // let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm)
919
- // __stack_fin <- __stack_yield_fin
920
-
921
- // if __stack_fin then
922
- // let result = Awaiter.GetResult awaiter
923
-
924
- // match result with
925
- // | Ok result -> (continuation result).Invoke(&sm)
926
- // | Error e ->
927
- // sm.Data.Result <- Error e
928
- // true
929
- // else
930
- // let mutable awaiter = awaiter :> ICriticalNotifyCompletion
931
-
932
- // MethodBuilder.AwaitUnsafeOnCompleted(
933
- // &sm.Data.MethodBuilder,
934
- // &awaiter,
935
- // &sm
936
- // )
937
-
938
- // false
939
- // else
940
- // CancellableTaskResultBuilderBase.BindDynamic(
941
- // &sm,
942
- // getAwaiterTResult,
943
- // continuation
944
- // )
945
- // //-- RESUMABLE CODE END
946
- // )
947
-
948
-
949
828
/// <summary>Delegates to the input computation.</summary>
950
829
///
951
830
/// <remarks>The existence of this method permits the use of return! in the
@@ -963,16 +842,6 @@ module CancellableTaskResultBuilderBase =
963
842
continuation = ( fun v -> this.Return v)
964
843
)
965
844
966
-
967
- // [<NoEagerConstraintApplication>]
968
- // member inline this.BindReturn
969
- // (
970
- // [<InlineIfLambda>] getAwaiterTResult: CancellationToken -> 'Awaiter,
971
- // mapper: 'TResult1 -> 'TResult2
972
- // ) : CancellableTaskResultBuilderBaseCode<_, _, _, _> =
973
- // this.Bind((fun ct -> getAwaiterTResult ct), (fun v -> this.Return(mapper v)))
974
-
975
-
976
845
/// <summary>Allows the computation expression to turn other types into CancellationToken -> 'Awaiter</summary>
977
846
///
978
847
/// <remarks>This turns a CancellationToken -> 'Awaitable into a CancellationToken -> 'Awaiter.</remarks>
@@ -1145,18 +1014,6 @@ module CancellableTaskResultBuilderBase =
1145
1014
: CancellableTaskResultBuilderBaseCode < _ , _ , _ , 'Builder > =
1146
1015
this.Bind( awaiterTResult = awaiterTResult, continuation = ( fun v -> this.Return v))
1147
1016
1148
- // [<NoEagerConstraintApplication>]
1149
- // member inline this.BindReturn
1150
- // (
1151
- // awaiterTResult: 'Awaiter,
1152
- // [<InlineIfLambda>] mapper: 'a -> 'TResult2
1153
- // ) : CancellableTaskResultBuilderBaseCode<'TResult2, 'TResult2, 'Error, 'Builder> =
1154
- // this.Bind(
1155
- // awaiterTResult = awaiterTResult,
1156
- // continuation = (fun v -> this.Return(mapper v))
1157
- // )
1158
-
1159
-
1160
1017
/// <summary>Allows the computation expression to turn other types into CancellationToken -> 'Awaiter</summary>
1161
1018
///
1162
1019
/// <remarks>This is the identify function.</remarks>
@@ -1298,71 +1155,6 @@ module CancellableTaskResultBuilderBase =
1298
1155
: Async < _ > =
1299
1156
Async.AwaitCancellableTaskResult t
1300
1157
1301
-
1302
- // type AsyncEx with
1303
-
1304
- // /// <summary>Return an asynchronous computation that will wait for the given task to complete and return
1305
- // /// its result.</summary>
1306
- // ///
1307
- // /// <remarks>
1308
- // /// This is based on <see href="https://github.com/fsharp/fslang-suggestions/issues/840">Async.Await overload (esp. AwaitTask without throwing AggregateException)</see>
1309
- // /// </remarks>
1310
- // static member inline AwaitCancellableTask
1311
- // ([<InlineIfLambda>] t: CancellationToken -> Task<'T>)
1312
- // =
1313
- // asyncEx {
1314
- // let! ct = Async.CancellationToken
1315
- // return! t ct
1316
- // }
1317
-
1318
- // /// <summary>Return an asynchronous computation that will wait for the given task to complete and return
1319
- // /// its result.</summary>
1320
- // ///
1321
- // /// <remarks>
1322
- // /// This is based on <see href="https://github.com/fsharp/fslang-suggestions/issues/840">Async.Await overload (esp. AwaitTask without throwing AggregateException)</see>
1323
- // /// </remarks>
1324
- // static member inline AwaitCancellableTask
1325
- // ([<InlineIfLambda>] t: CancellationToken -> Task)
1326
- // =
1327
- // asyncEx {
1328
- // let! ct = Async.CancellationToken
1329
- // return! t ct
1330
- // }
1331
-
1332
- // type Microsoft.FSharp.Control.Async with
1333
-
1334
- // /// <summary>Return an asynchronous computation that will wait for the given task to complete and return
1335
- // /// its result.</summary>
1336
- // static member inline AwaitCancellableTask
1337
- // ([<InlineIfLambda>] t: CancellationToken -> Task<'T>)
1338
- // =
1339
- // async {
1340
- // let! ct = Async.CancellationToken
1341
-
1342
- // return!
1343
- // t ct
1344
- // |> Async.AwaitTask
1345
- // }
1346
-
1347
- // /// <summary>Return an asynchronous computation that will wait for the given task to complete and return
1348
- // /// its result.</summary>
1349
- // static member inline AwaitCancellableTask
1350
- // ([<InlineIfLambda>] t: CancellationToken -> Task)
1351
- // =
1352
- // async {
1353
- // let! ct = Async.CancellationToken
1354
-
1355
- // return!
1356
- // t ct
1357
- // |> Async.AwaitTask
1358
- // }
1359
-
1360
- // /// <summary>Runs an asynchronous computation, starting on the current operating system thread.</summary>
1361
- // static member inline AsCancellableTask
1362
- // (computation: Async<'T>)
1363
- // : CancellationToken -> Task<_> =
1364
- // fun ct -> Async.StartImmediateAsTask(computation, cancellationToken = ct)
1365
-
1366
1158
// High priority extensions
1367
1159
type CancellableTaskResultBuilderBase with
1368
1160
0 commit comments