The F# Asynchronous Programming Model, PADL 2011

[ The draft was updated on 22/10/10 and 8/11/10 ]

The F# asynchronous programming model dates to 2007, and was published in product documentation and Expert F#. However, until now we haven't had a submitted, succinct conference-style description of the core idea of the model: language integrated asynchronous programming.  As a result Tomas Petricek, Dmitry Lomov and I have submitted a paper to PADL 2011 (Practical Aspects of Declarative Languages).


We describe the asynchronous programming model in F#, and its applications to reactive, parallel and concurrent programming. The key feature combines a core language with a non-blocking modality to author lightweight asynchronous tasks, where the modality has control flow constructs that are syntactically a superset of the core language and are given an asynchronous semantic interpretation. This allows smooth transitions between synchronous and asynchronous code and eliminates callback-style treatments of inversion of control, without disturbing the foundation of CPU-intensive programming that allows F# to interoperate smoothly and compile efficiently to .NET and native code. 

Acknowledgements.  We thank Brian McNamara, Nikolaj Bjorner, Niklas Gustafsson, Simon Peyton Jones, Gregory Neverov, Laurent le Brun, Luke Hoban, Jomo Fisher, Tobias Gedell, Mads Torgersen, Anders Hejlsberg, Stephen Toub, Erik Meijer and many others for their help and advice on the design of the F# async model, and LAMP EPFL for a 2006 sabbatical where this work started. We thank all those who have contributed related work that forms the background to this work and trust that we've done justice to that.

A paper like this is important for two reasons:

  1. Learning. The paper can help people learn F# asynchronous programming "from the ground up"
  2. Science. The idea of language integrated asynchronous programming has potential application in multiple languages. This paper captures the idea in the context of F#, but ideas presented in ML-family languages are usually "crisp" enough that they can be understood and potentially adopted by other languages. In programming languages, the greatest long-term flattery is imitation 🙂

The attached paper is the final version of the . We'd welcome your comments and input on how we might make the paper better, either by comments below, or email to one of the authors, since we may make an extended version. Thanks!


Don, Tomas and Dmitry.

P.S. Tomas and I have another paper at PADL 2011, Tomas will be blogging about that. See you there!


Comments (2)

  1. Blake Coverett says:

    Thank you – a great paper.  I found only very small questions/quibbles:

    Abstract: It should probably read "to MSIL and native code" not .NET.

    Page 3: I'm unclear what "preferred" really means in "control flow constructs are preferred to have".  They just "have", don't they?

    Page 12: I believe Async.AwaitObservable is spelled Async.AwaitEvent.

    Page 13: With the light syntax code blocks that span pages, particularly at indentation changes, are hard to follow.

    I'd love to see a similar level of paper regarding computation expressions and the design choices there.

  2. Kamezou says:

    Thank you for the post about the formal paper. It's great to read it for me.

    BTW, isn't it PADL _2011_?

Skip to main content