Contents tagged with fsharpx

Synchronously Await an Async Workflow Using Observable.guard

Oct 15 2011No Comments by stanley

The other day, I couldn't figure out how to Synchronously wait for an Async workflow to complete. I was pretty sure I needed to use Observable.guard, I just couldn't wrap my head around how to use it. This morning I was on a mission to figure it out. [fsharp] open System open FSharp.Control let event = new Event<_>() let createObservableByExecutingAsync asyncToExecute = event.Publish |> Observable.guard(fun _ -> let asyncOperation = async { …

Async Workflow, f#, fsharpx Read more

Rate Limiting a Function with Async Workflows

Oct 14 2011No Comments by stanley

So I am trying to deal with an API that says I cannot make more than 4 requests per second. This is a really good use for F# since it has such great support for Asynchronous Workflows. I took a little inspiration from this post by Luca Bolognese. [fsharp] module RateLimiting open System open FSharp.Control type RateLimitedMessage<'a,'b> = {payload: 'a ; response: ('b -> Async<unit>) option} type RateLimitedAgent<'a,'b>( operation: 'a -& …

Async Workflow, f#, fsharpx Read more