0 people like it.

foo

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
type 'a M =
    | Ready of 'a
    | Sleeping of unsigned * (unit -> 'a M)
    | Tick of (unit -> 'a M)
    | Interruptible of (unit -> 'a M)
    | Done of 'a M

type TaskBuilder() =
    let rec bind (k : 'a -> 'b M) (v : 'a M) : 'b M =
        match v with
        | Ready d -> k d
        | Sleeping(t, f) -> Sleeping(t, fun () -> f () |> bind k)
        | Tick f -> Tick(fun () -> f () |> bind k)
        | Interruptible f -> Interruptible(fun () -> f () |> bind k)
        | Done r -> Done(r |> bind k)
type 'a M =
  | Ready of 'a
  | Sleeping of obj * (unit -> 'a M)
  | Tick of (unit -> 'a M)
  | Interruptible of (unit -> 'a M)
  | Done of 'a M

Full name: Script.M<_>
union case M.Ready: 'a -> 'a M
union case M.Sleeping: obj * (unit -> 'a M) -> 'a M
type unit = Unit

Full name: Microsoft.FSharp.Core.unit
union case M.Tick: (unit -> 'a M) -> 'a M
union case M.Interruptible: (unit -> 'a M) -> 'a M
union case M.Done: 'a M -> 'a M
Multiple items
type TaskBuilder =
  new : unit -> TaskBuilder

Full name: Script.TaskBuilder

--------------------
new : unit -> TaskBuilder
val bind : (('a -> 'b M) -> 'a M -> 'b M)
val k : ('a -> 'b M)
val v : 'a M
val d : 'a
val t : obj
val f : (unit -> 'a M)
val r : 'a M
Raw view Test code New version

More information

Link:http://fssnip.net/9j
Posted:14 years ago
Author:
Tags: