Run method in calculation expressions

What is the status of the method Run()in the calculation method? I saw this in a few examples ( here , here , here ), and I saw in it the source of the F # compilation, but this is not in the spec or MSDN documentation . I registered a question with MS Connect about this, and it was closed as “by design” without further explanation.

So is it obsolete / undocumented / unsupported? Should I avoid this?

The UPDATE . MS Connect problem status was quickly changed and the MSDN page was updated to include Run ()

+3
source share
2 answers

6.3.10 Expression Calculations

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

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

for the new variable b. If the Run method does not exist in the deduced type b, the expression is checked, then this call is omitted. Similarly, if there is no Delay method for> type b, when this expression is checked, then this call is omitted

+8
source

, Run , , , , . Desco, "" . , , expr { ... }, Run.

, . , , :

expr { let! a = foo()           expr { let! c = expr {  
       let! b = bar(a)                   let! a = foo()
       let! c = woo(b)                   let! b = bar(a) 
       return! zoo(c) }                  return! woo(b) }
                                       return! zoo(c) }

Run ( ). M<T> -> T, , .

( , , Haskell), Run . , , , ...

, break ( ), Run - . Run async .

+4

Source: https://habr.com/ru/post/1769620/


All Articles