2 people like it.

Generalized computation expressions

Uses tagless-final approach for defining abstracted, general purpose computation expression builders.

HKT Encoding

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
type HKT = interface end

//[Struct] no F# 4.1 here!
type App<'F, 't when 'F :> HKT> = private App of payload : obj

type App<'F, 't1, 't2 when 'F :> HKT> = App<'F, TCons<'t1, 't2>>
and  App<'F, 't1, 't2, 't3 when 'F :> HKT> = App<'F, TCons<'t1, 't2, 't3>>
and  App<'F, 't1, 't2, 't3, 't4 when 'F :> HKT> = App<'F, TCons<'t1, 't2, 't3, 't4>>

and  TCons<'T1, 'T2> = class end
and  TCons<'T1, 'T2, 'T3> = TCons<TCons<'T1, 'T2>, 'T3>
and  TCons<'T1, 'T2, 'T3, 'T4> = TCons<TCons<'T1, 'T2, 'T3>, 'T4>

[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module HKT =
    let inline pack (value : 'Fa) : App<'F, 'a>
        when 'F : (static member Assign : App<'F, 'a> * 'Fa -> unit) =
        App value
        
    let inline unpack (App value : App<'F, 'a>) : 'Fa
        when 'F : (static member Assign : App<'F, 'a> * 'Fa -> unit) =
        value :?> _
        
    let inline (|Unpack|) app = unpack app

Expression Builder

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
28: 
29: 
30: 
31: 
32: 
33: 
34: 
35: 
36: 
37: 
38: 
39: 
40: 
41: 
42: 
43: 
44: 
type Expression<'M when 'M :> Expression<'M> and 'M : struct> =
    inherit HKT
    abstract Zero : unit -> App<'M, unit>
    abstract Return : 'a -> App<'M, 'a>
    abstract ReturnFrom : App<'M, 'a> -> App<'M, 'a>
    abstract Combine : App<'M, unit> -> App<'M, 'a> -> App<'M, 'a>
    abstract Bind : App<'M, 'a> -> ('a -> App<'M, 'b>) -> App<'M, 'b>
    abstract Delay : (unit -> App<'M, 'a>) -> App<'M, 'a>
    abstract TryWith : App<'M, 'a> -> (exn -> App<'M, 'a>) -> App<'M, 'a>
    abstract TryFinally : App<'M, 'a> -> (unit -> unit) -> App<'M, 'a>
    abstract For : seq<'T> -> ('T -> App<'M, unit>) -> App<'M, unit>
    abstract While : (unit -> bool) -> App<'M, unit> -> App<'M, unit>
    abstract Using : 'a -> ('a -> App<'M, 'b>) -> App<'M, 'b> when 'a :> System.IDisposable


type ExpressionBuilder() =
    // rely on structness of the expression builder to obtain an instance of the interface
    static let mkBuilder() : 'M when 'M :> Expression<'M> = Unchecked.defaultof<'M>
    member __.Zero() = mkBuilder().Zero()
    member __.Return x = mkBuilder().Return x
    member __.ReturnFrom x = mkBuilder().ReturnFrom x
    member __.Combine (f,g) = mkBuilder().Combine f g
    member __.Delay f = mkBuilder().Delay f
    member __.Bind(f, g) = mkBuilder().Bind f g
    member __.TryWith (f, h) = mkBuilder().TryWith f h
    member __.TryFinally(f, comp) = mkBuilder().TryFinally f comp
    member __.For (xs, body) = mkBuilder().For xs body
    member __.While(c, body) = mkBuilder().While c body
    member __.Using(c, f) = mkBuilder().Using c f

let expr = new ExpressionBuilder()

let test () = expr {
    for i in 1 .. 10 do printfn "%d" i

    try
        try
            let! x = expr { return 41 }
            return x + 1
        with e -> 
            return 0

    finally printfn "finally"
}

