@@ -25,9 +25,7 @@ namespace Microsoft.FSharp.Control
2525/// computation expressions can check the cancellation condition regularly. Synchronous
2626/// computations within an asynchronous computation do not automatically check this condition.</remarks>
2727
28- [<Sealed>]
29- [<NoEquality; NoComparison>]
30- [<CompiledName( " FSharpAsync`1" ) >]
28+ [<Sealed; NoEquality; NoComparison; CompiledName( " FSharpAsync`1" ) >]
3129type Async < 'T >
3230
3331/// <summary>This static class holds members for creating and manipulating asynchronous computations.</summary>
@@ -417,7 +415,6 @@ namespace Microsoft.FSharp.Control
417415static member StartImmediate :
418416computation : Async < unit > * ?cancellationToken : CancellationToken -> unit
419417
420-
421418/// < summary > Runs an asynchronous computation , starting immediately on the current operating system ,
422419/// but also returns the execution as < c > System.Threading.Tasks.Task </ c >
423420/// </ summary >
@@ -435,6 +432,112 @@ namespace Microsoft.FSharp.Control
435432computation : Async < 'T > * ?cancellationToken : CancellationToken -> Task < 'T >
436433
437434
435+ /// < summary > The F # compiler emits references to this type to implement F # async expressions. </ summary >
436+ type AsyncReturn
437+
438+ /// < summary > The F # compiler emits references to this type to implement F # async expressions. </ summary >
439+ [< Struct ; NoEquality ; NoComparison >]
440+ type AsyncActivation < 'T > =
441+
442+ /// <summary>The F# compiler emits calls to this function to implement F# async expressions.</summary>
443+ ///
444+ /// <returns>A value indicating asynchronous execution.</returns>
445+ member IsCancellationRequested : bool
446+
447+ /// <summary>The F# compiler emits calls to this function to implement F# async expressions.</summary>
448+ ///
449+ /// <returns>A value indicating asynchronous execution.</returns>
450+ member OnSuccess : 'T -> AsyncReturn
451+
452+ /// <summary>The F# compiler emits calls to this function to implement F# async expressions.</summary>
453+ member OnExceptionRaised : unit -> unit
454+
455+ /// <summary>The F# compiler emits calls to this function to implement F# async expressions.</summary>
456+ ///
457+ /// <returns>A value indicating asynchronous execution.</returns>
458+ member OnCancellation : unit -> AsyncReturn
459+
460+ /// Used by MailboxProcessor
461+ member internal QueueContinuationWithTrampoline : 'T -> AsyncReturn
462+ /// Used by MailboxProcessor
463+ member internal CallContinuation : 'T -> AsyncReturn
464+
465+ [<NoEquality; NoComparison>]
466+ // Internals used by MailboxProcessor
467+ type internal AsyncResult<'T> =
468+ | Okof 'T
469+ | Errorof ExceptionDispatchInfo
470+ | Canceledof OperationCanceledException
471+
472+ [<Sealed>]
473+ /// <summary>Entry points for generated code</summary>
474+ module AsyncPrimitives =
475+
476+ /// <summary>The F# compiler emits calls to this function to implement F# async expressions.</summary>
477+ ///
478+ /// <param name="body">The body of the async computation.</param>
479+ ///
480+ /// <returns>The async computation.</returns>
481+ val MakeAsync : body :( AsyncActivation < 'T > -> AsyncReturn ) -> Async < 'T >
482+
483+ /// <summary>The F# compiler emits calls to this function to implement constructs for F# async expressions.</summary>
484+ ///
485+ /// <param name="computation">The async computation.</param>
486+ /// <param name="ctxt">The async activation.</param>
487+ ///
488+ /// <returns>A value indicating asynchronous execution.</returns>
489+ val Invoke : computation : Async < 'T > -> ctxt : AsyncActivation < 'T > -> AsyncReturn
490+
491+ /// <summary>The F# compiler emits calls to this function to implement constructs for F# async expressions.</summary>
492+ ///
493+ /// <param name="ctxt">The async activation.</param>
494+ /// <param name="result">The result of the first part of the computation.</param>
495+ /// <param name="part2">A function returning the second part of the computation.</param>
496+ ///
497+ /// <returns>A value indicating asynchronous execution.</returns>
498+ val CallThenInvoke : ctxt : AsyncActivation < 'T > -> result1 : 'U -> part2 :( 'U -> Async < 'T >) -> AsyncReturn
499+
500+ /// <summary>The F# compiler emits calls to this function to implement the <c>let!</c> construct for F# async expressions.</summary>
501+ ///
502+ /// <param name="ctxt">The async activation.</param>
503+ /// <param name="part2">A function returning the second part of the computation.</param>
504+ ///
505+ /// <returns>An async activation suitable for running part1 of the asynchronous execution.</returns>
506+ val Bind : ctxt : AsyncActivation < 'T > -> part1 : Async < 'U > -> part2 :( 'U -> Async < 'T >) -> AsyncReturn
507+
508+ /// <summary>The F# compiler emits calls to this function to implement the <c>try/finally</c> construct for F# async expressions.</summary>
509+ ///
510+ /// <param name="ctxt">The async activation.</param>
511+ /// <param name="computation">The computation to protect.</param>
512+ /// <param name="finallyFunction">The finally code.</param>
513+ ///
514+ /// <returns>A value indicating asynchronous execution.</returns>
515+ val TryFinally : ctxt : AsyncActivation < 'T > -> computation : Async < 'T > -> finallyFunction : ( unit -> unit ) -> AsyncReturn
516+
517+ /// <summary>The F# compiler emits calls to this function to implement the <c>try/with</c> construct for F# async expressions.</summary>
518+ ///
519+ /// <param name="ctxt">The async activation.</param>
520+ /// <param name="computation">The computation to protect.</param>
521+ /// <param name="catchFunction">The exception filter.</param>
522+ ///
523+ /// <returns>A value indicating asynchronous execution.</returns>
524+ val TryWith : ctxt : AsyncActivation < 'T > -> computation : Async < 'T > -> catchFunction : ( Exception -> Async < 'T > option ) -> AsyncReturn
525+
526+ [<Sealed; AutoSerializable( false ) >]
527+ // Internals used by MailboxProcessor
528+ type internal ResultCell < 'T > =
529+ new : unit-> ResultCell< 'T>
530+ member GetWaitHandle : unit -> WaitHandle
531+ member Close : unit -> unit
532+ interface IDisposable
533+ member RegisterResult : 'T * reuseThread : bool -> AsyncReturn
534+ member GrabResult : unit -> 'T
535+ member ResultAvailable : bool
536+ member AwaitResult_NoDirectCancelOrTimeout : Async < 'T >
537+ member TryWaitForResultSynchronously : ?timeout : int -> 'T option
538+
539+ // Internals used by MailboxProcessor
540+ val internal CreateAsyncResultAsync : AsyncResult < 'T > -> Async < 'T >
438541
439542[< CompiledName ( "FSharpAsyncBuilder ")>]
440543[< Sealed >]
@@ -473,7 +576,7 @@ namespace Microsoft.FSharp.Control
473576/// < param name = " computation1" > The first partof the sequenced computation. </ param >
474577/// <param name="computation2">The second part of the sequenced computation.</param>
475578/// <returns>An asynchronous computation that runs both of the computations sequentially.</returns>
476- member Combine : computation1 : Async < unit > * computation2 : Async < 'T > -> Async < 'T >
579+ memberinline Combine : computation1 : Async < unit > * computation2 : Async < 'T > -> Async < 'T >
477580
478581/// < summary > Creates an asynchronous computation that runs < c > computation </ c > repeatedly
479582/// until < c > guard ()</ c > becomes false. </ summary >
@@ -496,15 +599,15 @@ namespace Microsoft.FSharp.Control
496599/// < c > async { ... }</ c > computation expression syntax. </ remarks >
497600/// < param name = " value" > The valueto return from the computation.</ param>
498601/// <returns>An asynchronous computation that returns <c>value</c> when executed.</returns>
499- member Return : value : 'T -> Async < 'T >
602+ memberinline Return : value : 'T -> Async < 'T >
500603
501604/// <summary>Delegates to the input computation.</summary>
502605///
503606/// <remarks>The existence of this method permits the use of <c>return!</c> in the
504607/// <c>async { ... }</c> computation expression syntax.</remarks>
505608/// <param name="computation">The input computation.</param>
506609/// <returns>The input computation.</returns>
507- member ReturnFrom : computation : Async < 'T > -> Async < 'T >
610+ memberinline ReturnFrom : computation : Async < 'T > -> Async < 'T >
508611
509612/// <summary>Creates an asynchronous computation that runs <c>generator</c>.</summary>
510613///
@@ -538,7 +641,7 @@ namespace Microsoft.FSharp.Control
538641/// <param name="binder">The function to bind the result of <c>computation</c>.</param>
539642/// <returns>An asynchronous computation that performs a monadic bind on the result
540643/// of <c>computation</c>.</returns>
541- member Bind : computation : Async < 'T > * binder : ( 'T -> Async < 'U >) -> Async < 'U >
644+ memberinline Bind : computation : Async < 'T > * binder : ( 'T -> Async < 'U >) -> Async < 'U >
542645
543646/// < summary > Creates an asynchronous computation that runs < c > computation </ c >. The action < c > compensation </ c > is executed
544647/// after < c > computation </ c > completes , whether < c > computation </ c > exits normally or by an exception. If < c > compensation </ c > raises an exception itself
@@ -553,7 +656,7 @@ namespace Microsoft.FSharp.Control
553656/// exception (including cancellation).</param>
554657/// <returns>An asynchronous computation that executes computation and compensation afterwards or
555658/// when an exception is raised.</returns>
556- member TryFinally : computation : Async < 'T > * compensation :( unit -> unit ) -> Async < 'T >
659+ memberinline TryFinally : computation : Async < 'T > * compensation :( unit -> unit ) -> Async < 'T >
557660
558661/// < summary > Creates an asynchronous computation that runs < c > computation </ c > and returns its result.
559662/// If an exception happens then < c > catchHandler ( exn )</ c > is called and the resulting computation executed instead. </ summary >
@@ -562,11 +665,14 @@ namespace Microsoft.FSharp.Control
562665///
563666/// The existence of this method permits the use of < c > try / with </ c > in the
564667/// < c > async { ... }</ c > computation expression syntax. </ remarks >
668+ ///
565669/// < param name = " computation" > The input computation.</ param>
566670/// <param name="catchHandler">The function to run when <c>computation</c> throws an exception.</param>
567671/// <returns>An asynchronous computation that executes <c>computation</c> and calls <c>catchHandler</c> if an
568672/// exception is thrown.</returns>
569- member TryWith : computation : Async < 'T > * catchHandler :( exn -> Async < 'T >) -> Async < 'T >
673+ member inline TryWith : computation : Async < 'T > * catchHandler :( exn -> Async < 'T >) -> Async < 'T >
674+
675+ // member inline TryWithFilter : computation : Async < 'T > * catchHandler :( exn -> Async < 'T > option ) -> Async < 'T >
570676
571677/// Generate an object used to build asynchronous computations using F # computation expressions. The value
572678/// 'async' is a pre - defined instance of this type.
@@ -659,41 +765,6 @@ namespace Microsoft.FSharp.Control
659765#endif
660766
661767// Internals used by MailboxProcessor
662- module internalAsyncImpl =
768+ module internalAsyncBuilderImpl =
663769val async : AsyncBuilder
664770
665- [<Sealed>]
666- // Internals used by MailboxProcessor
667- type internal AsyncReturn
668-
669- [<Sealed>]
670- // Internals used by MailboxProcessor
671- type internal AsyncActivation < 'T > =
672- member QueueContinuationWithTrampoline : 'T -> AsyncReturn
673- member CallContinuation : 'T -> AsyncReturn
674-
675- [<NoEquality; NoComparison>]
676- // Internals used by MailboxProcessor
677- type internal AsyncResult<'T> =
678- | Okof 'T
679- | Errorof ExceptionDispatchInfo
680- | Canceledof OperationCanceledException
681-
682- // Internals used by MailboxProcessor
683- module internal AsyncPrimitives =
684-
685- [<Sealed; AutoSerializable( false ) >]
686- type internal ResultCell < 'T > =
687- new : unit-> ResultCell< 'T>
688- member GetWaitHandle : unit -> WaitHandle
689- member Close : unit -> unit
690- interface IDisposable
691- member RegisterResult : 'T * reuseThread : bool -> AsyncReturn
692- member GrabResult : unit -> 'T
693- member ResultAvailable : bool
694- member AwaitResult_NoDirectCancelOrTimeout : Async < 'T >
695- member TryWaitForResultSynchronously : ?timeout : int -> 'T option
696-
697- val CreateAsyncResultAsync : AsyncResult < 'T > -> Async < 'T >
698-
699- val MakeAsync : ( AsyncActivation < 'T > -> AsyncReturn ) -> Async < 'T >