6

Is there a way to look at the definition of the Async workflow? What goes under the hood that would make a line of code behave differently in there, than outside of it?

2 Answers 2

5

If by "the Async workflow", you mean the AsyncBuilder type which defines the behavior of async blocks, then you can find the definition in the control.fs file in the source distribution, in the source\fsharp\FSharp.Core folder.

The translation of a computation expression into method calls on the builder instance can be found in the F# spec.

Sign up to request clarification or add additional context in comments.

3 Comments

+1 for the spec. Especially, if you understand how LINQ works in C# (syntax rewriting into method calls), you can grok how F# workflows work by translating into method calls on the builder object. If you're curious about the specific details of async, then look at control.fs in the source code.
where does one get the fs source from?
@akaphenom - The source comes with the F# 2.0 release for VS 2008 (microsoft.com/downloads/…). I'm not sure if it's also included in the VS 2010 installation out of the box...
5

Adding to kvb's advice, relevant Don's "Expert F#" chapter is available online:

http://download.microsoft.com/download/b/b/6/bb666ebe-e643-496f-b290-03527d157b47/Expert.F.Sharp_Ch13_8504Syme.pdf

It includes a short but informative "Under the Hood" section.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.