> Instead, developers should seriously consider a completely fundamentalist option as well: embrace pure lazy functional programming with all effects explicitly surfaced in the type system using monads.
One often cited benefit of pure functional programming is that pure code is easier to test and reason about, both formally and informally. However, real programs have side-effects including state management, exceptions and interactions with the outside world. Haskell solves this problem using monads to capture details of possibly side-effecting computations â it provides monads for capturing State, I/O, exceptions, non-determinism, libraries for practical purposes such as CGI and parsing, and many others, as well as monad transformers for combining multiple effects.
Unfortunately, useful as monads are, they do not compose very well. Monad transformers can quickly become unwieldy when there are lots of effects to manage, leading to a temptation in larger programs to combine everything into one coarse-grained state and exception monad. In this paper I describe an alternative approach based on handling algebraic effects, implemented in the IDRIS programming language. I show how to describe side effecting computations, how to write programs which compose multiple fine-grained effects, and how, using dependent types, we can use this approach to reason about states in effectful programs.
> monad transformers for combining multiple effects.
This is a Haskell problem, not the fundamental one.
doFiles::forall e. Eff (fs::FS, console::CONSOLE|e) Unit doHttp::forall e. Eff (http::HTTP, console::CONSOLE|e) Unit
doStuff::forall e. Eff (fs::FS, console::CONSOLE, http::HTTP|e) Unit doFiles <<< doHTTP
You can also handle effect, which means you remove the effect from the row and once you get to the Eff () you can runPure and transform the effectful computation into the pure one. Bingo.
More like IO with refinement on top of it, innit? But there are other encodings of effects that do not involve monads and, according to rumour, are composable (for some values thereof). I believe F* featured something like that, they even had Div or somesuch for divergence.
Yes, parameterized by list (set?) of effects that occurred. I think this should be possible in Haskell too, with some existing or plausible extension. Need to think about it.
DataKinds and friends should be enough methinks, at least for a rough approximation of this. Is type inference for this decidable, though? Type checking should be.
Yes, it does. But it is parametrized with either an open or closed row of effects and thus Eff (console::CONSOLE) doesn't compose with Eff (fs::FS). By opening and closing the row and adding and removing effects I can control the composability. This is also not fine-grained enough (esp. with the "inflation of effects" when everybody and their grandmother invents new type of effect which implicitly may include others) but it's much, MUCH, more fine-grained than IO() which is just "some IO" who knows what it does.
ÐÑÑгой конеÑно, один Scott (https://en.wikipedia.org/wiki/Scott_Meyers), ÑÑоÑой Erik (https://en.wikipedia.org/wiki/Erik_Meijer_(computer_scientist)).
"His 1992 dissertation at the University of Nijmegen offered a mathematical justification for what would later become known as Language Integrated Query (LINQ), the important .NET technology that smoothes out differences in data forms by identifying a common set of operations that work across all data. Meijer's acclaimed work on lightweight code generation, the C# language extension C-Omega, and C# 3.0 and Visual Basic 9, has helped bridge object-oriented, relational, and hierarchical data typesâthe three major contemporary data models that prevail in the industry today." https://www.microsoft.com/about/technicalrecognition/erik-meijer.aspx
no subject
ÐÑÑÑ ÑÐ°ÐºÐ°Ñ Ð²ÐµÑÑ "R Inferno", Patric Burns. Ðак Ñаз о ÑмеÑном.
ÐеÑколÑко ÑмоÑионалÑно и вÑеменами ÑоваÑÐ¸Ñ Ð½Ð°Ð³Ð½ÐµÑаеÑ, но на оглавление глÑнÑÑÑ Ð²ÐµÑÑма познаваÑелÑно.
no subject
no subject
no subject
no subject
ÐоÑ, допÑÑÑим еÑÑÑ Ð½Ð¾Ð²Ñй коммеÑÑеÑкий гÑинÑилд ÑнÑеÑпÑайз пÑоекÑ.
Ðа ÑÑм его пиÑаÑÑ ? ÐеÑжели на Ñ Ð°Ñкеле, без ide Ñ Ð³Ð¸Ð³Ð°Ð±Ð°Ð¹Ñами оÑложеннÑÑ Ð²ÑÑиÑлений?
no subject
Ðе понÑл поÑÐµÐ¼Ñ Ð¾Ð±ÑзаÑелÑно Lazy и поÑÐµÐ¼Ñ ÑÑÑекÑÑ Ð¾Ð±ÑзаÑелÑно Ð´Ð¾Ð»Ð¶Ð½Ñ Ð¾Ð¿Ð¸ÑÑваÑÑÑÑ Ð² манаÑÐºÐ°Ñ .
ÐÐ¾Ñ Ð¾Ð¶Ðµ на какое-Ñо ÑанбойÑÑво
no subject
Ðе знаÑ, можно ли поÑÑиÑаÑÑ ÑÑ
One often cited benefit of pure functional programming is that pure code is easier to test and reason about, both formally and informally.
However, real programs have side-effects including state management, exceptions and interactions with the outside world.
Haskell solves this problem using monads to capture details of possibly side-effecting computations â it provides monads for capturing State, I/O, exceptions, non-determinism, libraries for practical purposes such as CGI and parsing, and many others, as well as monad transformers for combining multiple effects.
Unfortunately, useful as monads are, they do not compose very well. Monad transformers can quickly become unwieldy when there are lots of effects to manage, leading to a temptation in larger programs to combine everything into one coarse-grained state and exception monad. In this paper I describe an alternative approach based on handling algebraic effects, implemented in the IDRIS programming language. I show how to describe side effecting computations, how to write programs which compose multiple fine-grained effects, and how, using dependent types, we can use
this approach to reason about states in effectful programs.
Re: Ðе знаÑ, можно ли поÑÑиÑаÑÑ Ñ
Re: Ðе знаÑ, можно ли поÑÑиÑаÑÑ Ñ
Monads do not, but effects perfectly do as soon as you get effect rows.
Re: Ðе знаÑ, можно ли поÑÑиÑаÑÑ Ñ
This is a Haskell problem, not the fundamental one.
doFiles::forall e. Eff (fs::FS, console::CONSOLE|e) Unit
doHttp::forall e. Eff (http::HTTP, console::CONSOLE|e) Unit
doStuff::forall e. Eff (fs::FS, console::CONSOLE, http::HTTP|e) Unit
doFiles <<< doHTTP
You can also handle effect, which means you remove the effect from the row and once you get to the Eff () you can runPure and transform the effectful computation into the pure one. Bingo.
RE: Re: Ðе знаÑ, можно ли поÑÑиÑаÑÑ
no subject
no subject
no subject
Re: Re: Ðе знаÑ, можно ли поÑÑиÑаÑÑ
Re: Re: Ðе знаÑ, можно ли поÑÑиÑаÑÑ
no subject
no subject
no subject
ÐÑавилÑнÑй, но неинÑеÑеÑнÑй вÑвод из ÑÑого â на C# Ñ Ð»Ñмбдами можно напиÑаÑÑ ÐºÐ¾Ð´ Ñ Ð±Ð°Ð³Ð°Ð¼Ð¸.
ÐÐ°ÐºÐ°Ñ Ð½ÐµÐ¾Ð¶Ð¸Ð´Ð°Ð½Ð½Ð¾ÑÑÑ! Шо, Ñже пÑидÑмали ÑзÑк, на коÑоÑом нелÑÐ·Ñ Ñак?
ÐÑÑÐ°Ñ Ð¶Ðµ Ð´ÐµÐ»Ð°ÐµÑ ÑÑÑаннÑй вÑвод о Ñом, ÑÑо конÑепÑÐ¸Ñ Ð½Ðµ ÑабоÑаеÑ.
Functional programming заÑаÑили нÑнÑе во вÑе импеÑаÑивнÑе ÑзÑки ÑовÑем не Ñади safety, как поÑемÑ-Ñо ÑеÑил аÑÑаÑ, а поÑÐ¾Ð¼Ñ ÑÑо ÑÑнкÑионалÑнÑе абÑÑÑакÑии Ð´Ð»Ñ Ð½ÐµÐºÐ¾ÑоÑÑÑ Ð·Ð°Ð´Ð°Ñ Ð¾ÑÐµÐ½Ñ Ñ Ð¾ÑоÑо Ð¿Ð¾Ð´Ñ Ð¾Ð´ÑÑ.
Ðногда можно напиÑаÑÑ Ð½ÐµÐ¼Ð½Ð¾Ð³Ð¾ пÑоÑÑого ÑÑнкÑионалÑного кода вмеÑÑо кÑÑи Ñложного импеÑаÑивного.
Ðногда пÑоизводиÑелÑноÑÑÑ Ð»ÑÑÑе ÑÑановиÑÑÑ.
Ðногда API design ÑилÑно ÑпÑоÑаеÑÑÑ.
ÐнÑеÑеÑно, оÑкÑда аÑÑÐ°Ñ Ð²Ð·Ñл Ð¸Ð´ÐµÑ Ð¾ Ñом, Ñо еÑли impure, Ñо ÑÑÐ°Ð·Ñ unfeasible?
no subject
Ркак ÑзнаÑÑ, ÑÑо Ñам в киÑÐºÐ°Ñ ÑвоÑиÑÑÑ? ÐÑÑÑ ÐµÑÑÑ f и g, можно ли Ð¸Ñ Ð²ÑполнÑÑÑ Ð² лÑбом поÑÑдке, можно ли Ð¸Ñ Ð²ÑполнÑÑÑ Ð¿Ð°ÑÑалелÑно?
no subject
РоÑкÑда Ñ Ð²Ð°Ñ ÑÑÑемление Ð¸Ñ Ð²ÑполниÑÑ?
ÐÐ¾Ñ Ð¾Ð¶Ðµ Ñ Ð²Ð°Ñ ÐµÑÑÑ ÐºÐ°ÐºÐ¸Ðµ-Ñо ожиданиÑ, Ñо именно они вÑÑиÑлÑÑÑ. ÐÑкÑда?
ÐÐ¾Ñ Ð¾ÑÑÑда же Ð²Ñ Ð¼Ð¾Ð¶ÐµÑе ÑзнаÑÑ, можно ли Ð¸Ñ Ð¿Ð°ÑаллелÑно.
ÐÑли Ñами напиÑали, Ð²Ñ Ð¸ Ñак веÑоÑÑно в кÑÑÑе.
ÐÑли SDK/библиоÑека, ÑиÑайÑе докÑменÑаÑиÑ.
ÐÑли untrusted код, Ñ Ð²Ð°Ð¼ не ÑовеÑÑÑ Ð²ÑполнÑÑÑ Ð½Ð¸ Ð¾Ð´Ð½Ñ Ð¸Ð· Ð½Ð¸Ñ , ÑовеÑÑенно незавиÑимо Ð¾Ñ ÑзÑка и ÑанÑайма. Разве ÑÑо в Ñ Ð¾ÑоÑей пеÑоÑниÑе (CLR + sandbox, или пÑоÑеÑÑ Ñ Ð·Ð°ÐºÑÑÑеннÑми пÑавами, или Ñж VmWare/HyperV/Xen), и Ñо Ñ Ð¾Ð³Ð¾Ð²Ð¾Ñками.
no subject
ÐаÑа команда напиÑала. ÐоллекÑивное ÑвоÑÑеÑÑво. Ðолгода назад Ð·Ð°Ñ Ð¾ÑелоÑÑ Ð½ÐµÑколÑко копий f запÑÑкаÑÑ, каждÑÑ Ð² Ñвоем ÑÑеде. ÐÑиÑлоÑÑ Ð¿ÑоÑмаÑÑиваÑÑ Ð²ÐµÑÑ ÐºÐ¾Ð´.
no subject
Тогда оÑÐ²ÐµÑ Ð½Ð° ваÑи вопÑоÑÑ Ð²ÑÑе оÑевиден.
>можно ли Ð¸Ñ Ð²ÑполнÑÑÑ Ð² лÑбом поÑÑдке, можно ли Ð¸Ñ Ð²ÑполнÑÑÑ Ð¿Ð°ÑÑалелÑно?
ÐеÑ, ваÑи ÑÑнкÑии нелÑÐ·Ñ Ð²ÑполнÑÑÑ Ð¿Ð°ÑаллелÑно.
ÐлÑо Ð²Ñ Ð¼Ð¾Ð³Ð»Ð¸ не пÑоÑмаÑÑиваÑÑ Ð²ÐµÑÑ ÐºÐ¾Ð´, а поÑиниÑÑ ÑÑнкÑии, Ñделав Ð¸Ñ thread safe.
no subject
ÐÑÑÑ Ð¼Ð¸Ð»Ð»Ð¸Ð°Ñд ÑÑнкÑий, какие-Ñо можно вÑполнÑÑÑ Ð² одном поÑоке, какие-Ñо неÑ.
> ÐеÑ, ваÑи ÑÑнкÑии нелÑÐ·Ñ Ð²ÑполнÑÑÑ Ð¿Ð°ÑаллелÑно.
ÐказалоÑÑ, ÑÑо можно (Ð½Ñ Ð¸Ð»Ð¸ Ñ ÑовÑем немного поменÑл, ÑÑÐ¾Ð±Ñ Ð±Ñло можно).
> а поÑиниÑÑ
Ðга, веÑÑ Ð¼Ð¸Ð»Ð»Ð¸Ð°Ñд. РеÑли ÑÑÐ°Ð·Ñ Ð¿Ð¸ÑаÑÑ Ð²Ñе thread safe, Ñо полÑÑиÑÑÑ Ñо, пÑо ÑÑо напиÑано по ÑÑÑлке в поÑÑе.
no subject
под каждÑм Ñловом!
> ÐÑÑÐ°Ñ Ð¿ÑÐ¸Ð²Ð¾Ð´Ð¸Ñ Ð¿ÑимеÑÑ ÐºÐ¾Ð´Ð° Ñ Ð¿ÑоÑÑÑми багами, коÑоÑÑе
> обнаÑÑживаÑÑÑÑ Ð·Ð° 1 минÑÑÑ Ñ Ð¾ÑладÑиком, и еÑÑ Ð·Ð° минÑÑÑ
> ÑинÑÑÑÑ.
в конÑе конÑов, Ñ Ð½Ðµ знаÑ... еÑли полÑзÑеÑÑÑÑ deferred execution меÑодом - можно Ð±Ñ Ð¸ помниÑÑ, ÑÑо Ñ Ð½ÐµÐ³Ð¾ ÑÐ°ÐºÐ°Ñ Ð¾ÑобенноÑÑÑ
и не делаÑÑ Ð³Ð»ÑпоÑÑей ÑÑазÑ, до оÑладÑика
no subject
как и вÑÑÐºÐ°Ñ - оÑнованнаÑ, ÑÑÑÑ Ð±Ð¾Ð»ÐµÐµ Ñем полноÑÑÑÑ, на:
I) ложной индÑкÑии
II) паÑÑеÑне
1. do this
2. do that
3. do something else
4. ....
5. PROFIT!
ÐÐ Ñ Ð¿ÑавилÑно понÑл (из, напÑимеÑ, википедии): ÑÑÐ¾Ñ ÑÑемп, авÑоÑ-Ñо - он звезда ÑомпÑкÑÐµÑ ÑÑиенÑ?
ÑважаемÑй ÑпеÑиалиÑÑ?
no subject
no subject
опÑÑÑ Ð¿Ð¾Ð´Ð¾Ð±Ð½Ñй ÑлÑÑÑ?
ÐЫ вообÑе, конеÑно, мало ебаÑÐ°Ñ Ð»Ñдей палками за лÑбое пÑоÑвление Ñелигиозного ÑознаниÑ, пока маленÑкие
Ð¾Ñ , мало
Ð¾Ñ Ð¾Ð½Ð¾ поÑом и вÑлазиÑ
ÐÐЫ Ñ Ð¾ÑоÑо еÑе еÑли в ÑоÑалÑнÑÑ ÑизоÑÑÐµÐ½Ð¸Ñ Ð½Ðµ пеÑÐµÑ Ð¾Ð´Ð¸Ñ, как Ñ Ð±ÐµÑноваÑого ÐакÑимки
no subject
no subject
no subject
no subject
no subject
no subject
"His 1992 dissertation at the University of Nijmegen offered a mathematical justification for what would later become known as Language Integrated Query (LINQ), the important .NET technology that smoothes out differences in data forms by identifying a common set of operations that work across all data. Meijer's acclaimed work on lightweight code generation, the C# language extension C-Omega, and C# 3.0 and Visual Basic 9, has helped bridge object-oriented, relational, and hierarchical data typesâthe three major contemporary data models that prevail in the industry today."
https://www.microsoft.com/about/technicalrecognition/erik-meijer.aspx
no subject
no subject
no subject