Thunk Semantics

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
[<Struct>]
type Thunk =

    static member Assign (_ : App<Thunk, 'a>, _ : unit -> 'a) = ()
    static member Run (f : App<Thunk, 'a>) = HKT.unpack f ()

    interface Expression<Thunk> with
        member __.Zero() = HKT.pack id
        member __.Return t = HKT.pack (fun () -> t)
        member __.ReturnFrom x = x
        member __.Combine (HKT.Unpack f) (HKT.Unpack g) = HKT.pack (fun () -> f () ; g ())
        member __.Bind (HKT.Unpack f) g = HKT.pack (fun () -> let x = f () in HKT.unpack (g x) ())
        member __.Delay f = HKT.pack (fun () -> let (HKT.Unpack f) = f () in f ())
        member __.TryWith (HKT.Unpack f) h = HKT.pack (fun () -> try f () with e -> HKT.unpack (h e) ())
        member __.TryFinally (HKT.Unpack f) comp = HKT.pack (fun () -> try f () finally comp ())
        member __.For xs body = HKT.pack (fun () -> for x in xs do HKT.unpack (body x) ())
        member __.While c (HKT.Unpack body) = HKT.pack (fun () -> while c () do body ())
        member __.Using c f = HKT.pack (fun () -> use c = c in HKT.unpack (f c) ())


let f = test () |> Thunk.Run

Async Semantics

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
[<Struct>]
type Async =
    static member Assign (_ : App<Async, 'a>, _ : Async<'a>) = ()
    static member Run (f : App<Async, 'a>) = HKT.unpack f |> FSharp.Control.Async.RunSynchronously

    interface Expression<Async> with
        member __.Zero() = async.Zero() |> HKT.pack
        member __.Return t = async.Return t |> HKT.pack
        member __.ReturnFrom x = x
        member __.Combine (HKT.Unpack f) (HKT.Unpack g) = async.Combine(f,g) |> HKT.pack
        member __.Bind (HKT.Unpack f) g = async.Bind(f, g >> HKT.unpack) |> HKT.pack
        member __.Delay f = async.Delay(fun () -> f () |> HKT.unpack) |> HKT.pack
        member __.TryWith (HKT.Unpack f) h = async.TryWith(f, fun e -> HKT.unpack (h e)) |> HKT.pack
        member __.TryFinally (HKT.Unpack f) comp = async.TryFinally(f, comp) |> HKT.pack
        member __.For xs body = async.For(xs, fun x -> HKT.unpack (body x)) |> HKT.pack
        member __.While c (HKT.Unpack body) = async.While(c, body) |> HKT.pack
        member __.Using c f = async.Using(c, fun c -> f c |> HKT.unpack) |> HKT.pack

let gAsync = test () |> Async.Run
Multiple items
union case App.App: payload: obj -> App<'F,'t>

--------------------
type App<'F,'t (requires 'F :> HKT)> = private | App of payload: obj

Full name: Script.App<_,_>
type HKT

Full name: Script.HKT
type obj = System.Object

Full name: Microsoft.FSharp.Core.obj
type TCons<'T1,'T2>

Full name: Script.TCons<_,_>
Multiple items
type CompilationRepresentationAttribute =
  inherit Attribute
  new : flags:CompilationRepresentationFlags -> CompilationRepresentationAttribute
  member Flags : CompilationRepresentationFlags

Full name: Microsoft.FSharp.Core.CompilationRepresentationAttribute

--------------------
new : flags:CompilationRepresentationFlags -> CompilationRepresentationAttribute
type CompilationRepresentationFlags =
  | None = 0
  | Static = 1
  | Instance = 2
  | ModuleSuffix = 4
  | UseNullAsTrueValue = 8
  | Event = 16

Full name: Microsoft.FSharp.Core.CompilationRepresentationFlags
CompilationRepresentationFlags.ModuleSuffix: CompilationRepresentationFlags = 4
val pack : value:'Fa -> App<'F,'a> (requires 'F :> HKT and member Assign)

Full name: Script.HKTModule.pack
val value : 'Fa
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
val unpack : App<'F,'a> -> 'Fa (requires 'F :> HKT and member Assign)

Full name: Script.HKTModule.unpack
val value : obj
val app : App<'a,'b> (requires 'a :> HKT and member Assign)
type Expression<'M (requires 'M :> Expression<'M> and value type)> =
  interface
    inherit HKT
    abstract member Bind : App<'M,'a> -> ('a -> App<'M,'b>) -> App<'M,'b>
    abstract member Combine : App<'M,unit> -> App<'M,'a> -> App<'M,'a>
    abstract member Delay : (unit -> App<'M,'a>) -> App<'M,'a>
    abstract member For : seq<'T> -> ('T -> App<'M,unit>) -> App<'M,unit>
    abstract member Return : 'a -> App<'M,'a>
    abstract member ReturnFrom : App<'M,'a> -> App<'M,'a>
    abstract member TryFinally : App<'M,'a> -> (unit -> unit) -> App<'M,'a>
    abstract member TryWith : App<'M,'a> -> (exn -> App<'M,'a>) -> App<'M,'a>
    abstract member Using : 'a -> ('a -> App<'M,'b>) -> App<'M,'b> (requires 'a :> IDisposable)
    ...
  end

Full name: Script.Expression<_>
Multiple items
module HKT

from Script

--------------------
type HKT

Full name: Script.HKT
abstract member Expression.Zero : unit -> App<'M,unit>

Full name: Script.Expression`1.Zero
abstract member Expression.Return : 'a -> App<'M,'a>

Full name: Script.Expression`1.Return
abstract member Expression.ReturnFrom : App<'M,'a> -> App<'M,'a>

Full name: Script.Expression`1.ReturnFrom
abstract member Expression.Combine : App<'M,unit> -> App<'M,'a> -> App<'M,'a>

Full name: Script.Expression`1.Combine
abstract member Expression.Bind : App<'M,'a> -> ('a -> App<'M,'b>) -> App<'M,'b>

Full name: Script.Expression`1.Bind
abstract member Expression.Delay : (unit -> App<'M,'a>) -> App<'M,'a>

Full name: Script.Expression`1.Delay
abstract member Expression.TryWith : App<'M,'a> -> (exn -> App<'M,'a>) -> App<'M,'a>

Full name: Script.Expression`1.TryWith
type exn = System.Exception

Full name: Microsoft.FSharp.Core.exn
abstract member Expression.TryFinally : App<'M,'a> -> (unit -> unit) -> App<'M,'a>

Full name: Script.Expression`1.TryFinally
abstract member Expression.For : seq<'T> -> ('T -> App<'M,unit>) -> App<'M,unit>

Full name: Script.Expression`1.For
Multiple items
val seq : sequence:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Core.Operators.seq

--------------------
type seq<'T> = System.Collections.Generic.IEnumerable<'T>

Full name: Microsoft.FSharp.Collections.seq<_>
abstract member Expression.While : (unit -> bool) -> App<'M,unit> -> App<'M,unit>

Full name: Script.Expression`1.While
type bool = System.Boolean

Full name: Microsoft.FSharp.Core.bool
abstract member Expression.Using : 'a -> ('a -> App<'M,'b>) -> App<'M,'b> (requires 'a :> System.IDisposable)

Full name: Script.Expression`1.Using
namespace System
type IDisposable =
  member Dispose : unit -> unit

Full name: System.IDisposable
Multiple items
type ExpressionBuilder =
  new : unit -> ExpressionBuilder
  member Bind : f:App<'k,'l> * g:('l -> App<'k,'m>) -> App<'k,'m> (requires 'k :> Expression<'k> and value type)
  member Combine : f:App<'p,unit> * g:App<'p,'q> -> App<'p,'q> (requires 'p :> Expression<'p> and value type)
  member Delay : f:(unit -> App<'n,'o>) -> App<'n,'o> (requires 'n :> Expression<'n> and value type)
  member For : xs:seq<'e> * body:('e -> App<'f,unit>) -> App<'f,unit> (requires 'f :> Expression<'f> and value type)
  member Return : x:'t -> App<'a1,'t> (requires 'a1 :> Expression<'a1> and value type)
  member ReturnFrom : x:App<'r,'s> -> App<'r,'s> (requires 'r :> Expression<'r> and value type)
  member TryFinally : f:App<'g,'h> * comp:(unit -> unit) -> App<'g,'h> (requires 'g :> Expression<'g> and value type)
  member TryWith : f:App<'i,'j> * h:(exn -> App<'i,'j>) -> App<'i,'j> (requires 'i :> Expression<'i> and value type)
  member Using : c:'a * f:('a -> App<'b,'c>) -> App<'b,'c> (requires 'a :> IDisposable and 'b :> Expression<'b> and value type)
  ...

Full name: Script.ExpressionBuilder

--------------------
new : unit -> ExpressionBuilder
val mkBuilder : (unit -> 'M) (requires 'M :> Expression<'M> and value type)
module Unchecked

from Microsoft.FSharp.Core.Operators
val defaultof<'T> : 'T

Full name: Microsoft.FSharp.Core.Operators.Unchecked.defaultof
member ExpressionBuilder.Zero : unit -> App<'a2,unit> (requires 'a2 :> Expression<'a2> and value type)

Full name: Script.ExpressionBuilder.Zero
val __ : ExpressionBuilder
member ExpressionBuilder.Return : x:'t -> App<'a1,'t> (requires 'a1 :> Expression<'a1> and value type)

Full name: Script.ExpressionBuilder.Return
val x : 't
member ExpressionBuilder.ReturnFrom : x:App<'r,'s> -> App<'r,'s> (requires 'r :> Expression<'r> and value type)

Full name: Script.ExpressionBuilder.ReturnFrom
val x : App<'r,'s> (requires 'r :> Expression<'r> and value type)
member ExpressionBuilder.Combine : f:App<'p,unit> * g:App<'p,'q> -> App<'p,'q> (requires 'p :> Expression<'p> and value type)

Full name: Script.ExpressionBuilder.Combine
val f : App<'p,unit> (requires 'p :> Expression<'p> and value type)
val g : App<'p,'q> (requires 'p :> Expression<'p> and value type)
member ExpressionBuilder.Delay : f:(unit -> App<'n,'o>) -> App<'n,'o> (requires 'n :> Expression<'n> and value type)

Full name: Script.ExpressionBuilder.Delay
val f : (unit -> App<'n,'o>) (requires 'n :> Expression<'n> and value type)
member ExpressionBuilder.Bind : f:App<'k,'l> * g:('l -> App<'k,'m>) -> App<'k,'m> (requires 'k :> Expression<'k> and value type)

Full name: Script.ExpressionBuilder.Bind
val f : App<'k,'l> (requires 'k :> Expression<'k> and value type)
val g : ('l -> App<'k,'m>) (requires 'k :> Expression<'k> and value type)
member ExpressionBuilder.TryWith : f:App<'i,'j> * h:(exn -> App<'i,'j>) -> App<'i,'j> (requires 'i :> Expression<'i> and value type)

Full name: Script.ExpressionBuilder.TryWith
val f : App<'i,'j> (requires 'i :> Expression<'i> and value type)
val h : (exn -> App<'i,'j>) (requires 'i :> Expression<'i> and value type)
member ExpressionBuilder.TryFinally : f:App<'g,'h> * comp:(unit -> unit) -> App<'g,'h> (requires 'g :> Expression<'g> and value type)

Full name: Script.ExpressionBuilder.TryFinally
val f : App<'g,'h> (requires 'g :> Expression<'g> and value type)
val comp : (unit -> unit)
member ExpressionBuilder.For : xs:seq<'e> * body:('e -> App<'f,unit>) -> App<'f,unit> (requires 'f :> Expression<'f> and value type)

Full name: Script.ExpressionBuilder.For
val xs : seq<'e>
val body : ('e -> App<'f,unit>) (requires 'f :> Expression<'f> and value type)
member ExpressionBuilder.While : c:(unit -> bool) * body:App<'d,unit> -> App<'d,unit> (requires 'd :> Expression<'d> and value type)

Full name: Script.ExpressionBuilder.While
val c : (unit -> bool)
val body : App<'d,unit> (requires 'd :> Expression<'d> and value type)
member ExpressionBuilder.Using : c:'a * f:('a -> App<'b,'c>) -> App<'b,'c> (requires 'a :> System.IDisposable and 'b :> Expression<'b> and value type)

Full name: Script.ExpressionBuilder.Using
val c : #System.IDisposable
val f : (#System.IDisposable -> App<'b,'c>) (requires 'b :> Expression<'b> and value type)
val expr : ExpressionBuilder

Full name: Script.expr
val test : unit -> App<'a,int> (requires 'a :> Expression<'a> and value type)

Full name: Script.test
val i : int
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val x : int
val e : exn
Multiple items
type StructAttribute =
  inherit Attribute
  new : unit -> StructAttribute

Full name: Microsoft.FSharp.Core.StructAttribute

--------------------
new : unit -> StructAttribute
type Thunk =
  struct
    interface Expression<Thunk>
    static member Assign : App<Thunk,'a> * (unit -> 'a) -> unit
    static member Run : f:App<Thunk,'a> -> 'a
  end

Full name: Script.Thunk
static member Thunk.Assign : App<Thunk,'a> * (unit -> 'a) -> unit

Full name: Script.Thunk.Assign
static member Thunk.Run : f:App<Thunk,'a> -> 'a

Full name: Script.Thunk.Run
val f : App<Thunk,'a>
override Thunk.Zero : unit -> App<Thunk,unit>

Full name: Script.Thunk.Zero
val id : x:'T -> 'T

Full name: Microsoft.FSharp.Core.Operators.id
val __ : byref<Thunk>
override Thunk.Return : t:'k -> App<Thunk,'k>

Full name: Script.Thunk.Return
val t : 'k
override Thunk.ReturnFrom : x:App<Thunk,'j> -> App<Thunk,'j>

Full name: Script.Thunk.ReturnFrom
val x : App<Thunk,'j>
override Thunk.Combine : App<Thunk,unit> -> App<Thunk,'i> -> App<Thunk,'i>

Full name: Script.Thunk.Combine
active recognizer Unpack: App<'a,'b> -> 'c

Full name: Script.HKTModule.( |Unpack| )
val f : (unit -> unit)
val g : (unit -> 'i)
override Thunk.Bind : App<Thunk,'g> -> g:('g -> App<Thunk,'h>) -> App<Thunk,'h>

Full name: Script.Thunk.Bind
val f : (unit -> 'g)
val g : ('g -> App<Thunk,'h>)
val x : 'g
override Thunk.Delay : f:(unit -> App<Thunk,'f>) -> App<Thunk,'f>

Full name: Script.Thunk.Delay
val f : (unit -> App<Thunk,'f>)
val f : (unit -> 'f)
override Thunk.TryWith : App<Thunk,'e> -> h:(exn -> App<Thunk,'e>) -> App<Thunk,'e>

Full name: Script.Thunk.TryWith
val f : (unit -> 'e)
val h : (exn -> App<Thunk,'e>)
override Thunk.TryFinally : App<Thunk,'d> -> comp:(unit -> unit) -> App<Thunk,'d>

Full name: Script.Thunk.TryFinally
val f : (unit -> 'd)
override Thunk.For : xs:seq<'c> -> body:('c -> App<Thunk,unit>) -> App<Thunk,unit>

Full name: Script.Thunk.For
val xs : seq<'c>
val body : ('c -> App<Thunk,unit>)
val x : 'c
override Thunk.While : c:(unit -> bool) -> App<Thunk,unit> -> App<Thunk,unit>

Full name: Script.Thunk.While
val body : (unit -> unit)
override Thunk.Using : c:'a -> f:('a -> App<Thunk,'b>) -> App<Thunk,'b> (requires 'a :> System.IDisposable)

Full name: Script.Thunk.Using
val f : (#System.IDisposable -> App<Thunk,'b>)
val f : int

Full name: Script.f
static member Thunk.Run : f:App<Thunk,'a> -> 'a
Multiple items
type Async =
  struct
    interface Expression<Async>
    static member Assign : App<Async,'a> * Async<'a> -> unit
    static member Run : f:App<Async,'a> -> 'a
  end

Full name: Script.Async

--------------------
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>
static member Async.Assign : App<Async,'a> * Async<'a> -> unit

Full name: Script.Async.Assign
static member Async.Run : f:App<Async,'a> -> 'a

Full name: Script.Async.Run
val f : App<Async,'a>
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Control
Multiple items
type Async<'T>

Full name: Microsoft.FSharp.Control.Async<_>

--------------------
type Async
static member AsBeginEnd : computation:('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit)
static member AwaitEvent : event:IEvent<'Del,'T> * ?cancelAction:(unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate)
static member AwaitIAsyncResult : iar:IAsyncResult * ?millisecondsTimeout:int -> Async<bool>
static member AwaitTask : task:Task -> Async<unit>
static member AwaitTask : task:Task<'T> -> Async<'T>
static member AwaitWaitHandle : waitHandle:WaitHandle * ?millisecondsTimeout:int -> Async<bool>
static member CancelDefaultToken : unit -> unit
static member Catch : computation:Async<'T> -> Async<Choice<'T,exn>>
static member FromBeginEnd : beginAction:(AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg:'Arg1 * beginAction:('Arg1 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * beginAction:('Arg1 * 'Arg2 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromBeginEnd : arg1:'Arg1 * arg2:'Arg2 * arg3:'Arg3 * beginAction:('Arg1 * 'Arg2 * 'Arg3 * AsyncCallback * obj -> IAsyncResult) * endAction:(IAsyncResult -> 'T) * ?cancelAction:(unit -> unit) -> Async<'T>
static member FromContinuations : callback:(('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T>
static member Ignore : computation:Async<'T> -> Async<unit>
static member OnCancel : interruption:(unit -> unit) -> Async<IDisposable>
static member Parallel : computations:seq<Async<'T>> -> Async<'T []>
static member RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:CancellationToken -> 'T
static member Sleep : millisecondsDueTime:int -> Async<unit>
static member Start : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions * ?cancellationToken:CancellationToken -> Task<'T>
static member StartChild : computation:Async<'T> * ?millisecondsTimeout:int -> Async<Async<'T>>
static member StartChildAsTask : computation:Async<'T> * ?taskCreationOptions:TaskCreationOptions -> Async<Task<'T>>
static member StartImmediate : computation:Async<unit> * ?cancellationToken:CancellationToken -> unit
static member StartWithContinuations : computation:Async<'T> * continuation:('T -> unit) * exceptionContinuation:(exn -> unit) * cancellationContinuation:(OperationCanceledException -> unit) * ?cancellationToken:CancellationToken -> unit
static member SwitchToContext : syncContext:SynchronizationContext -> Async<unit>
static member SwitchToNewThread : unit -> Async<unit>
static member SwitchToThreadPool : unit -> Async<unit>
static member TryCancelled : computation:Async<'T> * compensation:(OperationCanceledException -> unit) -> Async<'T>
static member CancellationToken : Async<CancellationToken>
static member DefaultCancellationToken : CancellationToken

Full name: Microsoft.FSharp.Control.Async
static member Async.RunSynchronously : computation:Async<'T> * ?timeout:int * ?cancellationToken:System.Threading.CancellationToken -> 'T
override Async.Zero : unit -> App<Async,unit>

Full name: Script.Async.Zero
val async : AsyncBuilder

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.async
member AsyncBuilder.Zero : unit -> Async<unit>
val __ : byref<Async>
override Async.Return : t:'k -> App<Async,'k>

Full name: Script.Async.Return
member AsyncBuilder.Return : value:'T -> Async<'T>
override Async.ReturnFrom : x:App<Async,'j> -> App<Async,'j>

Full name: Script.Async.ReturnFrom
val x : App<Async,'j>
override Async.Combine : App<Async,unit> -> App<Async,'i> -> App<Async,'i>

Full name: Script.Async.Combine
val f : Async<unit>
val g : Async<'i>
member AsyncBuilder.Combine : computation1:Async<unit> * computation2:Async<'T> -> Async<'T>
override Async.Bind : App<Async,'g> -> g:('g -> App<Async,'h>) -> App<Async,'h>

Full name: Script.Async.Bind
val f : Async<'g>
val g : ('g -> App<Async,'h>)
member AsyncBuilder.Bind : computation:Async<'T> * binder:('T -> Async<'U>) -> Async<'U>
override Async.Delay : f:(unit -> App<Async,'f>) -> App<Async,'f>

Full name: Script.Async.Delay
val f : (unit -> App<Async,'f>)
member AsyncBuilder.Delay : generator:(unit -> Async<'T>) -> Async<'T>
override Async.TryWith : App<Async,'e> -> h:(exn -> App<Async,'e>) -> App<Async,'e>

Full name: Script.Async.TryWith
val f : Async<'e>
val h : (exn -> App<Async,'e>)
member AsyncBuilder.TryWith : computation:Async<'T> * catchHandler:(exn -> Async<'T>) -> Async<'T>
override Async.TryFinally : App<Async,'d> -> comp:(unit -> unit) -> App<Async,'d>

Full name: Script.Async.TryFinally
val f : Async<'d>
member AsyncBuilder.TryFinally : computation:Async<'T> * compensation:(unit -> unit) -> Async<'T>
override Async.For : xs:seq<'c> -> body:('c -> App<Async,unit>) -> App<Async,unit>

Full name: Script.Async.For
val body : ('c -> App<Async,unit>)
member AsyncBuilder.For : sequence:seq<'T> * body:('T -> Async<unit>) -> Async<unit>
override Async.While : c:(unit -> bool) -> App<Async,unit> -> App<Async,unit>

Full name: Script.Async.While
val body : Async<unit>
member AsyncBuilder.While : guard:(unit -> bool) * computation:Async<unit> -> Async<unit>
override Async.Using : c:'a -> f:('a -> App<Async,'b>) -> App<Async,'b> (requires 'a :> System.IDisposable)

Full name: Script.Async.Using
val f : (#System.IDisposable -> App<Async,'b>)
member AsyncBuilder.Using : resource:'T * binder:('T -> Async<'U>) -> Async<'U> (requires 'T :> System.IDisposable)
val gAsync : int

Full name: Script.gAsync
static member Async.Run : f:App<Async,'a> -> 'a
Raw view Test code New version

More information

Link:http://fssnip.net/7Wt
Posted:5 years ago
Author:Eirik Tsarpalis
Tags: computation expressions , tagless-final