Last active
September 25, 2021 17:52
-
-
Save palladin/5872220a4e60cb6e6028 to your computer and use it in GitHub Desktop.
Programming with distributed functional futures
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open MBrace.Core | |
f : Cloud<Int> | |
g,h : int -> Cloud<Int> | |
j,k : int -> int -> Cloud<int> | |
let spawn c = Cloud.StartAsTask c | |
let get t = Cloud.AwaitTask t | |
let (>>=) c f = cloud.Bind(c, f) | |
let main = cloud { | |
let! a = spawn f | |
let! b = spawn (get a >>= g) | |
let! c = spawn (get a >>= h) | |
let! d = spawn (get b >>= (fun x -> get c >>= (fun y -> j x y))) | |
let! e = spawn (get b >>= (fun x -> get d >>= (fun y -> k x y))) | |
return! get e | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment