{"id":292023,"date":"2019-07-13T15:01:15","date_gmt":"2019-07-13T15:01:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=292023"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=292023","title":{"rendered":"\u041f\u0440\u0438\u043c\u0435\u0440 Model-View-Update \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043d\u0430 F#"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u041a\u043e\u043c\u0443-\u0442\u043e \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f Redux \u0432 React \u0438\u0437-\u0437\u0430 \u0435\u0433\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 JS? <\/p>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u043e\u043d \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u043a\u043e\u0440\u044f\u0432\u044b\u043c\u0438 switch-case \u0432 reducer&#8217;\u0430\u0445, \u0435\u0441\u0442\u044c \u044f\u0437\u044b\u043a\u0438 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c pattern matching, \u0438 \u0442\u0438\u043f\u044b \u043b\u0443\u0447\u0448\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043c\u043e\u0434\u0435\u043b\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, F#.<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 <a href=\"https:\/\/elmish.github.io\/elmish\/\">Elmish<\/a>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u042f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u044d\u0442\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435, \u043d\u0430 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0432 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 Elmish.<\/p>\n<p>  <\/p>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0441\u0442\u0438\u0445\u043e\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0439, \u0432 seed&#8217;e \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0438\u0445\u043e\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0439 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<p>  <\/p>\n<p>\u041e\u043a\u043d\u043e \u0432\u043c\u0435\u0449\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 4 \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430, \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043e\u043a &#171;Up&#187; \u0438 &#171;Down&#187; \u043c\u043e\u0436\u043d\u043e \u043b\u0438\u0441\u0442\u0430\u0442\u044c \u0441\u0442\u0438\u0445\u043e\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435, \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u043c\u0435\u043d\u044f\u044e\u0442 \u0446\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430, \u0430 \u043a\u043d\u043e\u043f\u043a\u0438 \u0432\u043b\u0435\u0432\u043e \u0438 \u0432\u043f\u0440\u0430\u0432\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c\u0441\u044f \u043f\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0447\u0438\u0442\u0430\u043b \u0441\u0442\u0438\u0445\u043e\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435 \u041f\u0443\u0448\u043a\u0438\u043d\u0430, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u043b\u0441\u044f \u043d\u0430 \u0441\u0442\u0438\u0445\u043e\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0435 \u0415\u0441\u0435\u043d\u0438\u043d\u0430, \u0441\u043c\u0435\u043d\u0438\u043b \u0446\u0432\u0435\u0442 \u0442\u0435\u043a\u0441\u0442\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u0446\u0432\u0435\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0438 \u0415\u0441\u0435\u043d\u0438\u043d \u0435\u043c\u0443 \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u043d\u0430\u0436\u0430\u043b \u0434\u0432\u0430\u0436\u0434\u044b \u043d\u0430 \u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u0432\u043b\u0435\u0432\u043e \u0438 \u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u043a \u043c\u0435\u0441\u0442\u0443 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0447\u0438\u0442\u0430\u0442\u044c \u041f\u0443\u0448\u043a\u0438\u043d\u0430.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0447\u0443\u0434\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a :<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3h\/2j\/lh\/3h2jlh-zewzgiozosfdxax-re4m.png\"><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u044d\u0442\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0443, \u043f\u043e \u0435\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044e, \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0447\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0430 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0436\u0435\u043b\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0430<\/li>\n<li>\u041f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442<\/li>\n<li>\u041f\u0440\u043e\u043b\u0438\u0441\u0442\u0430\u0442\u044c (\u043d\u0430\u0432\u0435\u0440\u0445\/\u0432\u043d\u0438\u0437)<\/li>\n<li>\u041f\u0440\u043e\u0439\u0442\u0438 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e\/\u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0432\u0435\u0440\u0441\u0438\u044e \u043d\u0430\u0437\u0430\u0434, \u043d\u0443\u0436\u043d\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 <strong>\u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c<\/strong>, \u0432 \u0438\u0442\u043e\u0433\u0435 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">type Msg =         | ConsoleEvent of ConsoleKey         | ChangeAuthor of Author         | ChangeColor of ConsoleColor         | ChangePosition of ChangePosition         | ChangeVersion of ChangeVersion         | RememberModel         | WaitUserAction         | Exit  type ChangeVersion =         | Back         | Forward  type ChangePosition =         | Up         | Down  type Author =         | Pushkin         | Lermontov         | Blok         | Esenin  type Poem = Poem of string<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043c\u043e\u0434\u0435\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u0435\u043a\u0441\u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">type Model =         {             viewTextInfo: ViewTextInfo             countVersionBack: int             history: ViewTextInfo list         }  type ViewTextInfo =         {             text: string;             formatText: string;             countLines: int;             positionY: int;             color: ConsoleColor         }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Elmish \u2014 model-view-update, \u043c\u043e\u0434\u0435\u043b\u044c \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a view:<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">let SnowAndUserActionView (model: Model) (dispatch: Msg -&gt; unit) =        let { formatText = ft; color = clr } = model.viewTextInfo;        clearConsoleAndPrintTextWithColor ft clr        let key = Console.ReadKey().Key;        Msg.ConsoleEvent key |&gt; dispatch  let clearConsoleAndPrintTextWithColor (text: string) (color: ConsoleColor) =        Console.Clear();        Console.WriteLine()        Console.ForegroundColor &lt;- color        Console.WriteLine(text)<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043e\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439, \u043e\u043d\u043e \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <em>viewTextInfo<\/em>, \u0436\u0434\u0435\u0442 \u0440\u0435\u0430\u043a\u0446\u0438\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>update<\/em>.<br \/>  \u041f\u043e\u0437\u0436\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <em>dispatch<\/em>, \u0438 \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0437\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><em>Update<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">let update (msg: Msg) (model: Model) =         match msg with         | ConsoleEvent key -&gt; model, updateConsoleEvent key         | ChangeAuthor author -&gt; updateChangeAuthor model author         | ChangeColor color -&gt; updateChangeColor model color         | ChangePosition position -&gt; updateChangePosition model position         | ChangeVersion version -&gt; updateChangeVersion model version         | RememberModel -&gt; updateAddEvent model         | WaitUserAction -&gt; model, []<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0438\u043f\u0430 <em>msg <\/em>\u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e <em>update<\/em> \u043d\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u0435\u0439\u0441 \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <em>WaitUserAction<\/em> \u2014 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u0438 \u0436\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">let updateConsoleEvent (key: ConsoleKey) =        let msg =         match key with         | ConsoleKey.D1 -&gt; ChangeColor ConsoleColor.Red         | ConsoleKey.D2 -&gt; ChangeColor ConsoleColor.Green         | ConsoleKey.D3 -&gt; ChangeColor ConsoleColor.Blue         | ConsoleKey.D4 -&gt; ChangeColor ConsoleColor.Black         | ConsoleKey.D5 -&gt; ChangeColor ConsoleColor.Cyan          | ConsoleKey.LeftArrow -&gt; ChangeVersion Back         | ConsoleKey.RightArrow -&gt; ChangeVersion Forward          | ConsoleKey.P -&gt; ChangeAuthor Author.Pushkin         | ConsoleKey.E -&gt; ChangeAuthor Author.Esenin         | ConsoleKey.B -&gt; ChangeAuthor Author.Blok         | ConsoleKey.L -&gt; ChangeAuthor Author.Lermontov          | ConsoleKey.UpArrow -&gt; ChangePosition Up         | ConsoleKey.DownArrow -&gt; ChangePosition Down          | ConsoleKey.X -&gt; Exit          | _ -&gt; WaitUserAction        msg |&gt; Cmd.ofMsg<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0430\u0432\u0442\u043e\u0440\u0430, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <em>countVersionBack<\/em> \u0441\u0440\u0430\u0437\u0443 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 0, \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u043b\u0441\u044f \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043d\u0430\u0437\u0430\u0434, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0446\u0432\u0435\u0442, \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u0430\u043a \u043d\u043e\u0432\u043e\u0435 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0432 <em>history<\/em>. <\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">let updateChangeAuthor (model: Model) (author: Author) =         let (Poem updatedText) = seed.[author]         let updatedFormatText = getlines updatedText 0 3         let updatedCountLines = (splitStr updatedText).Length         let updatedViewTextInfo =             {model.viewTextInfo              with text = updatedText;               formatText = updatedFormatText;               countLines = updatedCountLines }          { model           with viewTextInfo = updatedViewTextInfo;            countVersionBack = 0 },         Cmd.ofMsg RememberModel <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 <em>RememberModel<\/em>, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 <em>history<\/em>, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">let updateModelHistory model =         { model with history = model.history @ [ model.viewTextInfo ] },         Cmd.ofMsg WaitUserAction<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 <em>update&#8217;\u044b<\/em> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/brager17\/ElmishStyling\/blob\/master\/ElmishStyle\/LibraryElmish.fs\">\u0442\u0443\u0442<\/a>, \u043e\u043d\u0438 \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0422\u0435\u0441\u0442\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><em>\u041c\u0435\u0442\u043e\u0434 <\/em>run<em> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a <\/em>Messages<em> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u044b<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">[&lt;Property(Verbose=true)&gt;] let ``\u0410\u0432\u0442\u043e\u0440 \u0440\u0430\u0432\u0435\u043d \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0430\u0432\u0442\u043e\u0440\u0443`` (authors: Author list) =     let state = (createProgram (authors |&gt; List.map ChangeAuthor) |&gt; run)     match (authors |&gt; List.tryLast) with     | Some s -&gt;         let (Poem text) = seed.[s]         state.viewTextInfo.text = text     | None -&gt; true  [&lt;Property(Verbose=true)&gt;] let ``\u0426\u0432\u0435\u0442 \u0440\u0430\u0432\u0435\u043d \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u0446\u0432\u0435\u0442\u0443`` changeColorMsg =     let state = (createProgram (changeColorMsg|&gt;List.map ChangeColor)|&gt; run)     match (changeColorMsg |&gt; List.tryLast) with     | Some s -&gt; state.viewTextInfo.color = s     | None -&gt; true  [&lt;Property(Verbose=true,Arbitrary=[|typeof&lt;ChangeColorAuthorPosition&gt;|])&gt;] let ``\u0412\u044b\u0437\u043e\u0432 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u043a\u043e\u043c\u0430\u043d\u0434 \u0441\u043c\u0435\u043d\u044b \u0446\u0432\u0435\u0442\u0430 \u0438 \u0430\u0432\u0442\u043e\u0440\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d`` msgs =       let tryLastSomeList list = list |&gt; List.filter (Option.isSome)                                       |&gt; List.map (Option.get)                                       |&gt; List.tryLast       let lastAuthor = msgs                        |&gt; List.map (fun x -&gt; match x with                                              | ChangeAuthor a -&gt; Some a                                              | _ -&gt; None)                        |&gt; tryLastSomeList       let lastColor = msgs                        |&gt; List.map (fun x -&gt; match x with                                             | ChangeColor a -&gt; Some a                                             | _ -&gt; None)                        |&gt; tryLastSomeList       let state = (createProgram msgs |&gt; run)       let colorTest =           match lastColor with           | Some s -&gt; state.viewTextInfo.color = s           | None -&gt; true       let authorTest =           match lastAuthor with           | Some s -&gt;               let (Poem t) = seed.[s];               state.viewTextInfo.text = t           | None -&gt; true       authorTest &amp;&amp; colorTest <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 FsCheck, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u044f\u0434\u0440\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0434 \u0432 Elmish \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438 \u044f \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u043b \u0435\u0433\u043e(<a href=\"https:\/\/elmish.github.io\/elmish\/program.html\">\u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434)<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">type Dispatch&lt;'msg&gt; = 'msg -&gt; unit  type Sub&lt;'msg&gt; = Dispatch&lt;'msg&gt; -&gt; unit  type Cmd&lt;'msg&gt; = Sub&lt;'msg&gt; list  type Program&lt;'model, 'msg, 'view&gt; =         {           init: unit -&gt;'model * Cmd&lt;'msg&gt;           update: 'msg -&gt; 'model -&gt; ('model * Cmd&lt;'msg&gt;)           setState: 'model -&gt; 'msg -&gt; Dispatch&lt;'msg&gt; -&gt; unit          }  let runWith&lt;'arg, 'model, 'msg, 'view&gt; (program: Program&lt;'model, 'msg, 'view&gt;) =     let (initModel, initCmd) = program.init() \/\/1     let mutable state = initModel \/\/2     let mutable reentered = false \/\/3     let buffer = RingBuffer 10 \/\/4       let rec dispatch msg =         let mutable nextMsg = Some msg; \/\/5         if reentered  \/\/6          then buffer.Push msg \/\/7          else               while Option.isSome nextMsg do \/\/ 8                  reentered &lt;- true \/\/ 9                  let (model, cmd) = program.update nextMsg.Value state \/\/ 9                  program.setState model nextMsg.Value dispatch \/\/ 10                  Cmd.exec dispatch cmd |&gt; ignore  \/\/11                  state &lt;- model; \/\/ 12                  nextMsg &lt;- buffer.Pop() \/\/ 13                  reentered &lt;- false; \/\/ 14      Cmd.exec dispatch initCmd |&gt; ignore \/\/ 15     state \/\/16  let run program = runWith program<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0438\u043f <em>Dispath&lt;&#8216;msg&gt;<\/em> \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e\u0442 dispatch \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e <em>view<\/em>, \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <em>Message<\/em> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>unit<\/em><br \/>  <em>Sub&lt;&#8216;msg&gt;<\/em> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <em>dispatch<\/em> \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>unit<\/em>, \u043c\u044b \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a <em>Sub<\/em>, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <em>ofMsg<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">let ofMsg&lt;'msg&gt; (msg: 'msg): Cmd&lt;'msg&gt; =         [ fun (dispatch: Dispatch&lt;'msg&gt;) -&gt; dispatch msg ]<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <em>ofMsg<\/em>, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <em>Cmd.ofMsg RememberModel<\/em> \u0432 \u043a\u043e\u043d\u0446\u0435 \u043c\u0435\u0442\u043e\u0434\u0430 <em>updateChangeAuthor<\/em>, \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u0432 \u043c\u0435\u0442\u043e\u0434 <em>update<\/em><br \/>  <em>Cmd&lt;&#8216;msg&gt;<\/em> \u2014 \u041b\u0438\u0441\u0442 <em>Sub&lt;&#8216;msg&gt;<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0442\u0438\u043f\u0443 <em>Program<\/em>, \u044d\u0442\u043e generic \u0442\u0438\u043f, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u0438\u043f \u043c\u043e\u0434\u0435\u043b\u0438, \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438 <em>view<\/em>, \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0435\u0442 \u043d\u0443\u0436\u043d\u044b \u0447\u0442\u043e-\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0438\u0437 <em>view<\/em>, \u043d\u043e \u0432 Elmish.React view \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 F# \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 DOM \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0435 <em>init <\/em> \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 elmish, \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e <em>Cmd.ofMsg RememberModel<\/em><br \/>  <em>Update <\/em> \u2014 \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>update<\/em>, \u0432\u044b \u0441 \u043d\u0435\u0439 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b.<\/p>\n<p>  <\/p>\n<p><em>SetState <\/em> \u2014 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c Elmish \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 <em>dispatch <\/em>\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <em>view<\/em>, \u043d\u043e \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c msg, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0442\u044c <em>view <\/em>\u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0431\u043c\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <em>runWith<\/em>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u0434\u0430\u043b\u0435\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 <em>init<\/em>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043f\u0435\u0440\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435, \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430\u0445 2,3 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u0432\u0430 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u2014 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f <em>state<\/em>, \u0432\u0442\u043e\u0440\u043e\u0439 \u043d\u0443\u0436\u0435\u043d \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>dispatch<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 4 \u0441\u0442\u0440\u043e\u043a\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <em>buffer <\/em> \u2014 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u0448\u0435\u043b \u2014 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0448\u0435\u043b(\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f <em>RingBuffer<\/em>, \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430, \u044f \u0432\u0437\u044f\u043b \u0435\u0435 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/github.com\/elmish\/elmish\/blob\/b7b7cff927472a7520f22a7300480fd8dd8dcfca\/docs\/content\/ring.fsx\">github<\/a>)<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u0441\u0430\u043c\u0430 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>dispatch<\/em>, \u0442\u0430 \u0436\u0435 \u0441\u0430\u043c\u0430\u044f, \u0447\u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043e <em>view<\/em>, \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u044b \u043c\u0438\u043d\u0443\u0435\u043c <em>if<\/em> \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 6 \u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u043c \u0432 \u0446\u0438\u043a\u043b, \u0441\u0442\u0430\u0432\u0438\u043c <em>reented<\/em> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>true<\/em>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u043d\u0435 \u0437\u0430\u0445\u043e\u0434\u0438\u043b\u0438 \u0441\u043d\u043e\u0432\u0430 \u0432 \u044d\u0442\u043e\u0442 \u0446\u0438\u043a\u043b, \u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b\u0438 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 <em>buffer<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 9 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <em>update<\/em>, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435(\u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u044d\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 <em>RememberModel<\/em>)<br \/>  \u041d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 10 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c, \u043c\u0435\u0442\u043e\u0434 <em>SetState<\/em> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3v\/2c\/3l\/3v2c3li4ffe4paffy46f98nadle.png\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 <em>view<\/em><br \/>  \u042d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u043c\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 <em>Console.ReadLine <\/em>\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0438 \u0442\u0430\u043a\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u0430\u043a <em>RememberModel,ChangeColor<\/em> (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0430 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c) \u0431\u0443\u0434\u0443\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0436\u0434\u0430\u0442\u044c \u043f\u043e\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u043c\u0435\u0442 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443, \u0445\u043e\u0442\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0446\u0432\u0435\u0442.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>OnlyShowView<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c.<br \/>  E\u0441\u043b\u0438 \u0431\u044b \u0432\u043c\u0435\u0441\u0442\u043e RememberModel \u0432 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u0448\u043b\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 <em>WaitUserAction<\/em>, \u0442\u043e \u0432\u044b\u0437\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>ShowAndUserActionView<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0440\u0438\u0441\u0443\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u0438 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u0442\u043e\u043a, \u043e\u0436\u0438\u0434\u0430\u044f \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043a\u043d\u043e\u043f\u043a\u0438, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043d\u043e\u043f\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0436\u0430\u0442\u0430 \u0441\u043d\u043e\u0432\u0430 \u0432\u044b\u0437\u043e\u0432\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <em>dispatch<\/em>, \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0448\u0435\u043d\u043e \u0432 <em>buffer<\/em>(\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <em>reenvited<\/em>= <em>false<\/em>)<\/p>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0438\u0437 \u043c\u0435\u0442\u043e\u0434\u0430 <em>update<\/em>, \u0438\u043d\u0430\u0447\u0435 \u043c\u044b \u0438\u0445 \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u043c, \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432 \u0446\u0438\u043a\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 <em>reented<\/em> \u0441\u0442\u0430\u043d\u0435\u0442 false. 11 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u043e\u0436\u043d\u043e, \u043d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e push \u0432\u0441\u0435\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 <em>buffer<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"haskell\">let exec&lt;'msg&gt; (dispatch: Dispatch&lt;'msg&gt;) (cmd: Cmd&lt;'msg&gt;) =         cmd |&gt; List.map (fun sub -&gt; sub dispatch)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <em>update<\/em>, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d <em>dispatch<\/em>, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u044d\u0442\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 <em>buffer<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 12 \u0441\u0442\u0440\u043e\u043a\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043c\u043e\u0434\u0435\u043b\u044c, \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>reented <\/em>\u043d\u0430 false, \u043a\u043e\u0433\u0434\u0430 <em>buffer <\/em>\u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439 \u044d\u0442\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0442\u0430\u043c \u043d\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 <em>dispatch <\/em>\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 <em>view<\/em>, \u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b. \u041e\u043f\u044f\u0442\u044c \u0436\u0435 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u044d\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 dispatch \u043d\u0430 10 \u0441\u0442\u0440\u043e\u0447\u043a\u0435, \u043d\u043e \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b, \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d \u0432\u044b\u0437\u043e\u0432 <em>dispatch <\/em>\u0438\u0437 callback&#8217;a \u0438 \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  <\/p>\n<p>\u041d\u0443 \u0432\u043e\u0442 \u0438 \u0432\u0441\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>dispatch<\/em>, \u043d\u0430 15 \u0441\u0442\u0440\u043e\u043a\u0435 \u043e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0430 16 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <em>state<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u0445\u043e\u0434 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 <em>buffer<\/em> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c. \u0412 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 <em>runWith <\/em>\u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442, \u043d\u043e \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<\/p>\n<p>  <\/p>\n<p><em>Program<\/em> \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>createProgram <\/em>\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438 \u0432 <em>SetState <\/em>\u043e\u043d\u0438 \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u044e\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u0435:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/jc\/tz\/4u\/jctz4uefscbzhubowwwfa9zltr8.png\"><\/p>\n<p>  <\/p>\n<p>\u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043c\u043e\u0435\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043e\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u2014 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f update, \u0430 \u043f\u043e\u0442\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e <em>setState<\/em>, \u0432 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430, \u0430 \u043f\u043e\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u044f \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0431\u044b\u043b \u043d\u0430 \u044d\u0442\u043e \u043f\u043e\u0439\u0442\u0438 \u0438\u0437-\u0437\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <em>Console.ReadKey<\/em> (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u0435\u043d\u044f\u0442\u044c <em>view<\/em>)<\/p>\n<p>  <\/p>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d Elmish \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0437\u0430 \u0431\u043e\u0440\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 Elmish, \u0435\u0441\u043b\u0438 \u0432\u0430\u0441 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u044d\u0442\u043e \u0442\u0435\u043c\u0430, \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0438\u0445 <a href=\"https:\/\/elmish.github.io\/elmish\/\">\u0441\u0430\u0439\u0442<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <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\/post\/459870\/\"> https:\/\/habr.com\/ru\/post\/459870\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u041a\u043e\u043c\u0443-\u0442\u043e \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f Redux \u0432 React \u0438\u0437-\u0437\u0430 \u0435\u0433\u043e \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 JS? <\/p>\n<p>  <\/p>\n<p>\u041c\u043d\u0435 \u043e\u043d \u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u043a\u043e\u0440\u044f\u0432\u044b\u043c\u0438 switch-case \u0432 reducer&#8217;\u0430\u0445, \u0435\u0441\u0442\u044c \u044f\u0437\u044b\u043a\u0438 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u044b\u043c pattern matching, \u0438 \u0442\u0438\u043f\u044b \u043b\u0443\u0447\u0448\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043c\u043e\u0434\u0435\u043b\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, F#.<br \/>  \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u043c\u0435\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0432 <a href=\"https:\/\/elmish.github.io\/elmish\/\">Elmish<\/a>.<\/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-292023","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292023","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=292023"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292023\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}