Hello!
We begin to publish conversations with speakers
FPConf 2017 .
Pavel Argentov asked the most incendiary of the evangelist of OP and Haskell
Denis Shevchenko .

')
At the beginning of the conversation - tell a little about yourself.My name is Denis Shevchenko. I am the founder of the ruHaskell community. At the moment, I have Haskell developer at IOHK. The former C ++ is a developer, now Haskelist, a beginner in the OP-evangelist and the author of the unfinished book “Haskell humanly”.
In the world ocean of programming, the OP is elevated by an inaccessible continent, which everyone perceives as an abode for people who are unattainably intelligent. A sort of “ivory tower”. FP is studied in serious universities. At the same time, there is a thesis that the FP can be useful for the programmer's universe as a whole. How would you define this utility?It is already impossible not to notice that interest in functional languages ​​(for example, in Haskell) is currently growing. They talk about them more and more, they write about them more often. In addition, functional languages ​​are also taught in Russian universities. But more importantly, I see this tendency in the last three years - functional programming ceases to be elite, as it was many years ago. Previously, yes, it was something “elephant bones”, non-heavenly, academic, and therefore very difficult for most ordinary people. Today, fortunately, this is no longer the case. Today, people entering the world of FP are beginning to successfully use it in their projects without having the notorious Ph.D. in mathematics and other regalia. The OP is not only practical; it is superbly applied in practice. For example, I myself am involved in a not very standard, but very practical project, where the FP is successfully applied. The number of teams that use Haskell, not only in complex but also in ordinary tasks, is slowly but steadily growing around the world. The functional paradigm provides concrete advantages that can be seen, measured and touched.
In the world of Ruby-web development available to me for direct observation, there are now a lot of moves towards the use of immunity, composability, and pure functions. It turns out interesting solutions that make the code compact, predictable and accessible for reasonable analysis. It turns out that the FP penetrates into the area that was originally the domain of procedural programming. What can you say about how useful the FP is for developing a programmer's thinking?At one time, I decided to get acquainted with the OP in order to expand my horizons and, in a certain way, to become smarter. Yes, FP changes consciousness, and changes strongly, because it is based on ideas from mathematics. There is a famous aphorism “Mathematics should be taught then, that it brings the mind in order”. Functional concepts are actively included in mainstream languages. These ideas are really good, otherwise why would people use them where they never were? Take Java and C ++, for example. Billions of lines of code are written in these languages ​​all over the world. Why did they add the same lambda functions in C ++? People just understood that FP concepts are good, and they are good not because someone said this at a fashion conference, but because the practice of daily development proves it. Well, when we can argue about the correctness of the code. Well, when this correctness can be reliably verified. Well, when we know that the code is not able to give us unexpected surprises. In this sense, I am absolutely sure that the FP helps the programmer to develop as a whole, regardless of language. However, I do not agree with those who sing the praises of functional programming too much. Studying an OP will not make a programming genius from an average developer, but it will undoubtedly give it a step in development, expand its horizons and allow, let's say, more correct to talk about current problems.
From the height of my three-year experience of using Haskell in living projects, I can say that Haskell can be useful for programmers from the world of imperative languages ​​in the same way that it brings the same mathematical beauty into everyday practice. As mentioned earlier, functional programming, having absorbed the spirit of mathematics, fenced off itself with an aura of complexity and excessive theoreticality, and, as a result, a myth about a high threshold of entry. Many developers still think that Haskell is poorly applicable in practice (or not applicable at all). This image today, though slowly, but successfully destroyed. Haskell, remaining purely functional language, showed its applicability in practice. The point is in its developed ecosystem, and in its convenience for solving a wide range of tasks. Few of the functional languages ​​can boast such a large number of libraries, and this is one of the indicators that developers are looking at, wondering whether you can use the language in a real project. Haskell is a living proof that the FP is great for production.
What are some specific examples of using Haskell in live projects? I heard an excellent definition: “Haskell is a great language for writing short and correct programs.” How does this definition rhyme with what you say?Haskell has a lot of success stories. In the definition you cited, we can safely replace the word “short” with “very large”. What are “very big” programs in the case of Haskell? Let me give you a canonical example - the international bank “Standard Chartered Bank”, headquartered in London. He works in the markets of Asia and Africa. Much of the infrastructure of this bank is implemented in Haskell. It all started with the fact that several very serious Haskell-specialists were hired by the bank’s team, such as Don Stewart, who gathered a team of cool developers around him. Prior to this, the entire infrastructure was written in C ++, C # and Java. The Stewart team was given the opportunity to rewrite part of the infrastructure in Haskell. It was a very tough condition - to ensure that the infrastructure on Haskell will be five times cheaper to maintain and as much more efficient than what is written now. And in the end they did it! Today, the bank continues to work successfully with a large part of the infrastructure built on Haskell. We all hear HYIP around Big Data and Highload, and after all, the infrastructure of an international bank by its very nature is both Big Data and Highload. If Haskell can exist there, then it is no longer necessary to talk about its inapplicability in serious production.
The second example is part of the Facebook backend written in Haskell. Naturally, there are other languages, the same OCaml. An interesting example is the use of Haskell in an online spam filter module. A tool written in Haskell / C ++ blends time to process up to a million messages per second. I don’t know exactly what percentage of Haskell is in this tool, but I know for sure that the green threads from Haskell are massively involved there. But the most important thing is that you don’t have to be Google or Facebook to get the benefits of a functional language.
Or take another HYIP theme - blockchain solutions. Haskell today proved to be a great tool for the implementation of such systems, as evidenced by the experience of our company. Personally, I think that today Haskell, if not the best, is certainly one of the best languages ​​for implementing any blockchain systems.
Your report will be about the blockchain system implemented on Haskell with your participation. Tell us exactly what advantages we get in the blockchain from the functional paradigm - and from Haskell in particular?The functional paradigm in general, and Haskell in particular, have several such cornerstones that we remember when we are asked what is so special about it, in this your OP. There are several fundamental characteristics, especially pronounced in Haskell, and they all fit perfectly on the blockchain system. For example, Haskell, being an immutable language, is superbly parallelized and just as perfectly executed competitively. And we know that in a regular web application, parallelism is not always important. However, each node of the parallelized blockchain network (and their number can be measured in hundreds of millions) produces a huge amount of computational work. Each node must follow a number of tasks independent of each other, and we would like it to do this as efficiently as possible, and using a minimum of resources. But this is precisely the area in which Haskell has shown itself brilliantly! As a result, such a node does a lot at the same time - and this does not drive the coolers on your computer crazy.
Further, speaking of cryptocurrency, we mean reliability and security. When it comes to handling large amounts of other people's money, we want everything to work reliably and stably. In this path, Haskell also shows its strengths. When we send money, we want to be sure that they will go to the addressee, and not to someone else, and therefore we want to be sure that the corresponding code is correct. And it is here that Haskell’s academic advantages — such as strong static typing — lie down in practice, and we can be sure of aspects of code correctness that we could never be sure of when using most other languages. When in our code all functions that can give unpleasant surprises are strictly separated from pure functions, we can reason about the code in a way that most other languages ​​could not use (languages ​​where anything can happen in each function). In addition, we can add tools such as Liquid Haskell over Haskell code, which will help us to take a step towards dependent types, in which case we will be able to catch even more errors and prevent them from penetrating into production.
About security. I am not very strong in the aspects of cryptographic protection, but I can say with the words of our writers - the authors of our protocol: “We want to be sure that everything that is written in our whitepaper will be accurately implemented. That all beautiful mathematical theory will correctly fall into practice, into a specific application. ”Making the choice, we understood that some languages ​​are better for this, others worse. Therefore, from the very beginning, it was decided in favor of Haskell, and over time we have repeatedly seen the correctness of this decision.
In conclusion, how can we motivate not only developers, but also managers and managers to work with the FI?My most important message for ordinary developers - do not be afraid! Functional programming has never been scary, and today it is easier to see this than ever before. Try to find out what it is. At the upcoming conference, 9 of 19 reports will be devoted to the language of Haskell. This begs the question: why do people from different companies use the same language? Do not be afraid to learn more about it. Recently, I was at a conference in Saratov, and there many ordinary developers were interested in Haskell. I gave them the same advice - do not be afraid, you will be pleasantly surprised that there is nothing terrible in Haskell. The main message is not technical, but mental. Stop being afraid how I stopped at the time.
Interestingly, in the same place, in Saratov, managers and general directors were interested in the Haskell language. The main questions were “Where can I get Haskell specialists?” And “How many companies in Russia are successfully applying Haskell in their business?” I said that I personally know five such places. I was told that it is too little. And this is true, but a little earlier there was exactly zero. And because the most important promise for managers is the same - do not be afraid! Do not be afraid to learn more about Haskell.
Yes, there is fear about the team. Where and how to search for people? If, for example, a Haskell specialist leaves, where to find a new one? I want to please you: today in Russia to hire Haskell-developers is much easier than to look for work related to Haskell. There are much more people who would like to use this language in their daily work than there are real vacancies. That is why any such vacancy is immediately noticed. Try to translate some part of your project into functional languages, and evaluate the benefits - technical, organizational.
But there is another aspect, the psychological one. Many developers would like to use functional languages ​​not only because they provide technical advantages, but also because it’s great, it’s “just for fun”, as Torvalds said. Many managers face the challenge of motivation. “Sit” in one mainstream language year after year - it annoys you. The OP is also an opportunity to bring the very fun and newness into everyday work. It is thanks to the novelty that many programmers want to learn and use such tools. Therefore, I will repeat my main message to the leaders - do not be afraid! There are many more people in Russia who are interested in Haskell and use it for their research and training projects than it might seem. Do not be afraid to try!
Interesting? Learn more from Denis will be on December 2 at
FPConf , come!