1 people like it.
Like the snippet!
Staged Parallel Ziria Streams
Staged Parallel Ziria Streams.
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:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
|
// Staged Parallel Ziria Streams
#r "packages/FSharp.Compiler.Service.1.3.1.0/lib/net45/FSharp.Compiler.Service.dll"
#r "packages/QuotationCompiler.0.0.7-alpha/lib/net45/QuotationCompiler.dll"
#r "bin/FSharpSnippets.dll"
open System
open QuotationCompiler
open Microsoft.FSharp.Quotations
open System.Threading
open System.Threading.Tasks
open System.Collections.Concurrent
// helper functions
let counter = ref 0
let rec generateVars (types : Type list) : Var list =
match types with
| [] -> []
| t :: ts ->
incr counter
let var = new Var(sprintf "__paramTemp_%d__" !counter, t)
var :: generateVars ts
// <@ fun x -> (% <@ x @> ) @> ~ lambda (fun x -> x)
let lambda (f : Expr<'T> -> Expr<'R>) : Expr<'T -> 'R> =
let [var] = generateVars [typeof<'T>]
Expr.Cast<_>(Expr.Lambda(var, f (Expr.Cast<_>(Expr.Var var))))
// <@ fun x y -> (% <@ x @> ... <@ y @> ) @> ~ lambda (fun x y -> x ... y )
let lambda2 (f : Expr<'T> -> Expr<'S> -> Expr<'R>) : Expr<'T -> 'S -> 'R> =
let [var; var'] = generateVars [typeof<'T>; typeof<'S>]
Expr.Cast<_>(Expr.Lambda(var, Expr.Lambda(var', f (Expr.Cast<_>(Expr.Var var)) (Expr.Cast<_>(Expr.Var var')))))
// Helper Equality type
module Eq =
type Eq<'A, 'B> = private Refl of (Expr<'A> -> Expr<'B>) * (Expr<'B> -> Expr<'A>)
let refl<'A> () : Eq<'A, 'A> = Refl (id, id)
let cast : Eq<'A, 'B> -> Expr<'A> -> Expr<'B> = fun (Refl (f, _)) -> f
open Eq
// Basic types
type Zir<'I, 'O, 'V> =
abstract member Invoke : Handler<'I, 'O, 'V> -> Expr<'V>
and Handler<'I, 'O, 'V> =
abstract member Handle : Eq<unit, 'V> * Expr<'O> -> Expr<'V>
abstract member Handle : Expr<'V> -> Expr<'V>
abstract member Handle : Eq<'I, 'V> -> Expr<'V>
abstract member Handle : Eq<bool, 'V> -> Expr<'V>
abstract member Handle<'W> : Zir<'I, 'O, 'W> * (Expr<'W> -> Zir<'I, 'O, 'V>) -> Expr<'V>
abstract member Handle<'M> : Zir<'I, 'M, 'V> * Zir<'M, 'O, 'V> -> Expr<'V>
abstract member Handle : Eq<unit, 'V> * Expr<bool> * Zir<'I, 'O, unit> -> Expr<'V>
abstract member Handle : Expr<bool> * Zir<'I, 'O, 'V> * Zir<'I, 'O, 'V> -> Expr<'V>
and Yield<'I, 'O>(o : Expr<'O>) =
interface Zir<'I, 'O, unit> with
member self.Invoke handler = handler.Handle(refl(), o)
and Done<'I, 'O, 'V>(v : Expr<'V>) =
interface Zir<'I, 'O, 'V> with
member self.Invoke handler = handler.Handle(v)
and NeedInput<'I, 'O>() =
interface Zir<'I, 'O, 'I> with
member self.Invoke handler = handler.Handle(refl())
and HasNext<'I, 'O>() =
interface Zir<'I, 'O, bool> with
member self.Invoke handler = handler.Handle(refl())
and Bind<'I, 'O, 'V, 'W>(z : Zir<'I, 'O, 'V>, f : Expr<'V> -> Zir<'I, 'O, 'W>) =
interface Zir<'I, 'O, 'W> with
member self.Invoke handler = handler.Handle(z, f)
and Pipe<'I, 'M, 'O, 'V>(z1 : Zir<'I, 'M, 'V>, z2 : Zir<'M, 'O, 'V>) =
interface Zir<'I, 'O, 'V> with
member self.Invoke handler = handler.Handle(z1, z2)
and While<'I, 'O>(pred : Expr<bool>, body : Zir<'I, 'O, unit>) =
interface Zir<'I, 'O, unit> with
member self.Invoke handler = handler.Handle(refl(), pred, body)
and If<'I, 'O, 'V>(pred : Expr<bool>, then' : Zir<'I, 'O, 'V>, else' : Zir<'I, 'O, 'V>) =
interface Zir<'I, 'O, 'V> with
member self.Invoke handler = handler.Handle(pred, then', else')
// helper functions
let yield' : Expr<'O> -> Zir<'I, 'O, unit> =
fun o -> new Yield<'I, 'O>(o) :> _
let next<'I, 'O> : Zir<'I, 'O, 'I> =
new NeedInput<'I, 'O>() :> _
let hasNext<'I, 'O> : Zir<'I, 'O, bool> =
new HasNext<'I, 'O>() :> _
let ret : Expr<'V> -> Zir<'I, 'O, 'V> =
fun v -> new Done<'I, 'O, 'V>(v) :> _
let rec bind : Zir<'I, 'O, 'V> -> (Expr<'V> -> Zir<'I, 'O, 'W>) -> Zir<'I, 'O, 'W> =
fun z f -> new Bind<'I, 'O, 'V, 'W>(z, f) :> _
let (>>>) : Zir<'I, 'M, 'V> -> Zir<'M, 'O, 'V> -> Zir<'I, 'O, 'V> =
fun z1 z2 -> new Pipe<'I, 'M, 'O, 'V>(z1, z2) :> _
let do' : Expr<'V> -> Zir<'I, 'O, 'V> =
ret
let if' : Expr<bool> -> Zir<'I, 'O, 'V> -> Zir<'I, 'O, 'V> -> Zir<'I, 'O, 'V> =
fun pred then' else' ->
new If<'I, 'O, 'V>(pred, then', else') :> _
let ifthen : Expr<bool> -> Zir<'I, 'O, unit> -> Zir<'I, 'O, unit> =
fun pred then' -> if' pred then' (ret <@ () @>)
// Builder type
type ZirBuilder() =
member self.Return (v : Expr<'V>) : Zir<'I, 'O, 'V> = ret v
member self.Bind(z : Zir<'I, 'O, 'V>, f : Expr<'V> -> Zir<'I, 'O, 'W>) : Zir<'I, 'O, 'W> =
bind z f
member self.While(pred : unit -> Expr<bool>, body : Zir<'I, 'O, unit>) : Zir<'I, 'O, unit> =
new While<'I, 'O>(pred (), body) :> _
member self.Delay(f : unit -> Zir<'I, 'O, 'V>) : Zir<'I, 'O, 'V> =
f ()
member self.Combine(first : Zir<'I, 'O, unit>, second : Zir<'I, 'O, 'V>) : Zir<'I, 'O, 'V> =
self.Bind(first, fun _ -> second)
let zir = new ZirBuilder()
let rec compile<'I, 'O, 'V> : Expr<CancellationToken> -> Expr<bool> -> Expr<'I> -> (Expr<'O> -> Expr<unit>) -> Zir<'I, 'O, 'V> -> Expr<'V> =
fun token hasNext input output z ->
z.Invoke {
new Handler<'I, 'O, 'V> with
member self.Handle(eq : Eq<unit, 'V>, o : Expr<'O>) : Expr<'V> =
cast eq <@ let o' = %o in (% lambda (fun o' -> output o')) o' @>
member self.Handle(v : Expr<'V>) : Expr<'V> =
v
member self.Handle(eq : Eq<'I, 'V>) : Expr<'V> =
cast eq input
member self.Handle(eq : Eq<bool, 'V>) : Expr<'V> =
cast eq hasNext
member self.Handle<'W>(z : Zir<'I, 'O, 'W>, f : Expr<'W> -> Zir<'I, 'O, 'V>) : Expr<'V> =
<@ let w = (% compile token hasNext input output z)
(%token).ThrowIfCancellationRequested()
(% lambda (fun w -> compile token hasNext input output (f w))) w
@>
member self.Handle(eq : Eq<unit, 'V>, pred : Expr<bool>, body : Zir<'I, 'O, unit>) : Expr<'V> =
cast eq
<@ while %pred do
(% compile<'I, 'O, unit> token hasNext input output body)
@>
member self.Handle(pred : Expr<bool>, then' : Zir<'I, 'O, 'V>, else' : Zir<'I, 'O, 'V>) : Expr<'V> =
<@ if %pred then (% compile token hasNext input output then') else (% compile token hasNext input output else') @>
member self.Handle<'M>(z1 : Zir<'I, 'M, 'V>, z2 : Zir<'M, 'O, 'V>) : Expr<'V> =
<@
let queue = new ConcurrentQueue<'M>()
let tcs = CancellationTokenSource.CreateLinkedTokenSource(%token)
let token = tcs.Token
let task1 = Static.run (fun () -> (% lambda2 (fun (queue : Expr<ConcurrentQueue<'M>>) token -> compile<'I, 'M, 'V> token hasNext input (fun v -> <@ (%queue).Enqueue %v @>) z1)) queue token)
let task2 = Static.run (fun () -> (% lambda2 (fun (queue : Expr<ConcurrentQueue<'M>>) token -> compile<'M, 'O, 'V> token <@ (%queue).Count <> 0 @> <@ Static.get (%queue) @> output z2)) queue token)
let tasks = [|task1; task2|]
let index = Task.WaitAny(task1, task2)
tcs.Cancel()
tasks.[index].Result
@>
}
// example
let example1 : Zir<int, string, unit> =
zir {
while <@ true @> do
let! flag = hasNext
let! _ =
ifthen flag <| zir {
let! x = next
let! _ = yield' <@ string (%x + 1) @>
return <@ () @>
}
return <@ () @>
return <@ () @>
}
let example2 : Zir<string, (int * int), unit> =
zir {
let! counter = do' <@ ref 0 @>
while <@ !(%counter) < 100 @> do
let! flag = hasNext
let! _ =
ifthen flag <| zir {
let! x = next
let! _ = yield' <@ (!(%counter), System.Int32.Parse %x) @>
let! _ = do' <@ incr %counter @>
return <@ () @>
}
return <@ () @>
return <@ () @>
}
let example : Zir<int, (int * int), unit> = example1 >>> example2
let example' : Expr<ConcurrentQueue<int>> -> Expr<CancellationToken> -> Expr<Task<unit>> =
fun queue token ->
<@
Static.run (fun () -> (% compile token <@ (%queue).Count <> 0 @> <@ Static.get (%queue) @> (fun o -> <@ printfn "%A" %o @>) example))
@>
let f = QuotationCompiler.ToFunc (lambda2 (fun queue token -> example' queue token))
let queue = new ConcurrentQueue<int>()
for i = 1 to 100 do
queue.Enqueue(i)
()
let tcs = new CancellationTokenSource()
let task = f () queue tcs.Token
|
namespace System
namespace QuotationCompiler
namespace Microsoft
namespace Microsoft.FSharp
namespace Microsoft.FSharp.Quotations
namespace System.Threading
namespace System.Threading.Tasks
namespace System.Collections
namespace System.Collections.Concurrent
val counter : int ref
Full name: Script.counter
Multiple items
val ref : value:'T -> 'T ref
Full name: Microsoft.FSharp.Core.Operators.ref
--------------------
type 'T ref = Ref<'T>
Full name: Microsoft.FSharp.Core.ref<_>
val generateVars : types:Type list -> Var list
Full name: Script.generateVars
val types : Type list
type Type =
inherit MemberInfo
member Assembly : Assembly
member AssemblyQualifiedName : string
member Attributes : TypeAttributes
member BaseType : Type
member ContainsGenericParameters : bool
member DeclaringMethod : MethodBase
member DeclaringType : Type
member Equals : o:obj -> bool + 1 overload
member FindInterfaces : filter:TypeFilter * filterCriteria:obj -> Type[]
member FindMembers : memberType:MemberTypes * bindingAttr:BindingFlags * filter:MemberFilter * filterCriteria:obj -> MemberInfo[]
...
Full name: System.Type
type 'T list = List<'T>
Full name: Microsoft.FSharp.Collections.list<_>
Multiple items
type Var =
interface IComparable
new : name:string * typ:Type * ?isMutable:bool -> Var
member IsMutable : bool
member Name : string
member Type : Type
static member Global : name:string * typ:Type -> Var
Full name: Microsoft.FSharp.Quotations.Var
--------------------
new : name:string * typ:Type * ?isMutable:bool -> Var
val t : Type
val ts : Type list
val incr : cell:int ref -> unit
Full name: Microsoft.FSharp.Core.Operators.incr
val var : Var
val sprintf : format:Printf.StringFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf
val lambda : f:(Expr<'T> -> Expr<'R>) -> Expr<('T -> 'R)>
Full name: Script.lambda
val f : (Expr<'T> -> Expr<'R>)
Multiple items
type Expr =
override Equals : obj:obj -> bool
member GetFreeVars : unit -> seq<Var>
member Substitute : substitution:(Var -> Expr option) -> Expr
member ToString : full:bool -> string
member CustomAttributes : Expr list
member Type : Type
static member AddressOf : target:Expr -> Expr
static member AddressSet : target:Expr * value:Expr -> Expr
static member Application : functionExpr:Expr * argument:Expr -> Expr
static member Applications : functionExpr:Expr * arguments:Expr list list -> Expr
...
Full name: Microsoft.FSharp.Quotations.Expr
--------------------
type Expr<'T> =
inherit Expr
member Raw : Expr
Full name: Microsoft.FSharp.Quotations.Expr<_>
val typeof<'T> : Type
Full name: Microsoft.FSharp.Core.Operators.typeof
static member Expr.Cast : source:Expr -> Expr<'T>
static member Expr.Lambda : parameter:Var * body:Expr -> Expr
static member Expr.Var : variable:Var -> Expr
val lambda2 : f:(Expr<'T> -> Expr<'S> -> Expr<'R>) -> Expr<('T -> 'S -> 'R)>
Full name: Script.lambda2
val f : (Expr<'T> -> Expr<'S> -> Expr<'R>)
val var' : Var
type Eq<'A,'B> = private | Refl of (Expr<'A> -> Expr<'B>) * (Expr<'B> -> Expr<'A>)
Full name: Script.Eq.Eq<_,_>
union case Eq.Refl: (Expr<'A> -> Expr<'B>) * (Expr<'B> -> Expr<'A>) -> Eq<'A,'B>
val refl : unit -> Eq<'A,'A>
Full name: Script.Eq.refl
val id : x:'T -> 'T
Full name: Microsoft.FSharp.Core.Operators.id
val cast : Eq<'A,'B> -> (Expr<'A> -> Expr<'B>)
Full name: Script.Eq.cast
val f : (Expr<'A> -> Expr<'B>)
module Eq
from Script
type Zir<'I,'O,'V> =
interface
abstract member Invoke : Handler<'I,'O,'V> -> Expr<'V>
end
Full name: Script.Zir<_,_,_>
abstract member Zir.Invoke : Handler<'I,'O,'V> -> Expr<'V>
Full name: Script.Zir`3.Invoke
Multiple items
type Handler<'T> =
delegate of obj * 'T -> unit
Full name: Microsoft.FSharp.Control.Handler<_>
--------------------
type Handler<'I,'O,'V> =
interface
abstract member Handle : Eq<unit,'V> * Expr<'O> -> Expr<'V>
abstract member Handle : Expr<'V> -> Expr<'V>
abstract member Handle : Eq<'I,'V> -> Expr<'V>
abstract member Handle : Eq<bool,'V> -> Expr<'V>
abstract member Handle : Zir<'I,'O,'W> * (Expr<'W> -> Zir<'I,'O,'V>) -> Expr<'V>
abstract member Handle : Zir<'I,'M,'V> * Zir<'M,'O,'V> -> Expr<'V>
abstract member Handle : Eq<unit,'V> * Expr<bool> * Zir<'I,'O,unit> -> Expr<'V>
abstract member Handle : Expr<bool> * Zir<'I,'O,'V> * Zir<'I,'O,'V> -> Expr<'V>
end
Full name: Script.Handler<_,_,_>
abstract member Handler.Handle : Eq<unit,'V> * Expr<'O> -> Expr<'V>
Full name: Script.Handler`3.Handle
Multiple items
module Eq
from Script
--------------------
type Eq<'A,'B> = private | Refl of (Expr<'A> -> Expr<'B>) * (Expr<'B> -> Expr<'A>)
Full name: Script.Eq.Eq<_,_>
type unit = Unit
Full name: Microsoft.FSharp.Core.unit
abstract member Handler.Handle : Expr<'V> -> Expr<'V>
Full name: Script.Handler`3.Handle
abstract member Handler.Handle : Eq<'I,'V> -> Expr<'V>
Full name: Script.Handler`3.Handle
abstract member Handler.Handle : Eq<bool,'V> -> Expr<'V>
Full name: Script.Handler`3.Handle
type bool = Boolean
Full name: Microsoft.FSharp.Core.bool
abstract member Handler.Handle : Zir<'I,'O,'W> * (Expr<'W> -> Zir<'I,'O,'V>) -> Expr<'V>
Full name: Script.Handler`3.Handle
abstract member Handler.Handle : Zir<'I,'M,'V> * Zir<'M,'O,'V> -> Expr<'V>
Full name: Script.Handler`3.Handle
abstract member Handler.Handle : Eq<unit,'V> * Expr<bool> * Zir<'I,'O,unit> -> Expr<'V>
Full name: Script.Handler`3.Handle
abstract member Handler.Handle : Expr<bool> * Zir<'I,'O,'V> * Zir<'I,'O,'V> -> Expr<'V>
Full name: Script.Handler`3.Handle
Multiple items
type Yield<'I,'O> =
interface Zir<'I,'O,unit>
new : o:Expr<'O> -> Yield<'I,'O>
Full name: Script.Yield<_,_>
--------------------
new : o:Expr<'O> -> Yield<'I,'O>
val o : Expr<'O>
val self : Yield<'I,'O>
override Yield.Invoke : handler:Handler<'I,'O,unit> -> Expr<unit>
Full name: Script.Yield`2.Invoke
val handler : Handler<'I,'O,unit>
abstract member Handler.Handle : Expr<'V> -> Expr<'V>
abstract member Handler.Handle : Eq<'I,'V> -> Expr<'V>
abstract member Handler.Handle : Eq<bool,'V> -> Expr<'V>
abstract member Handler.Handle : Eq<unit,'V> * Expr<'O> -> Expr<'V>
abstract member Handler.Handle : Zir<'I,'O,'W> * (Expr<'W> -> Zir<'I,'O,'V>) -> Expr<'V>
abstract member Handler.Handle : Zir<'I,'M,'V> * Zir<'M,'O,'V> -> Expr<'V>
abstract member Handler.Handle : Eq<unit,'V> * Expr<bool> * Zir<'I,'O,unit> -> Expr<'V>
abstract member Handler.Handle : Expr<bool> * Zir<'I,'O,'V> * Zir<'I,'O,'V> -> Expr<'V>
Multiple items
type Done<'I,'O,'V> =
interface Zir<'I,'O,'V>
new : v:Expr<'V> -> Done<'I,'O,'V>
Full name: Script.Done<_,_,_>
--------------------
new : v:Expr<'V> -> Done<'I,'O,'V>
val v : Expr<'V>
val self : Done<'I,'O,'V>
override Done.Invoke : handler:Handler<'I,'O,'V> -> Expr<'V>
Full name: Script.Done`3.Invoke
val handler : Handler<'I,'O,'V>
Multiple items
type NeedInput<'I,'O> =
interface Zir<'I,'O,'I>
new : unit -> NeedInput<'I,'O>
Full name: Script.NeedInput<_,_>
--------------------
new : unit -> NeedInput<'I,'O>
val self : NeedInput<'I,'O>
override NeedInput.Invoke : handler:Handler<'I,'O,'I> -> Expr<'I>
Full name: Script.NeedInput`2.Invoke
val handler : Handler<'I,'O,'I>
Multiple items
type HasNext<'I,'O> =
interface Zir<'I,'O,bool>
new : unit -> HasNext<'I,'O>
Full name: Script.HasNext<_,_>
--------------------
new : unit -> HasNext<'I,'O>
val self : HasNext<'I,'O>
override HasNext.Invoke : handler:Handler<'I,'O,bool> -> Expr<bool>
Full name: Script.HasNext`2.Invoke
val handler : Handler<'I,'O,bool>
Multiple items
type Bind<'I,'O,'V,'W> =
interface Zir<'I,'O,'W>
new : z:Zir<'I,'O,'V> * f:(Expr<'V> -> Zir<'I,'O,'W>) -> Bind<'I,'O,'V,'W>
Full name: Script.Bind<_,_,_,_>
--------------------
new : z:Zir<'I,'O,'V> * f:(Expr<'V> -> Zir<'I,'O,'W>) -> Bind<'I,'O,'V,'W>
val z : Zir<'I,'O,'V>
val f : (Expr<'V> -> Zir<'I,'O,'W>)
val self : Bind<'I,'O,'V,'W>
override Bind.Invoke : handler:Handler<'I,'O,'W> -> Expr<'W>
Full name: Script.Bind`4.Invoke
val handler : Handler<'I,'O,'W>
Multiple items
type Pipe<'I,'M,'O,'V> =
interface Zir<'I,'O,'V>
new : z1:Zir<'I,'M,'V> * z2:Zir<'M,'O,'V> -> Pipe<'I,'M,'O,'V>
Full name: Script.Pipe<_,_,_,_>
--------------------
new : z1:Zir<'I,'M,'V> * z2:Zir<'M,'O,'V> -> Pipe<'I,'M,'O,'V>
val z1 : Zir<'I,'M,'V>
val z2 : Zir<'M,'O,'V>
val self : Pipe<'I,'M,'O,'V>
override Pipe.Invoke : handler:Handler<'I,'O,'V> -> Expr<'V>
Full name: Script.Pipe`4.Invoke
Multiple items
type While<'I,'O> =
interface Zir<'I,'O,unit>
new : pred:Expr<bool> * body:Zir<'I,'O,unit> -> While<'I,'O>
Full name: Script.While<_,_>
--------------------
new : pred:Expr<bool> * body:Zir<'I,'O,unit> -> While<'I,'O>
val pred : Expr<bool>
val body : Zir<'I,'O,unit>
val self : While<'I,'O>
override While.Invoke : handler:Handler<'I,'O,unit> -> Expr<unit>
Full name: Script.While`2.Invoke
Multiple items
type If<'I,'O,'V> =
interface Zir<'I,'O,'V>
new : pred:Expr<bool> * then':Zir<'I,'O,'V> * else':Zir<'I,'O,'V> -> If<'I,'O,'V>
Full name: Script.If<_,_,_>
--------------------
new : pred:Expr<bool> * then':Zir<'I,'O,'V> * else':Zir<'I,'O,'V> -> If<'I,'O,'V>
val then' : Zir<'I,'O,'V>
val else' : Zir<'I,'O,'V>
val self : If<'I,'O,'V>
override If.Invoke : handler:Handler<'I,'O,'V> -> Expr<'V>
Full name: Script.If`3.Invoke
val yield' : o:Expr<'O> -> Zir<'I,'O,unit>
Full name: Script.yield'
val next<'I,'O> : Zir<'I,'O,'I>
Full name: Script.next
val hasNext<'I,'O> : Zir<'I,'O,bool>
Full name: Script.hasNext
val ret : v:Expr<'V> -> Zir<'I,'O,'V>
Full name: Script.ret
val bind : z:Zir<'I,'O,'V> -> f:(Expr<'V> -> Zir<'I,'O,'W>) -> Zir<'I,'O,'W>
Full name: Script.bind
val do' : (Expr<'V> -> Zir<'I,'O,'V>)
Full name: Script.do'
val if' : pred:Expr<bool> -> then':Zir<'I,'O,'V> -> else':Zir<'I,'O,'V> -> Zir<'I,'O,'V>
Full name: Script.if'
val ifthen : pred:Expr<bool> -> then':Zir<'I,'O,unit> -> Zir<'I,'O,unit>
Full name: Script.ifthen
val then' : Zir<'I,'O,unit>
Multiple items
type ZirBuilder =
new : unit -> ZirBuilder
member Bind : z:Zir<'I,'O,'V> * f:(Expr<'V> -> Zir<'I,'O,'W>) -> Zir<'I,'O,'W>
member Combine : first:Zir<'I,'O,unit> * second:Zir<'I,'O,'V> -> Zir<'I,'O,'V>
member Delay : f:(unit -> Zir<'I,'O,'V>) -> Zir<'I,'O,'V>
member Return : v:Expr<'V> -> Zir<'I,'O,'V>
member While : pred:(unit -> Expr<bool>) * body:Zir<'I,'O,unit> -> Zir<'I,'O,unit>
Full name: Script.ZirBuilder
--------------------
new : unit -> ZirBuilder
val self : ZirBuilder
member ZirBuilder.Return : v:Expr<'V> -> Zir<'I,'O,'V>
Full name: Script.ZirBuilder.Return
Multiple items
member ZirBuilder.Bind : z:Zir<'I,'O,'V> * f:(Expr<'V> -> Zir<'I,'O,'W>) -> Zir<'I,'O,'W>
Full name: Script.ZirBuilder.Bind
--------------------
type Bind<'I,'O,'V,'W> =
interface Zir<'I,'O,'W>
new : z:Zir<'I,'O,'V> * f:(Expr<'V> -> Zir<'I,'O,'W>) -> Bind<'I,'O,'V,'W>
Full name: Script.Bind<_,_,_,_>
--------------------
new : z:Zir<'I,'O,'V> * f:(Expr<'V> -> Zir<'I,'O,'W>) -> Bind<'I,'O,'V,'W>
Multiple items
member ZirBuilder.While : pred:(unit -> Expr<bool>) * body:Zir<'I,'O,unit> -> Zir<'I,'O,unit>
Full name: Script.ZirBuilder.While
--------------------
type While<'I,'O> =
interface Zir<'I,'O,unit>
new : pred:Expr<bool> * body:Zir<'I,'O,unit> -> While<'I,'O>
Full name: Script.While<_,_>
--------------------
new : pred:Expr<bool> * body:Zir<'I,'O,unit> -> While<'I,'O>
val pred : (unit -> Expr<bool>)
member ZirBuilder.Delay : f:(unit -> Zir<'I,'O,'V>) -> Zir<'I,'O,'V>
Full name: Script.ZirBuilder.Delay
val f : (unit -> Zir<'I,'O,'V>)
member ZirBuilder.Combine : first:Zir<'I,'O,unit> * second:Zir<'I,'O,'V> -> Zir<'I,'O,'V>
Full name: Script.ZirBuilder.Combine
val first : Zir<'I,'O,unit>
val second : Zir<'I,'O,'V>
member ZirBuilder.Bind : z:Zir<'I,'O,'V> * f:(Expr<'V> -> Zir<'I,'O,'W>) -> Zir<'I,'O,'W>
val zir : ZirBuilder
Full name: Script.zir
val compile : token:Expr<CancellationToken> -> hasNext:Expr<bool> -> input:Expr<'I> -> output:(Expr<'O> -> Expr<unit>) -> z:Zir<'I,'O,'V> -> Expr<'V>
Full name: Script.compile
Multiple items
type CancellationToken =
struct
new : canceled:bool -> CancellationToken
member CanBeCanceled : bool
member Equals : other:CancellationToken -> bool + 1 overload
member GetHashCode : unit -> int
member IsCancellationRequested : bool
member Register : callback:Action -> CancellationTokenRegistration + 3 overloads
member ThrowIfCancellationRequested : unit -> unit
member WaitHandle : WaitHandle
static member None : CancellationToken
end
Full name: System.Threading.CancellationToken
--------------------
CancellationToken()
CancellationToken(canceled: bool) : unit
val token : Expr<CancellationToken>
val hasNext : Expr<bool>
val input : Expr<'I>
val output : (Expr<'O> -> Expr<unit>)
abstract member Zir.Invoke : Handler<'I,'O,'V> -> Expr<'V>
val self : Handler<'I,'O,'V>
val eq : Eq<unit,'V>
val o' : 'O
val o' : Expr<'O>
val eq : Eq<'I,'V>
val eq : Eq<bool,'V>
val z : Zir<'I,'O,'W>
val f : (Expr<'W> -> Zir<'I,'O,'V>)
val w : 'W
val w : Expr<'W>
val queue : ConcurrentQueue<'M>
Multiple items
type ConcurrentQueue<'T> =
new : unit -> ConcurrentQueue<'T> + 1 overload
member CopyTo : array:'T[] * index:int -> unit
member Count : int
member Enqueue : item:'T -> unit
member GetEnumerator : unit -> IEnumerator<'T>
member IsEmpty : bool
member ToArray : unit -> 'T[]
member TryDequeue : result:'T -> bool
member TryPeek : result:'T -> bool
Full name: System.Collections.Concurrent.ConcurrentQueue<_>
--------------------
ConcurrentQueue() : unit
ConcurrentQueue(collection: Collections.Generic.IEnumerable<'T>) : unit
val tcs : CancellationTokenSource
Multiple items
type CancellationTokenSource =
new : unit -> CancellationTokenSource
member Cancel : unit -> unit + 1 overload
member Dispose : unit -> unit
member IsCancellationRequested : bool
member Token : CancellationToken
static member CreateLinkedTokenSource : [<ParamArray>] tokens:CancellationToken[] -> CancellationTokenSource + 1 overload
Full name: System.Threading.CancellationTokenSource
--------------------
CancellationTokenSource() : unit
CancellationTokenSource.CreateLinkedTokenSource([<ParamArray>] tokens: CancellationToken []) : CancellationTokenSource
CancellationTokenSource.CreateLinkedTokenSource(token1: CancellationToken, token2: CancellationToken) : CancellationTokenSource
val token : CancellationToken
property CancellationTokenSource.Token: CancellationToken
val task1 : Task
val task2 : Task
val tasks : Task []
val index : int
Multiple items
type Task =
new : action:Action -> Task + 7 overloads
member AsyncState : obj
member ContinueWith : continuationAction:Action<Task> -> Task + 9 overloads
member CreationOptions : TaskCreationOptions
member Dispose : unit -> unit
member Exception : AggregateException
member Id : int
member IsCanceled : bool
member IsCompleted : bool
member IsFaulted : bool
...
Full name: System.Threading.Tasks.Task
--------------------
type Task<'TResult> =
inherit Task
new : function:Func<'TResult> -> Task<'TResult> + 7 overloads
member ContinueWith : continuationAction:Action<Task<'TResult>> -> Task + 9 overloads
member Result : 'TResult with get, set
static member Factory : TaskFactory<'TResult>
Full name: System.Threading.Tasks.Task<_>
--------------------
Task(action: Action) : unit
Task(action: Action, cancellationToken: CancellationToken) : unit
Task(action: Action, creationOptions: TaskCreationOptions) : unit
Task(action: Action<obj>, state: obj) : unit
Task(action: Action, cancellationToken: CancellationToken, creationOptions: TaskCreationOptions) : unit
Task(action: Action<obj>, state: obj, cancellationToken: CancellationToken) : unit
Task(action: Action<obj>, state: obj, creationOptions: TaskCreationOptions) : unit
Task(action: Action<obj>, state: obj, cancellationToken: CancellationToken, creationOptions: TaskCreationOptions) : unit
--------------------
Task(function: Func<'TResult>) : unit
Task(function: Func<'TResult>, cancellationToken: CancellationToken) : unit
Task(function: Func<'TResult>, creationOptions: TaskCreationOptions) : unit
Task(function: Func<obj,'TResult>, state: obj) : unit
Task(function: Func<'TResult>, cancellationToken: CancellationToken, creationOptions: TaskCreationOptions) : unit
Task(function: Func<obj,'TResult>, state: obj, cancellationToken: CancellationToken) : unit
Task(function: Func<obj,'TResult>, state: obj, creationOptions: TaskCreationOptions) : unit
Task(function: Func<obj,'TResult>, state: obj, cancellationToken: CancellationToken, creationOptions: TaskCreationOptions) : unit
Task.WaitAny([<ParamArray>] tasks: Task []) : int
Task.WaitAny(tasks: Task [], millisecondsTimeout: int) : int
Task.WaitAny(tasks: Task [], cancellationToken: CancellationToken) : int
Task.WaitAny(tasks: Task [], timeout: TimeSpan) : int
Task.WaitAny(tasks: Task [], millisecondsTimeout: int, cancellationToken: CancellationToken) : int
CancellationTokenSource.Cancel() : unit
CancellationTokenSource.Cancel(throwOnFirstException: bool) : unit
val example1 : Zir<int,string,unit>
Full name: Script.example1
Multiple items
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = String
Full name: Microsoft.FSharp.Core.string
val flag : Expr<bool>
val x : Expr<int>
val example2 : Zir<string,(int * int),unit>
Full name: Script.example2
val counter : Expr<int ref>
val x : Expr<string>
type Int32 =
struct
member CompareTo : value:obj -> int + 1 overload
member Equals : obj:obj -> bool + 1 overload
member GetHashCode : unit -> int
member GetTypeCode : unit -> TypeCode
member ToString : unit -> string + 3 overloads
static val MaxValue : int
static val MinValue : int
static member Parse : s:string -> int + 3 overloads
static member TryParse : s:string * result:int -> bool + 1 overload
end
Full name: System.Int32
Int32.Parse(s: string) : int
Int32.Parse(s: string, provider: IFormatProvider) : int
Int32.Parse(s: string, style: Globalization.NumberStyles) : int
Int32.Parse(s: string, style: Globalization.NumberStyles, provider: IFormatProvider) : int
val example : Zir<int,(int * int),unit>
Full name: Script.example
val example' : queue:Expr<ConcurrentQueue<int>> -> token:Expr<CancellationToken> -> Expr<Task<unit>>
Full name: Script.example'
val queue : Expr<ConcurrentQueue<int>>
val printfn : format:Printf.TextWriterFormat<'T> -> 'T
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val f : (unit -> ConcurrentQueue<int> -> CancellationToken -> Task<unit>)
Full name: Script.f
Multiple items
namespace QuotationCompiler
--------------------
type QuotationCompiler =
private new : unit -> QuotationCompiler
static member Eval : expr:Expr<'T> * ?useCache:bool -> 'T
static member ToAssembly : expr:Expr * ?targetDirectory:string * ?assemblyName:string * ?compiledModuleName:string * ?compiledFunctionName:string -> string
static member ToDynamicAssembly : expr:Expr * ?assemblyName:string -> MethodInfo
static member ToFunc : expr:Expr<'T> * ?useCache:bool -> (unit -> 'T)
Full name: QuotationCompiler.QuotationCompiler
static member QuotationCompiler.ToFunc : expr:Expr<'T> * ?useCache:bool -> (unit -> 'T)
val queue : ConcurrentQueue<int>
Full name: Script.queue
val i : int
ConcurrentQueue.Enqueue(item: int) : unit
val tcs : CancellationTokenSource
Full name: Script.tcs
val task : Task<unit>
Full name: Script.task
More information