{"id":283471,"date":"2017-01-07T23:20:03","date_gmt":"2017-01-07T20:20:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=283471"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=283471","title":{"rendered":"\u041a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u0432 Scala (\u0441 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043e\u0431\u0437\u043e\u0440\u043e\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 cats)"},"content":{"rendered":"<p>\u041f\u0440\u0438 \u0441\u043b\u043e\u0432\u0435 &quot;\u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c&quot; \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u0442\u043e\u043b\u043f\u043e\u0432 (<a href=\"https:\/\/habrahabr.ru\/post\/37576\/\">\u041f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445<\/a>). (\u041f\u0440\u0438\u0447\u0451\u043c, \u043f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u043c, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u043e\u043b\u043f\u044b.) \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0451\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0440\u044f\u0434\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0442\u0438\u043f\u0430\u043c, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u043a\u0430, \u0438\u043b\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, &quot;\u0440\u0435\u0448\u0438\u0442\u044c&quot; \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439, \u0434\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u043a\u043b\u0430\u0441\u0441\u0430\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/habrahabr.ru\/users\/IvanGolovach\/\">@IvanGolovach<\/a> \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u2192 <a href=\"https:\/\/habrahabr.ru\/company\/golovachcourses\/blog\/266905\/\">&quot;FP \u043d\u0430 Scala: \u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u0444\u0443\u043d\u043a\u0442\u043e\u0440?&quot;<\/a> \u2014 2015.<br \/>  \u0417\u0434\u0435\u0441\u044c \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u043f\u0440\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0442\u043e\u0440\u043e\u0432. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432.<\/li>\n<li>\u041c\u0438\u0445\u0430\u0438\u043b \u041f\u043e\u0442\u0430\u043d\u0438\u043d <a href=\"https:\/\/habrahabr.ru\/users\/potan\/\">@potan<\/a> \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u2192 <a href=\"https:\/\/habrahabr.ru\/post\/205482\/\">&quot;\u041a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u043d\u0430 C++&quot;<\/a> \u2014 2013.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u0432 C++. \u041f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 type class&#8217;\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e.<\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/users\/VoidEx\/\">@VoidEx<\/a> \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u2192 <a href=\"https:\/\/habrahabr.ru\/post\/51046\/\">&quot;\u041a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432, \u043c\u043e\u043d\u0430\u0434\u044b&quot;<\/a> \u2014 2009.<br \/>  \u041e\u043f\u0438\u0441\u0430\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u0432 Haskell (\u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0421++). <\/li>\n<li><a href=\"https:\/\/habrahabr.ru\/users\/IvanP\/\">@IvanP<\/a> \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u2192 <a href=\"https:\/\/habrahabr.ru\/post\/166353\/\">&quot;\u041f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u044f \u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u0432 Haskell&quot;<\/a> \u2014 2013.<br \/>  \u041e\u043f\u0438\u0441\u0430\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438 ad-hoc \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c, \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0412\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0434\u043b\u044f \u044f\u0437\u044b\u043a\u0430 Haskell.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u044c \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u043a\u0430\u043a \u043d\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0432\u0441\u0435\u0434\u043d\u0435\u0432\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432. \u041f\u0440\u0438\u0447\u0451\u043c, \u0435\u0441\u043b\u0438 \u0432 Haskell&#8217;\u0435 \u0431\u0435\u0437 \u043d\u0438\u0445 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c, \u0442\u043e \u0432 S\u0441ala \u043c\u043e\u0436\u043d\u043e <del>\u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e<\/del> \u0441\u043d\u043e\u0441\u043d\u043e \u0436\u0438\u0442\u044c, \u043d\u0435 \u0437\u043d\u0430\u044f \u043e\u0431 \u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0440\u0438 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u0442\u044c \u0446\u0435\u043b\u044b\u0439 \u0440\u044f\u0434 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u044d\u0442\u043e\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0435, \u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  <\/p>\n<h3 id=\"neizmenyaemye-tipy-dannyh\">\u041d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>  <\/p>\n<p>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0448\u0438\u0440\u043e\u043a\u0443\u044e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u043b\u0438 \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u0442\u043e \u043d\u0435\u0442 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0438\u0445 \u0441\u043a\u0440\u044b\u0432\u0430\u0442\u044c, \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0442\u0438\u043f\u044b, \u0433\u0434\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b. (\u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u0441\u0440\u0435\u0434\u0438 \u0442\u0440\u0451\u0445 \u0441\u0442\u043e\u043b\u043f\u043e\u0432 \u041e\u041e\u041f \u2014 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c\u0430, \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u044f\u0446\u0438\u0438, \u2014 \u043e\u0434\u0438\u043d \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0432\u0438\u043d\u0443\u0442 \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443.)<br \/>  \u0421\u0432\u043e\u0431\u043e\u0434\u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0438 \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0431\u0430\u0440\u044c\u0435\u0440\u044b \u043c\u0435\u0436\u0434\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u043e\u0442\u0438\u043f\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<br \/>  \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0443\u0445 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432 (<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%B5%D0%B1%D1%80%D0%B0%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B9_%D1%82%D0%B8%D0%BF_%D0%B4%D0%B0%D0%BD%D0%BD%D1%8B%D1%85\">\u0410\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445<\/a>). \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u043b\u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 (&quot;\u0442\u0438\u043f-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435&quot;). \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u2014 enum, \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432, sealed trait \u2014 &quot;\u0442\u0438\u043f-\u0441\u0443\u043c\u043c\u0430&quot;. <\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440:<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">\/\/ \u0442\u0438\u043f-\u0441\u0443\u043c\u043c\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439: sealed trait Form object Form {   \/\/  \u0442\u0438\u043f-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 String X String   case class Form1(number: String, title: String) extends Form    \/\/ \u0442\u0438\u043f-\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 UUID X String X Int   case class Form2(id: UUID, documentation: String, count: Int) extends Form   \/\/ == Unit (\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u0438\u043f\u043e\u0432)   case object BadForm extends Form }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0442\u0430\u043a\u0438\u0435 \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442 \u0441\u043e\u043a\u0440\u044b\u0442\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0412\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u0438 \u0442\u0438\u043f\u044b \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c HTML-\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/li>\n<li>\u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u043f\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c<\/li>\n<li>\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c\/\u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c<\/li>\n<li>\u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438<\/li>\n<li>&#8230;<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0432\u0438\u0434\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0431\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u043e \u0438 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u0437\u043d\u0430\u0442\u044c \u0434\u0440\u0443\u0433 \u043e \u0434\u0440\u0443\u0433\u0435. \u0412 \u0442\u0430\u043a\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u0432 \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u0430\u043c \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f pattern-matching. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pattern-matching&#8217;\u0430 \u043c\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u0435\u043a\u0442, \u0438 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0445 \u043d\u0430\u0441 \u043f\u043e\u043b\u0435\u0439.<br \/>  \u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0432\u043d\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041b\u043e\u0433\u0438\u043a\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0435 \u0440\u0430\u0437\u043c\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0434\u0442\u0438\u043f\u0443, \u0430 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435. <\/li>\n<li>\u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u0448\u0430\u043d\u0430 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u0423\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c\u0438.<\/li>\n<li>\u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0421\u0423\u0411\u0414 \u043a \u043c\u043e\u0434\u0443\u043b\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li>\u041b\u0435\u0433\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0442\u0438\u043f\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f &quot;\u043e\u0440\u0442\u043e\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e&quot; \u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f\u0445.<\/li>\n<\/ol>\n<p>  <\/p>\n<h3 id=\"klassy-tipov\">\u041a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u043d\u0435 \u043d\u0430\u0448\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 \u0432 \u044d\u0442\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043f\u0440\u044f\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u0442\u0438\u043f\u044b, \u0442\u043e \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e, \u0441 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0449\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u043d\u043e, \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0435\u0433\u043e \u043e\u0431\u0449\u043d\u043e\u0441\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0430. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0447\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0435\u0436\u0435, \u0438, \u043f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u0431\u0443\u0434\u0435\u0442 \u0445\u0443\u0436\u0435 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d (\u043f\u0440\u0438 \u0442\u0435\u0445 \u0436\u0435 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u044b\u0445 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0442\u0440\u0430\u0442\u0430\u0445), \u043b\u0438\u0431\u043e \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0448\u0435.<br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0438\u043c\u0435\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 (\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0438 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0435). \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0438 \u043e\u043a\u0443\u043f\u0438\u0442 \u0437\u0430\u0442\u0440\u0430\u0442\u044b \u043d\u0430 \u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<br \/>  \u0412 \u041e\u041e\u041f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f &quot;\u043f\u043e\u0445\u043e\u0436\u0438\u0445&quot; \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0412 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 &quot;\u043f\u043e\u0445\u043e\u0436\u0438\u0445&quot; \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0430\u043c\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  \u041a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u0432 \u043e\u0431\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u0438\u0438 \u043a\u043e\u0434\u0430, \u0438\u0433\u0440\u0430\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u043e\u043b\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430\u0434 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u0440\u0435\u0434\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440:<\/em><br \/>  \u041f\u0443\u0441\u0442\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0435\u043c \u043d\u0430\u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443. \u0422\u0430\u043a\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">def compare[T](a: T, b: T): Int<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 <code>Ordering<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">trait Ordering[T] {   def compare(a: T, b: T): Int }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0443\u0441\u0442\u044c \u043d\u0430\u0448 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">def sort[T](list: List[T]): List[T]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Ordering<\/code> \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0438\u043f\u0430 <code>T<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">def sort[T: Ordering](list: List[T]): List[T]<\/code><\/pre>\n<p>  <\/p>\n<p>\u043b\u0438\u0431\u043e, \u0447\u0442\u043e \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">def sort[T](list: List[T])(implicit o: Ordering[T]): List[T]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>compare<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>implicitly[Ordering[T]].compare(a,b)<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043c \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">implicit object FormOrdering extends Ordering[Form] {    def compare(a: Form, b: Form): Int = (a,b) match {     case (Form1(numberA, titleA), Form1(numberB, titleB)) =&gt; numberA - numberB     case (BadForm, BadForm) =&gt; 0    ...     case _ =&gt; 0   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u043c \u043e\u0431\u0449\u043d\u043e\u0441\u0442\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0431\u0435\u0437 \u0437\u0430\u0433\u0440\u043e\u043c\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0443\u0441\u043a\u0430\u043c\u0438 \u043a\u043e\u0434\u0430, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u043c\u0438\u0441\u044f \u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0443.<\/p>\n<p>  <\/p>\n<h4 id=\"dopolnitelnoe-udobstvo\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u043e<\/h4>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0443 \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>a compare b<\/code>, \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430.<br \/>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0432 Scala \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c pimp-my-library:<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">implicit class OrderingOps[T:Ordering](a:T){   def compare(b:T): Int = implicitly[Ordering[T]].compare(a,b) }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u0443 \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>Ordering<\/code>, \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 &quot;\u043c\u0435\u0442\u043e\u0434&quot; <code>compare<\/code>.<br \/>  \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/mpilquist\/simulacrum\">simulacrum<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u043e \u0432\u0441\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u043e\u0431\u0432\u044f\u0437\u043a\u043e\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0430\u043a\u0440\u043e\u0441\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">import simulacrum.typeclass @typeclass trait Ordering[T]{    def compare(a: T, b: T): Int }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"primer-klass-tipa-dlya-perepisyvaniya-derevev-simvolnoe-reshenie-uravneniy-optimizaciya-programm\">\u041f\u0440\u0438\u043c\u0435\u0440: \u041a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 (\u0441\u0438\u043c\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c)<\/h4>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u0435 AST \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0431\u0445\u043e\u0434 \u0432\u0441\u0435\u0445 \u0443\u0437\u043b\u043e\u0432 \u0434\u0435\u0440\u0435\u0432\u0430 (\u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443 \u0438\u043b\u0438 \u0432 \u0448\u0438\u0440\u0438\u043d\u0443), \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0438\u0441\u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 (pattern matching) \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0443\u0437\u0435\u043b \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443.<br \/>  \u0414\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 (\u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b) \u0442\u0438\u043f\u044b, \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u043e AST, \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f, \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\/\u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u2014 \u0442\u043e\u0436\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0431\u0445\u043e\u0434\u0430 \u2014 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439.<br \/>  \u042d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u2014 \u043f\u0440\u0435\u0442\u0435\u043d\u0434\u0435\u043d\u0442 \u043d\u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432. \u041a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 \u0434\u0435\u0440\u0435\u0432\u0430 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">import simulacrum.typeclass  @typeclass trait RewritableTree[T] {   def children(node: T): List[T]   def replaceChildren(node: T, newChildren: List[T]): T }<\/code><\/pre>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"scala\">object RewritableTree {   def rewrite[T: RewritableTree](f: PartialFunction[T, T]): T =&gt; T = t =&gt; {     rewrite0(f)(t).getOrElse(t)   }    private def rewrite0[T: RewritableTree](f: PartialFunction[T, T])(t: T): Option[T] = {     import RewritableTree.ops._  \/\/ \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c &quot;\u043c\u0435\u0442\u043e\u0434\u044b&quot;, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 simulacrum'\u043e\u043c       val rt = implicitly[RewritableTree[T]]   - \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e &quot;\u043c\u0435\u0442\u043e\u0434\u0430&quot;     val children = t.children \/\/ rt.children(t)      var changed = false \/\/ \u043a\u0440\u043e\u043c\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u043d\u0438\u044f, \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0437\u043d\u0430\u0442\u044c, \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u0434\u0435\u0440\u0435\u0432\u043e \u0431\u0435\u0437 \u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u0438     val updatedChildren = children.map{child =&gt;       val res = rewrite0(f)(child)       changed = changed || res.isDefined       res.getOrElse(child)     }     \/\/ \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0435\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439     \/\/def rewriteList(lst: List[T], result: mutable.ListBuffer[T], changed: Boolean): (List[T], Boolean) = lst match {     \/\/  case Nil =&gt; (result.toList, changed)     \/\/  case head :: tail =&gt;     \/\/    val res = rewrite0(f)(head)     \/\/    rewriteList(tail, result.append(res.getOrElse(head)), changed || res.isDefined)     \/\/}     \/\/val (updatedChildren, changed) = rewriteList(t.children, mutable.ListBuffer(), false)     val updatedTree =       if(changed)         t.replaceChildren(updatedChildren)       else         t     var changed2 = true     val updatedTree2 = f.applyOrElse(t1, (_:T) =&gt;{changed2 = false; updatedTree})     if(changed || changed2)       Some(updatedTree2)     else       None   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0436\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>collect<\/code>, \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0449\u0438\u0439 \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u043c\u0435\u0440\u0435 \u043e\u0431\u0445\u043e\u0434\u0430 \u0434\u0435\u0440\u0435\u0432\u0430.<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h4 id=\"induktivnoe-opredelenie-klassov-tipov-dlya-proizvodnyh-tipov\">\u0418\u043d\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 <code>Ordering[T]<\/code> \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0438\u043f\u0430 <code>T<\/code>. \u0410 \u043c\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a <code>Option[T]<\/code>. \u041d\u0435\u043b\u044c\u0437\u044f \u043b\u0438 \u043d\u0430\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0442\u0438\u043f\u0430 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u044e\u0449\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c?<br \/>  \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430 \u043d\u0430\u043b\u0435\u0442\u0443, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u0443\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u0437 \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"scala\">implicit def optionOrdering[T:Ordering]: Ordering[Option[T]] = new Ordering[Option[T]] {   def compare(a: Option[T], b: Option[T]): Int = (a, b) match {     case (Some(c), Some(d)) =&gt; implicitly[Ordering[T]].compare(c,d)     case (None, None) =&gt; 0     case (_, None) =&gt; 1     case (None, _) =&gt; -1   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430 <code>Ordering[T]<\/code>.<br \/>  \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 generic-\u0442\u0438\u043f\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a, <code>List[T]<\/code>, <code>Tuple2[A,B]<\/code>, &#8230;<\/p>\n<p>  <\/p>\n<h3 id=\"standartnye-klassy-tipov-cats\">\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 (cats)<\/h3>\n<p>  <\/p>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432, \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c\u0438. \u0414\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0435\u0441\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430, \u043b\u0438\u0431\u043e \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0432 \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c. \u041e\u0431\u0430 \u044d\u0442\u0438\u0445 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<br \/>  \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0434\u0430\u043d\u043d\u044b\u043c, \u043c\u044b \u0441 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u0439\u0442\u0438 \u043a \u043a\u0430\u043a\u0438\u043c-\u043b\u0438\u0431\u043e \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Scala \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432: <code>Ordering[T]<\/code>, <code>Equiv[T]<\/code>, <code>Numeric[T]<\/code>, <code>Integral[T]<\/code>, &#8230;<\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 typelevel\/cats (\u043a\u0430\u043a \u0438 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 scalaz) \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0441 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 (<a href=\"http:\/\/typelevel.org\/cats\/typeclasses.html\">http:\/\/typelevel.org\/cats\/typeclasses.html<\/a>):<\/p>\n<p>  <\/p>\n<ol>\n<li><em>\u041f\u043e\u043b\u0443\u0433\u0440\u0443\u043f\u043f\u0430<\/em> (<code>Semigroup<\/code>) \u2014 \u043e\u0434\u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>combine<\/code>.<\/li>\n<li><em>\u041c\u043e\u043d\u043e\u0438\u0434<\/em> \u2014 \u043f\u043e\u043b\u0443\u0433\u0440\u0443\u043f\u043f\u0430 \u0441 \u043f\u0443\u0441\u0442\u044b\u043c (&quot;\u043d\u0443\u043b\u0435\u0432\u044b\u043c&quot;) \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u2014 <code>empty<\/code>.<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0447\u0438\u0441\u0435\u043b \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e <code>combine<\/code> \u043a\u0430\u043a \u0441\u0443\u043c\u043c\u0443 \u0447\u0438\u0441\u0435\u043b, \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043d\u043e\u043b\u044c. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0430\u0434\u0434\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u043e\u043d\u043e\u0438\u0434. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0438\u043a\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u043e\u043d\u043e\u0438\u0434, \u0435\u0441\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>combine<\/code> \u0432\u0437\u044f\u0442\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435, \u0430 <code>empty<\/code> \u2014 \u0435\u0434\u0438\u043d\u0438\u0446\u0443. \u0421\u043f\u0438\u0441\u043e\u043a \u0447\u0438\u0441\u0435\u043b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u043d\u043e\u0438\u0434. \u0412 \u0440\u043e\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>combine<\/code> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0441\u043a\u043b\u0435\u0439\u043a\u0430 \u0441\u043f\u0438\u0441\u043a\u043e\u0432, \u0430 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u2014 \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a.<\/p>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440:<\/em><br \/>  \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u043d\u043e\u0438\u0434 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u0440\u0430\u0432\u043d\u044b\u043c <code>empty<\/code> \u0438\u0437 \u043c\u043e\u043d\u043e\u0438\u0434\u0430. \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0445 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c <code>combine<\/code> \u0441 \u0442\u0435\u043c\u0438, \u0447\u0442\u043e \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u0442\u0438\u043f <code>Int<\/code> \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439 &quot;\u0441\u0443\u043c\u043c\u0430&quot;. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0443\u043c\u043c\u0430 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0418\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u043c\u043e\u043d\u043e\u0438\u0434 \u0434\u043b\u044f <code>List[T]<\/code>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0432 \u044d\u0442\u043e\u043c \u0441\u043f\u0438\u0441\u043a\u0435 (\u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438, \u043b\u0438\u0431\u043e \u043a\u0430\u0436\u0434\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a). \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u043a\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u043c \u2014 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>combine<\/code> \u0434\u043b\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u043d\u043e\u0432\u044c \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0445. \u0418 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<br \/>  \u0422\u0430\u043a\u0436\u0435, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u0438\u043f \u043d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e \u043e\u043d \u043c\u043e\u043d\u043e\u0438\u0434 (\u0442.\u0435. \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u043c\u043e\u043d\u043e\u0438\u0434 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0438\u043f\u0430), \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>foldLeft<\/code> \u2014 \u0441\u0432\u0451\u0440\u0442\u043a\u0443 \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u043d\u0430\u043c \u043d\u0435 \u043d\u0430\u0434\u043e \u0435\u0451 \u0437\u0430\u043d\u043e\u0432\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c).<\/p>\n<p>  <\/p>\n<h3 id=\"tipy-vysshih-poryadkov\">\u0422\u0438\u043f\u044b \u0432\u044b\u0441\u0448\u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432<\/h3>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0438\u043f\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u0438\u043c\u0435\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. (\u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c, \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0442\u0438\u043f\u043e\u0432 \u0432\u044b\u0441\u0448\u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432 \u0432 \u044f\u0437\u044b\u043a\u0435.) \u0422\u0438\u043f\u044b \u0432\u044b\u0441\u0448\u0438\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u044e\u0442\u0441\u044f kind&#8217;\u043e\u043c \u2014 &quot;\u0442\u0438\u043f\u043e\u043c \u0442\u0438\u043f\u0430&quot;:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0438\u043f \u0438\u043c\u0435\u0435\u0442 kind <code>*<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>Int<\/code>, <code>String<\/code>);<\/li>\n<li>\u0442\u0438\u043f, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u043e\u0434\u0438\u043d \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u2014 <code>* -&gt; *<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>List[T]<\/code>, <code>Option[T]<\/code>, <code>Future[T]<\/code>);<\/li>\n<li>\u0442\u0438\u043f, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u2014 <code>* -&gt; * -&gt; *<\/code> (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>Function1[A,B]<\/code>). (\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0430\u043c\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u0435\u043b\u043a\u0443 <code>A =&gt; B<\/code>, \u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0442\u0438\u043f\u043e\u0432 \u2014 <code>A =&gt; B =&gt; (A=&gt;B)<\/code> \u2014 \u0434\u0432\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438 (\u0442\u0440\u0435\u0442\u044c\u044f \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043a\u0430 \u2014 \u0443\u0436\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430).)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 cats \u043a\u0440\u043e\u043c\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438, \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0442\u0438\u043f\u043e\u0432. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>* -&gt; *<\/code>:<\/p>\n<p>  <\/p>\n<ol>\n<li><em>\u0424\u0443\u043d\u043a\u0442\u043e\u0440<\/em> \u2014 \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u0434\u043d\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u2014 <code>map<\/code>. \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0438\u043f\u0430 <code>List[Int]<\/code>\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443. \u0414\u043b\u044f <code>List<\/code>&#8216;\u0430 \u0438 \u0434\u043b\u044f <code>Option<\/code>, \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u0432\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u0443\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u0441\u0430\u043c\u043e\u043c \u0442\u0438\u043f\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>map<\/code>, \u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c.<\/li>\n<li><em>\u041c\u043e\u043d\u0430\u0434\u0430<\/em> \u2014 \u0444\u0443\u043d\u043a\u0442\u043e\u0440, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e <code>flatMap<\/code>, \u0438\u043b\u0438 <code>bind<\/code>, \u0438\u043b\u0438 <code>&gt;&gt;=<\/code> (\u0430 \u0442\u0430\u043a\u0436\u0435 <code>flatten<\/code>, <code>map<\/code>, <code>pure<\/code>). \u042d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430, \u043f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u0441\u0430\u043c\u044b\u0439 \u0437\u043d\u0430\u043c\u0435\u043d\u0438\u0442\u044b\u0439. \u0415\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u0430 \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u043b\u0435\u043d\u0430 \u0442\u0435\u043c \u0444\u0430\u043a\u0442\u043e\u043c, \u0447\u0442\u043e <code>flatMap<\/code> (<code>bind<\/code>) \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0441\u043a\u043b\u0435\u0439\u043a\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. \u041d\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>flatMap<\/code> \u0434\u0430\u0436\u0435 \u043e\u0441\u043d\u043e\u0432\u0430\u043d &quot;\u0441\u0430\u0445\u0430\u0440&quot; \u0432 Scala \u2014 for-comprehension.<\/li>\n<\/ol>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440:<\/em><\/p>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043f\u0438\u0441\u043a\u043e\u0432. \u0421\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435\u0445 \u0434\u0435\u0442\u0435\u0439 \u0434\u043b\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u2014 <code>val allChildren = objects.flatMap(_.children)<\/code><\/li>\n<li>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439: <code>val street = personOpt.flatMap(_.addressOpt).flatMap(_.streetOpt)<\/code><\/li>\n<li>\u041e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041f\u0443\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 \u0411\u0414 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0442\u0438\u043f\u043e\u043c <code>DataTable[T]<\/code>. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>flatMap<\/code> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0449\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0422\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043a\u043b\u0435\u0438\u0442\u044c \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443, <em>\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0435\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432<\/em>. \u0421\u043a\u043b\u0435\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 SQL \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 \u0411\u0414 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0421\u0423\u0411\u0414. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 Slick.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u0438\u043f\u043e\u0432 <code>* -&gt; * -&gt; *<\/code> \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 cats \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li><em>\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f<\/em> \u2014 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>compose<\/code> + &quot;\u043d\u0443\u043b\u0435\u0432\u043e\u0439&quot; \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u2014 <code>identity<\/code>. \u0422\u0438\u043f, \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 &quot;\u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f&quot;, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f &quot;\u0441\u0442\u0440\u0435\u043b\u043a\u043e\u0439&quot; (Arrow). \u0421\u0442\u0440\u0435\u043b\u043a\u0438 \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>compose<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0443 <code>andThen<\/code>, \u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f <code>identity<\/code> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>identity<\/code>. <\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/li>\n<li>\u041c\u043e\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u0432 \u043c\u043e\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u044f\u0437\u044b\u043a\u0435).<\/li>\n<li>\u041b\u0438\u043d\u0437\u044b (\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u043e\u0442\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u043e\u0432) (\u0441\u043c. \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/julien-truffaut\/Monocle\">monocle<\/a>).<\/li>\n<li>\u041d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444 \u0432 Functional Reactive Programming (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/Primetalk\/SynapseGrid\">SynapseGrid<\/a>).<\/li>\n<\/ol>\n<p>  <\/p>\n<p><em>\u041f\u0440\u0438\u043c\u0435\u0440:<\/em><br \/>  \u0414\u043b\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>compose<\/code>. \u0422.\u0435. \u0435\u0441\u043b\u0438 \u043d\u0430\u0448 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0443\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 compose, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u044d\u0442\u043e\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439.<br \/>  \u041f\u0443\u0441\u0442\u044c \u043c\u044b \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e DSL. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0442\u0438\u043f\u043e\u043c <code>Transform[A,B]<\/code>. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0444\u0430\u043d\u0442\u043e\u043c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<p><code>A<\/code> \u0438 <code>B<\/code> \u2014 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0438\u043f\u044b \u0438\u0437 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 <em>\u0444\u0430\u043d\u0442\u043e\u043c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b<\/em>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u043d\u0442\u043e\u043c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0451\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c. \u0422.\u0435. \u043c\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>compose<\/code> \u0434\u043b\u044f \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439.<\/p>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043e\u043f\u0438\u0441\u0430\u043b \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e DSL, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0443\u0436\u0435 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u043d\u0430\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 (\u043c\u043e\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439) \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e (\u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439) \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%95%D1%81%D1%82%D0%B5%D1%81%D1%82%D0%B2%D0%B5%D0%BD%D0%BD%D0%BE%D0%B5_%D0%BF%D1%80%D0%B5%D0%BE%D0%B1%D1%80%D0%B0%D0%B7%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5\">&quot;\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c&quot;<\/a>.<\/p>\n<p>  <\/p>\n<h4 id=\"zakony-dlya-klassov-tipov\">\u0417\u0430\u043a\u043e\u043d\u044b \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432<\/h4>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 cats, \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u044e\u0442 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u044b \u044d\u0442\u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0442\u0435\u043e\u0440\u0438\u0438). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043c\u043e\u043d\u043e\u0438\u0434\u0430:<\/p>\n<p>  <\/p>\n<ol>\n<li><code>a combine empty = a = empty combine a<\/code> \u2014 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430<\/li>\n<li><code>(a combine b) combine c = a combine (b combine c)<\/code> \u2014 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 <code>combine<\/code><\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0432\u0438\u0434\u0435 &quot;\u0437\u0430\u043a\u043e\u043d\u043e\u0432&quot; \u2014 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 &quot;\u0441\u0432\u043e\u0439\u0441\u0442\u0432&quot; \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <a href=\"https:\/\/scalacheck.org\/\">ScalaCheck<\/a>. \u0418 \u043c\u043e\u0436\u043d\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0442\u0438\u043f\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e\u0442 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c, \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u043a \u044d\u0442\u043e\u043c\u0443 \u043a\u043b\u0430\u0441\u0441\u0443 \u0442\u0438\u043f\u0430. \u041c\u043d\u043e\u0433\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u044d\u0442\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u044d\u0442\u0438 \u0437\u0430\u043a\u043e\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432 unit test&#8217;\u0430\u0445.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u043d\u0430\u0448\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u0438\u043c\u0435\u044e\u0449\u0438\u043c\u0441\u044f \u0437\u0430\u043a\u043e\u043d\u0430\u043c, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0442\u044c \u0432 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0432 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043e\u043f\u0438\u0440\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043d\u0430 \u044d\u0442\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  <\/p>\n<h4 id=\"preimuschestva-klassov-tipov\">\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432<\/h4>\n<p>  <\/p>\n<p>\u041f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0432 \u043f\u043e\u0442\u043e\u043c\u043a\u0430\u0445, \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0438\u043f\u043e\u0432 \u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u043c\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430;<\/li>\n<li>\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0435 \u0441 \u043d\u0443\u043b\u0435\u0432\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043c\u0435\u0442\u043e\u0434 <code>empty: T<\/code>, \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <code>parse: String =&gt; T<\/code>;<\/li>\n<li>\u043c\u043e\u0436\u043d\u043e \u0438\u043d\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f <code>Option[T]<\/code> \u0438\u043b\u0438 \u0434\u043b\u044f <code>A \\\/ B<\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u042d\u0442\u0438\u043c\u0438 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 cats (\u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 scalaz) \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 (\u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0435\u0441\u044c\u043c\u0430 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 \u0438 \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0432\u0430\u043b\u0438\u0434\u0438\u0440\u043e\u0432\u0430\u043d \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0439 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0435\u043e\u0440\u0438\u0438.<\/p>\n<p> \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:\/\/habrahabr.ru\/post\/318960\/\"> https:\/\/habrahabr.ru\/post\/318960\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438 \u0441\u043b\u043e\u0432\u0435 &quot;\u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c&quot; \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u0442\u043e\u043b\u043f\u043e\u0432 (<a href=\"https:\/\/habrahabr.ru\/post\/37576\/\">\u041f\u043e\u043b\u0438\u043c\u043e\u0440\u0444\u0438\u0437\u043c \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445<\/a>). (\u041f\u0440\u0438\u0447\u0451\u043c, \u043f\u043e-\u0432\u0438\u0434\u0438\u043c\u043e\u043c\u0443, \u0431\u043e\u043b\u0435\u0435 \u0432\u0430\u0436\u043d\u044b\u043c, \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0442\u043e\u043b\u043f\u044b.) \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u0430 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0451\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0440\u044f\u0434\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0442\u0438\u043f\u0430\u043c, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u043a\u0430, \u0438\u043b\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0438\u043f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, &quot;\u0440\u0435\u0448\u0438\u0442\u044c&quot; \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f.<\/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-283471","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283471","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=283471"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/283471\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}