{"id":372999,"date":"2024-05-21T05:25:48","date_gmt":"2024-05-21T05:25:48","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=372999"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T05:25:48","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=372999","title":{"rendered":"<span>\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f: \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 &#8216;Bind&#8217;<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/articles\/804957\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u0447\u0442\u043e \u043e\u0431 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 <code>let<\/code> \u043c\u043e\u0436\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0439 \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043a\u0443\u043b\u0438\u0441\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <code>Bind<\/code> \u043a\u043b\u0430\u0441\u0441\u0430-\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434. <code>Bind<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0434\u0446\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e &#171;\u043a\u043b\u0430\u0441\u0441-\u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c&#187; \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439\u00a0\u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e &#171;\u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/blockquote>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 &#171;Bind&#187;<\/h4>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd233182.aspx\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 MSDN \u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445<\/a> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 <code>let!<\/code> \u043a\u0430\u043a \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u0445\u0430\u0440 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <code>Bind<\/code>. \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0438\u0445 \u0435\u0449\u0451 \u0440\u0430\u0437:<\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 <code>let!<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"fsharp\">\/\/ \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f {| let! pattern = expr in cexpr |}  \/\/ \u043f\u0440\u0438\u043c\u0435\u0440 let! x = 43 in some expression <\/code><\/pre>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u043c\u0435\u0442\u043e\u0434\u0443 <code>Bind<\/code>, \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"fsharp\">\/\/ \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f builder.Bind(expr, (fun pattern -> {| cexpr |}))  \/\/ \u043f\u0440\u0438\u043c\u0435\u0440 builder.Bind(43, (fun x -> some expression)) <\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>Bind<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (<code>43<\/code>) \u0438 \u043b\u044f\u043c\u0431\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043b\u044f\u043c\u0431\u0434\u044b (<code>x<\/code>) \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. (\u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0437\u0436\u0435.)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>Bind<\/code> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043a \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0432 <code>let!<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0434\u0440\u044f\u0434 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <code>let!<\/code> \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"fsharp\">let! x = 1 let! y = 2 let! z = x + y <\/code><\/pre>\n<p>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0438\u0445 \u0432 \u0432\u044b\u0437\u043e\u0432\u044b <code>Bind<\/code> \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"fsharp\">Bind(1, fun x -> Bind(2, fun y -> Bind(x + y, fun z -> \/\/ \u0438 \u0442.\u0434. <\/code><\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e, \u0432\u044b \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u043b\u0438, \u043a \u0447\u0435\u043c\u0443 \u044f \u0432\u0435\u0434\u0443.<\/p>\n<p>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>pipeInfo<\/code> (\u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430)\u00a0\u2014 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u043c\u0435\u0442\u043e\u0434 <code>Bind<\/code>.<\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043c\u044b\u0441\u043b\u044c: <em>\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u00a0\u2014 \u044d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438 \u0442\u0430\u043a \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c<\/em>.<\/p>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u044f bind \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u0441\u043a\u043e\u043f\u043e\u043c<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>bind<\/code>\u00a0\u2014 \u044d\u0442\u043e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f &#171;bind&#187; (\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c)? \u041d\u0443, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 &#171;bind&#187; \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043a\u0430\u043a &#171;\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u0438\u0434\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0\u2014 \u044d\u0442\u0430 \u0448\u0442\u0443\u043a\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <em>\u043a\u0430\u0440\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/em>).<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0441 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u043e\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u0412\u044b \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440:<\/p>\n<pre><code class=\"fsharp\">let (>>=) m f = pipeInto(m,f) <\/code><\/pre>\n<p><em>\u041a\u0441\u0442\u0430\u0442\u0438, \u0441\u0438\u043c\u0432\u043e\u043b &#171;>>=&#187;\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0432\u0438\u0434\u0435\u043b\u0438 \u0435\u0451 \u0432 F#-\u043a\u043e\u0434\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435.<\/em><\/p>\n<p>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c, \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"fsharp\">let divideByWorkflow x y w z =     x |> divideBy y >>= divideBy w >>= divideBy z <\/code><\/pre>\n<p>\u0412\u0430\u043c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438? \u042d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0437\u0434\u0435\u0441\u044c \u0434\u0432\u043e\u0439\u043d\u043e\u0439:<\/p>\n<ul>\n<li>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>bind<\/code> \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0440\u0430\u0437\u043d\u0443\u044e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445. \u042d\u0442\u043e \u043d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u0430\u043a \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0442\u0438\u043f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 (<code>m<\/code> \u0432\u044b\u0448\u0435) \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0442\u0438\u043f\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (<code>f<\/code> \u0432\u044b\u0448\u0435), \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u0435\u043b\u0430\u0435\u0442 <code>bind<\/code>\u00a0\u2014 \u044d\u0442\u043e \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u0437\u043e\u0432\u044b <code>bind<\/code> \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0443.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0442\u0438\u043f\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u0422\u0438\u043f\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <code>WrapperType&lt;TypeA><\/code>, \u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>bind<\/code> \u0431\u0443\u0434\u0435\u0442 <code>TypeA -> WrapperType&lt;TypeB><\/code>.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <code>bind<\/code> \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0442\u0438\u043f\u043e\u043c-\u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>Option<\/code>. \u0422\u0438\u043f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 (\u0432\u044b\u0448\u0435 <code>m<\/code>)\u00a0\u2014 <code>Option&lt;int><\/code>, \u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 (\u0432\u044b\u0448\u0435 <code>f<\/code>)\u00a0\u2014 <code>int -> Option&lt;int><\/code>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u0445, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>bind<\/code>:<\/p>\n<pre><code class=\"fsharp\">let (>>=) m f =     printfn \"expression is %A\" m     f m  let loggingWorkflow =     1 >>= (+) 2 >>= (*) 42 >>= id <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u0434\u0430\u0436\u0435 \u0442\u0438\u043f\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <code>int<\/code>. \u041d\u043e \u0438 \u0437\u0434\u0435\u0441\u044c \u0443 <code>bind<\/code> \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u00a0\u2014 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u2014 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c (\u0438\u043b\u0438 \u0437\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438, \u043a\u0430\u043a \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f).<\/p>\n<h3>Option.bind: \u0435\u0449\u0451 \u0440\u0430\u0437 \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/h3>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 F# \u0432\u044b \u043d\u0435 \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b <code>Bind<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0437\u0430\u0447\u0435\u043c \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b!<\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>Option.bind<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>None<\/code>, \u043e\u043d\u0430 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Some<\/code>, \u043e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>Some<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0430\u043c\u0438:<\/p>\n<pre><code class=\"fsharp\">let pipeInto (m,f) =    match m with    | None ->        None    | Some x ->        x |> f <\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>Option.bind<\/code>:<\/p>\n<pre><code class=\"fsharp\">module Option =     let bind f m =        match m with        | None ->            None        | Some x ->            x |> f <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438 \u043c\u043e\u0440\u0430\u043b\u044c\u00a0\u2014 \u043d\u0435 \u0442\u043e\u0440\u043e\u043f\u0438\u0442\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435!<\/p>\n<p>\u0412\u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430-\u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 <code>Option.bind<\/code>:<\/p>\n<pre><code class=\"fsharp\">type MaybeBuilder() =     member this.Bind(m, f) = Option.bind f m     member this.Return(x) = Some x <\/code><\/pre>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432<\/h3>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 &#171;\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c&#187;. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430 \u0437\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0439.<\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u044f \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043b \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <\/em><code><em>pipeInfo<\/em><\/code><em> \u0432 <\/em><code><em>bind<\/em><\/code><em> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <\/em><code><em>Option.bind<\/em><\/code><em> \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/em><\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u044f\u0432\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre><code class=\"fsharp\">module DivideByExplicit =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      let divideByWorkflow x y w z =         let a = x |> divideBy y         match a with         | None -> None  \/\/ \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c         | Some a' ->    \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c             let b = a' |> divideBy w             match b with             | None -> None  \/\/ \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c             | Some b' ->    \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c                 let c = b' |> divideBy z                 match c with                 | None -> None  \/\/ \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c                 | Some c' ->    \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c                     \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0442                     Some c'     \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c\u00a0\u2014 \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u0441 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>bind<\/code> (\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u043b\u0438 <code>pipeInfo<\/code>):<\/p>\n<pre><code class=\"fsharp\">module DivideByWithBindFunction =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      let bind (m,f) =         Option.bind f m      let return' x = Some x      let divideByWorkflow x y w z =         bind (x |> divideBy y, fun a ->         bind (a |> divideBy w, fun b ->         bind (b |> divideBy z, fun c ->         return' c         )))      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"fsharp\">module DivideByWithCompExpr =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      type MaybeBuilder() =         member this.Bind(m, f) = Option.bind f m         member this.Return(x) = Some x      let maybe = new MaybeBuilder()      let divideByWorkflow x y w z =         maybe             {             let! a = x |> divideBy y             let! b = a |> divideBy w             let! c = b |> divideBy z             return c             }      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u0441 <code>bind<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"fsharp\">module DivideByWithBindOperator =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      let (>>=) m f = Option.bind f m      let divideByWorkflow x y w z =         x |> divideBy y         >>= divideBy w         >>= divideBy z      \/\/ test     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u043c\u0438. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <code>bind<\/code> \u0441 \u0442\u0438\u043f\u043e\u043c-\u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<h3>\u0423\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435: \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0432 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435?<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0432\u0430\u043c \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438 \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443?<\/p>\n<p>\u0412\u043e\u0442 \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435.<\/p>\n<h4>\u0427\u0430\u0441\u0442\u044c 1\u00a0\u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e:<\/p>\n<pre><code class=\"fsharp\">let strToInt str = ??? <\/code><\/pre>\n<p>\u0438 \u0437\u0430\u0442\u0435\u043c\u00a0\u2014 \u043a\u043b\u0430\u0441\u0441-\u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"fsharp\">let stringAddWorkflow x y z =     yourWorkflow         {         let! a = strToInt x         let! b = strToInt y         let! c = strToInt z         return a + b + c         }  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c let good = stringAddWorkflow \"12\" \"3\" \"2\" let bad = stringAddWorkflow \"12\" \"xyz\" \"2\" <\/code><\/pre>\n<h4>\u0427\u0430\u0441\u0442\u044c 2\u00a0\u2014 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e bind<\/h4>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0448 \u043a\u043e\u0434 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0440\u0430\u0441\u0448\u0438\u0440\u044c\u0442\u0435 \u0435\u0433\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0434\u0432\u0435 \u043d\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"fsharp\">let strAdd str i = ??? let (>>=) m f = ??? <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u0442\u0438\u043b\u0435:<\/p>\n<pre><code class=\"fsharp\">let good = strToInt \"1\" >>= strAdd \"2\" >>= strAdd \"3\" let bad = strToInt \"1\" >>= strAdd \"xyz\" >>= strAdd \"3\" <\/code><\/pre>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412\u043e\u0442 \u043e \u0447\u0451\u043c, \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445, \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435:<\/p>\n<ul>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u00a0\u2014 \u044d\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0439, \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0442 \u043d\u0430\u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0433\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p><code>bind<\/code>\u00a0\u2014 \u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0445\u043e\u0434, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u0441 \u0432\u0445\u043e\u0434\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043c\u0432\u043e\u043b &#171;>>=&#187;\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c <code>bind<\/code> \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/806097\/\"> https:\/\/habr.com\/ru\/articles\/806097\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/articles\/804957\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043f\u043e\u0441\u0442\u0435<\/a> \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u0447\u0442\u043e \u043e\u0431 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 <code>let<\/code> \u043c\u043e\u0436\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u043e \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0439 \u0441 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043a\u0443\u043b\u0438\u0441\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <code>Bind<\/code> \u043a\u043b\u0430\u0441\u0441\u0430-\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434. <code>Bind<\/code>\u00a0\u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0434\u0446\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<blockquote>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e &#171;\u043a\u043b\u0430\u0441\u0441-\u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c&#187; \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439\u00a0\u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e &#171;\u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<\/blockquote>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 &#171;Bind&#187;<\/h4>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd233182.aspx\" rel=\"noopener noreferrer nofollow\">\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 MSDN \u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u0445<\/a> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 <code>let!<\/code> \u043a\u0430\u043a \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u0445\u0430\u0440 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <code>Bind<\/code>. \u0421\u0440\u0430\u0432\u043d\u0438\u043c \u0438\u0445 \u0435\u0449\u0451 \u0440\u0430\u0437:<\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0443 <code>let!<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"fsharp\">\/\/ \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f {| let! pattern = expr in cexpr |}  \/\/ \u043f\u0440\u0438\u043c\u0435\u0440 let! x = 43 in some expression <\/code><\/pre>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u043c\u0435\u0442\u043e\u0434\u0443 <code>Bind<\/code>, \u0442\u0430\u043a\u0436\u0435 \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"fsharp\">\/\/ \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f builder.Bind(expr, (fun pattern -> {| cexpr |}))  \/\/ \u043f\u0440\u0438\u043c\u0435\u0440 builder.Bind(43, (fun x -> some expression)) <\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u043c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>Bind<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 (<code>43<\/code>) \u0438 \u043b\u044f\u043c\u0431\u0434\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043b\u044f\u043c\u0431\u0434\u044b (<code>x<\/code>) \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. (\u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0437\u0436\u0435.)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>Bind<\/code> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043a \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u0432 <code>let!<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0434\u0440\u044f\u0434 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <code>let!<\/code> \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"fsharp\">let! x = 1 let! y = 2 let! z = x + y <\/code><\/pre>\n<p>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0438\u0445 \u0432 \u0432\u044b\u0437\u043e\u0432\u044b <code>Bind<\/code> \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"fsharp\">Bind(1, fun x -> Bind(2, fun y -> Bind(x + y, fun z -> \/\/ \u0438 \u0442.\u0434. <\/code><\/pre>\n<p>\u0414\u0443\u043c\u0430\u044e, \u0432\u044b \u0443\u0436\u0435 \u043f\u043e\u043d\u044f\u043b\u0438, \u043a \u0447\u0435\u043c\u0443 \u044f \u0432\u0435\u0434\u0443.<\/p>\n<p>\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0430\u0448\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>pipeInfo<\/code> (\u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0430)\u00a0\u2014 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0447\u0442\u043e \u0438 \u043c\u0435\u0442\u043e\u0434 <code>Bind<\/code>.<\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u043c\u044b\u0441\u043b\u044c: <em>\u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u00a0\u2014 \u044d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0438 \u0442\u0430\u043a \u043c\u043e\u0436\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c<\/em>.<\/p>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u044f bind \u043f\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u0441\u043a\u043e\u043f\u043e\u043c<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>bind<\/code>\u00a0\u2014 \u044d\u0442\u043e, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f &#171;bind&#187; (\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c)? \u041d\u0443, \u043a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 &#171;bind&#187; \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d, \u043a\u0430\u043a &#171;\u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u0432\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0432\u0438\u0434\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u00a0\u2014 \u044d\u0442\u0430 \u0448\u0442\u0443\u043a\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <em>\u043a\u0430\u0440\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/em>).<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0441 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f, \u043e\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<p>\u0412\u044b \u0438 \u043f\u0440\u0430\u0432\u0434\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440:<\/p>\n<pre><code class=\"fsharp\">let (>>=) m f = pipeInto(m,f) <\/code><\/pre>\n<p><em>\u041a\u0441\u0442\u0430\u0442\u0438, \u0441\u0438\u043c\u0432\u043e\u043b &#171;>>=&#187;\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u0432\u0438\u0434\u0435\u043b\u0438 \u0435\u0451 \u0432 F#-\u043a\u043e\u0434\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435.<\/em><\/p>\n<p>\u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c, \u0438 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"fsharp\">let divideByWorkflow x y w z =     x |> divideBy y >>= divideBy w >>= divideBy z <\/code><\/pre>\n<p>\u0412\u0430\u043c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0435\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438? \u042d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>\u041e\u0442\u0432\u0435\u0442 \u0437\u0434\u0435\u0441\u044c \u0434\u0432\u043e\u0439\u043d\u043e\u0439:<\/p>\n<ul>\n<li>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>bind<\/code> \u0434\u0435\u043b\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0440\u0430\u0437\u043d\u0443\u044e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445. \u042d\u0442\u043e \u043d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u0430\u043a \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440 \u0438\u043b\u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0442\u0438\u043f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 (<code>m<\/code> \u0432\u044b\u0448\u0435) \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0442\u0438\u043f\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (<code>f<\/code> \u0432\u044b\u0448\u0435), \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0432\u0435\u0449\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u0435\u043b\u0430\u0435\u0442 <code>bind<\/code>\u00a0\u2014 \u044d\u0442\u043e \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u044b\u0437\u043e\u0432\u044b <code>bind<\/code> \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0443.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u0446\u0435\u043b\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0442\u0438\u043f\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438. \u0422\u0438\u043f\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <code>WrapperType&lt;TypeA><\/code>, \u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>bind<\/code> \u0431\u0443\u0434\u0435\u0442 <code>TypeA -> WrapperType&lt;TypeB><\/code>.<\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <code>bind<\/code> \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u0442\u0438\u043f\u043e\u043c-\u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>Option<\/code>. \u0422\u0438\u043f \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 (\u0432\u044b\u0448\u0435 <code>m<\/code>)\u00a0\u2014 <code>Option&lt;int><\/code>, \u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 (\u0432\u044b\u0448\u0435 <code>f<\/code>)\u00a0\u2014 <code>int -> Option&lt;int><\/code>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u0445, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>bind<\/code>:<\/p>\n<pre><code class=\"fsharp\">let (>>=) m f =     printfn \"expression is %A\" m     f m  let loggingWorkflow =     1 >>= (+) 2 >>= (*) 42 >>= id <\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0442 \u0434\u0430\u0436\u0435 \u0442\u0438\u043f\u0430-\u043e\u0431\u0451\u0440\u0442\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e <code>int<\/code>. \u041d\u043e \u0438 \u0437\u0434\u0435\u0441\u044c \u0443 <code>bind<\/code> \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u00a0\u2014 \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00a0\u2014 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c (\u0438\u043b\u0438 \u0437\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438, \u043a\u0430\u043a \u0432\u0430\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f).<\/p>\n<h3>Option.bind: \u0435\u0449\u0451 \u0440\u0430\u0437 \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/h3>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 F# \u0432\u044b \u043d\u0435 \u0440\u0430\u0437 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434\u044b <code>Bind<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0437\u0430\u0447\u0435\u043c \u043e\u043d\u0438 \u043d\u0443\u0436\u043d\u044b!<\/p>\n<p>\u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>Option.bind<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>None<\/code>, \u043e\u043d\u0430 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>Some<\/code>, \u043e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0435\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>Some<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u0441\u0430\u043c\u0438:<\/p>\n<pre><code class=\"fsharp\">let pipeInto (m,f) =    match m with    | None ->        None    | Some x ->        x |> f <\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <code>Option.bind<\/code>:<\/p>\n<pre><code class=\"fsharp\">module Option =     let bind f m =        match m with        | None ->            None        | Some x ->            x |> f <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0438 \u043c\u043e\u0440\u0430\u043b\u044c\u00a0\u2014 \u043d\u0435 \u0442\u043e\u0440\u043e\u043f\u0438\u0442\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u0430\u0432\u043d\u043e \u0435\u0441\u0442\u044c \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435!<\/p>\n<p>\u0412\u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u0430-\u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 <code>Option.bind<\/code>:<\/p>\n<pre><code class=\"fsharp\">type MaybeBuilder() =     member this.Bind(m, f) = Option.bind f m     member this.Return(x) = Some x <\/code><\/pre>\n<h3>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432<\/h3>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0447\u0435\u0442\u044b\u0440\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441 &#171;\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c&#187;. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430 \u0437\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0439.<\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u044f \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043b \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <\/em><code><em>pipeInfo<\/em><\/code><em> \u0432 <\/em><code><em>bind<\/em><\/code><em> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b <\/em><code><em>Option.bind<\/em><\/code><em> \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/em><\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e, \u044f\u0432\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0443\u044e \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<pre><code class=\"fsharp\">module DivideByExplicit =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      let divideByWorkflow x y w z =         let a = x |> divideBy y         match a with         | None -> None  \/\/ \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c         | Some a' ->    \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c             let b = a' |> divideBy w             match b with             | None -> None  \/\/ \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c             | Some b' ->    \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c                 let c = b' |> divideBy z                 match c with                 | None -> None  \/\/ \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u043c                 | Some c' ->    \/\/ \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u043c                     \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0442                     Some c'     \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c\u00a0\u2014 \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u0441 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>bind<\/code> (\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u043b\u0438 <code>pipeInfo<\/code>):<\/p>\n<pre><code class=\"fsharp\">module DivideByWithBindFunction =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      let bind (m,f) =         Option.bind f m      let return' x = Some x      let divideByWorkflow x y w z =         bind (x |> divideBy y, fun a ->         bind (a |> divideBy w, fun b ->         bind (b |> divideBy z, fun c ->         return' c         )))      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u0441 \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"fsharp\">module DivideByWithCompExpr =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      type MaybeBuilder() =         member this.Bind(m, f) = Option.bind f m         member this.Return(x) = Some x      let maybe = new MaybeBuilder()      let divideByWorkflow x y w z =         maybe             {             let! a = x |> divideBy y             let! b = a |> divideBy w             let! c = b |> divideBy z             return c             }      \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u0441 <code>bind<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"fsharp\">module DivideByWithBindOperator =      let divideBy bottom top =         if bottom = 0         then None         else Some(top\/bottom)      let (>>=) m f = Option.bind f m      let divideByWorkflow x y w z =         x |> divideBy y         >>= divideBy w         >>= divideBy z      \/\/ test     let good = divideByWorkflow 12 3 2 1     let bad = divideByWorkflow 12 3 0 1 <\/code><\/pre>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u043c\u0438. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u043e\u0441\u0442\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <code>bind<\/code> \u0441 \u0442\u0438\u043f\u043e\u043c-\u043e\u0431\u0451\u0440\u0442\u043a\u043e\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u043e \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.<\/p>\n<h3>\u0423\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435: \u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0432 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435?<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0434\u0432\u0438\u043d\u0443\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0432\u0430\u043c \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u044b \u043f\u043e\u043d\u044f\u043b\u0438 \u0432\u0441\u0451, \u0447\u0442\u043e \u043c\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438 \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443?<\/p>\n<p>\u0412\u043e\u0442 \u0434\u043b\u044f \u0432\u0430\u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435.<\/p>\n<h4>\u0427\u0430\u0441\u0442\u044c 1\u00a0\u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0439\u0442\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441<\/h4>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e:<\/p>\n<pre><code class=\"fsharp\">let strToInt str = ??? <\/code><\/pre>\n<p>\u0438 \u0437\u0430\u0442\u0435\u043c\u00a0\u2014 \u043a\u043b\u0430\u0441\u0441-\u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u0430\u043a\u043e\u0439, \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"fsharp\">let stringAddWorkflow x y z =     yourWorkflow         {         let! a = strToInt x         let! b = strToInt y         let! c = strToInt z         return a + b + c         }  \/\/ \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c let good = stringAddWorkflow \"12\" \"3\" \"2\" let bad = stringAddWorkflow \"12\" \"xyz\" \"2\" <\/code><\/pre>\n<h4>\u0427\u0430\u0441\u0442\u044c 2\u00a0\u2014 \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044e bind<\/h4>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0448 \u043a\u043e\u0434 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0440\u0430\u0441\u0448\u0438\u0440\u044c\u0442\u0435 \u0435\u0433\u043e, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0434\u0432\u0435 \u043d\u043e\u0432\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"fsharp\">let strAdd str i = ??? let (>>=) m f = ??? <\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u0442\u0438\u043b\u0435:<\/p>\n<pre><code class=\"fsharp\">let good = strToInt \"1\" >>= strAdd \"2\" >>= strAdd \"3\" let bad = strToInt \"1\" >>= strAdd \"xyz\" >>= strAdd \"3\" <\/code><\/pre>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0412\u043e\u0442 \u043e \u0447\u0451\u043c, \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445, \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435:<\/p>\n<ul>\n<li>\n<p>\u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u00a0\u2014 \u044d\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0439, \u0441\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0442 \u043d\u0430\u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0433\u0434\u0430.<\/p>\n<\/li>\n<li>\n<p><code>bind<\/code>\u00a0\u2014 \u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0445\u043e\u0434, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435 \u0441 \u0432\u0445\u043e\u0434\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043c\u0432\u043e\u043b &#171;>>=&#187;\u00a0\u2014 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c <code>bind<\/code> \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0444\u0438\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/806097\/\"> https:\/\/habr.com\/ru\/articles\/806097\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-372999","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=372999"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/372999\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=372999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=372999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=372999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}