Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run method in computation expressions

Tags:

f#

What's the status of the Run() method in a computation method? I've seen it in several examples (here, here, here), and I've seen in it F#'s compiler source, yet it's not in the spec or the MSDN documentation. I filed an issue in MS Connect about this and it was closed as "by design" without further explanations.

So is it deprecated/undocumented/unsupported? Should I avoid it?

UPDATE: MS Connect issue status was promptly changed and the MSDN page updated to include Run()

like image 474
Mauricio Scheffer Avatar asked Sep 01 '26 13:09

Mauricio Scheffer


1 Answers

6.3.10 Computation Expressions

More specifically, computation expressions are of the form builder-expr { cexpr } where cexpr is, syntactically, the grammar of expressions with the additional constructs defined in comp-expr. Computation expressions are used for sequences and other non-standard interpretations of the F# expression syntax. The expression builder-expr { cexpr } translates to

let b = builder-expr in b.Run (b.Delay(fun () -> {| cexpr |}C)) 

for a fresh variable b. If no method Run exists on the inferred type of b when this expression is checked, then that call is omitted. Likewise, if no method Delay exists on > the type of b when this expression is checked, then that call is omitted

like image 85
desco Avatar answered Sep 04 '26 15:09

desco



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!