Skip to content

Instantly share code, notes, and snippets.

@dustinlacewell-wk
Created December 7, 2017 04:43
Show Gist options
  • Save dustinlacewell-wk/464d2b8cce2951825b168d78f475cf69 to your computer and use it in GitHub Desktop.
Save dustinlacewell-wk/464d2b8cce2951825b168d78f475cf69 to your computer and use it in GitHub Desktop.
let create (x: 'a) : Job<Cell<'a>> = Job.delay <| fun () ->
let c = {reqCh = Ch (); replyCh = Ch ()}
let rec server x =
Ch.take c.reqCh >>= function
| Get ->
Ch.give c.replyCh x >>=. server x
| Put x -> server x
Job.start (server x) >>-. c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment