Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- open System
- open Hopac
- open Hopac.Infixes
- let rec serverUntil evt j =
- evt <|> (memo j ^=> fun _ -> serverUntil evt j)
- let printDelay msg =
- Job.delay <| fun _ ->
- printfn "before timeout"
- timeOutMillis 200
- >>- fun _ -> printfn "after, msg: %s" msg
- [<EntryPoint>]
- let main argv =
- let a = (timeOutMillis 1000 >>- fun _ -> printfn "sdfasdfasdfasdf")
- let j =
- Job.delay <| fun _ ->
- printfn "\ttimer start"
- timeOutMillis 500
- >>=. Promise.start (timeOutMillis 500 >>- fun _ -> printfn "ivar created"; 10)
- >>- fun p -> printfn "\ttimer half"; p
- >>= Promise.read
- >>- fun x -> printfn "\ttimer end"; x
- |> memo
- serverUntil j (printDelay "hello") |> Job.Ignore |> start
- let r = Promise.read j |> run
- printfn "val: %A" r
- let a = Console.ReadLine ()
- 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement