Interview with Vitaliy Bragilevsky: “The world in which everyone will program in Haskell is hardly a good world”

Interview with Vitaliy Bragilevsky: “The world in which everyone will program in Haskell is hardly a good world”




Vitaly Bragilevsky ( @_bravit ) still teaches courses at Hasfell and Algorithm Theory at HFU. He also provides on-site courses in other cities, is the editor and translator of many books about Haskell and functional programming, is on the Haskell 2020 and GHC compiler committees and actively speaks at conferences. For example, he will read a short course on Haskell compiler building at a functional conference FPURE in Kazan.

Due to such a huge amount of activities, the final record went for almost an hour ( link to audio )! Below you can read its text decoding, where Vitaly talks about the pros of a teacher’s career, many books about Haskell and not only and, of course, about Haskell itself, and whether you need to be a genius to write in this language.

- How did you manage to become a teacher? According to your activity, the number of speeches at conferences, you do not look like an ordinary teacher.
In my past, teachers were not like that.


- Well, teachers change. And I must say, of course, this activity is really not very typical. But I always wanted to be a teacher. Probably, when I was still in school, I introduced myself as a teacher and thought about how I would teach this better than those who teach me. And somehow it went.

When I was in my third year at university, I began teaching at the lyceum school that I graduated from. And when he finished studying at the university, he began teaching at the university. This was a very natural way, and then I did not represent myself to anyone else. Therefore, for me this way is simple, direct, and I had no options: I always wanted this, and began to teach.

- How did it come to the institute? Was the specialty you studied in programming?

- I graduated from Rostov State University in the field of “Applied Mathematics and Computer Science”.

We studied a lot of applied mathematics, but there was already a lot of programming training there. So yes, I can say that I studied as a programmer.

Many of my classmates, who went along the programmer line, are now working as some kind of programmer bosses.

- You then stayed in the same place and went to graduate school?

- Yes, I stayed at the same university. I have not studied in graduate school. And I was not engaged in scientific activities. There were some attempts, but to say that I was engaged in purposefully science, I can not. I had affairs all the time that seemed more interesting to me than science. It was also superimposed on the fact that there were no areas of science that were interesting to me in our country. And you can say that there is still no. And I could not do science remotely, without guidance, on my own, practically.


- And if you take from practice, do we have something in common with compilers in Novosibirsk only?

“Compilers are a little different after all. Compiler school in our country is quite strong, but I was interested in more theoretical things. For example, associated with types.

If we take Dragon Book , then there theory Types devoted a small chapter and nothing really is not there.Giant sections on parsing for all such things, but what I’m interested in is not there ...

When I graduated from university, it attracted me, but no more. I was more interested in learning theoretical things. And so it turned out that I studied them. But it was pure self-education. Without a specific result, without exhaust in the form of scientific work.

- And what of the books on this topic could be read then? Pierce?

- If I'm not mistaken, Pierce ( TAPL - Types and Programming Languages ​​) was released in English in 2005- ohm Then he was translated into Russian, and the publisher then sent us a parcel to the department, where there were 5-6 of these books translated into Russian. We had seminars at which we all slowly studied, gave reports, solved problems.

But before that, there were also books in English. There is a great way to learn something — to tell another about it. And I did a course on the use of λ-calculus for modeling different constructions of programming languages. There was some English book, Springer . That is, you read and at the same time tell those who want to listen to you.

- You teach different disciplines and generally started off with Java. How did you start teaching Haskell?

- When a young teacher comes to work at the university, he is given courses not by his usual choice, but by what to read. My first special course, which I read, was called “Web XML technology”. The first time I read it in 2003. At the beginning of July, they take me to the department, they say, this is your load, and from September you start to read the course. I was not a specialist in either. Entrusted - it means you study and begin to read. XML was studied in the framework of this course, then I began to study web services, somehow program, and from there I switched to Java. A Java course appeared, and was taught for a few years by a few years.

That is, the courses appear from what they have commissioned, and only then you begin to offer yourself what you are interested in and want to read. If there is a place where it is stuck in the curriculum, the department agrees. And so the OP course appeared, in my opinion in 2008/09.

And by the time Haskell, I knew very badly. We can assume that he did not know. But it usually does not interfere with reading the special course. The students, of course, did not understand anything, and I discussed this with them many years later. But the teacher, teaching individual courses, reads better and better. Already figured out at some point and began to teach better, I think.

- What were the reviews from students who received the already developed material?

- In student reviews, I believe only if they are strongly abusive. If students respond well, it is impossible to believe in it, because it is not clear what motives they have for this. And so strong swearing, I did not hear. In fact, when you teach, every time you think that you would do better next year. And you always remain dissatisfied with what is now. That is, it is such an ongoing improvement process.

It is clear that students relate to the study of Haskell as a kind of obligation: it is necessary to study, so they study. And in general they are right.

- How did this affect the graduates? Did those who went to the functional appear?
- I know units who Haskell uses from those who have attended this course. The course was not called Haskell, but OP. And for me it has always been important that students try to understand the ideas of the OP, and already Haskell, not Haskell, is the tenth thing. And I hope that none of my students are afraid to use higher-order functions and Lambda functions in any other industrial programming languages.

And I think this is absolutely normal. A world in which everyone will program in Haskell is hardly a very good world. And if they are not afraid of the ideas of FP, this is already good.

- And why will this be a bad world?

“Because Haskell requires work at a very high abstract level.” And the level of humanity does not allow, in my opinion, to get as many programmers to solve all problems in Haskell. The less a programmer’s level is required, the better, the more tasks we can solve. Therefore, simple languages ​​are better than complex languages.

We cannot demand from all mankind that everyone be geniuses and all understand the theory of categories. And we cannot require everyone to understand Haskell. But we can create such programming languages ​​with which practically anyone can work. And just such programming languages ​​should be common. Already the task of their developers is to make programmers make fewer mistakes, to make programs less likely to break. But this is different. Requirements for the developer should not be high. And in my opinion, this happens in any field.

Take some cars. The expert level of the driver should always fall. That is, it should be all the easier and easier to drive. The same is due to programming. And Haskell, of course, imposes high requirements, and this is not very promising. Or we will take: do not understand the monads, shoot!

- Here is an example with drivers, this is understandable. I'm trying on with the doctors. I would not want their level to fall over time.

- I have heard many times that the level of doctors can be raised using the software level. Things associated with the diagnosis, just now well solved programmatically. There are tests, there are different methods of machine learning, which help to make a diagnosis. And the task of the doctor is to use all of this. The software must be such that the level of the doctor is sufficient to use this software.

I, of course, do not understand this, but I believe that behind this is the future. We do not need to have a million expert doctors. That is, it should not be a doctor, but the software operator who will diagnose, prescribe treatment, and so on. Another thing is that top-class experts are needed to develop such software.

This may sound too misanthropic, but the practice of human development shows that, not only are not all smart, but not all and must be smart. This is absolutely normal. If we have 1% of the population that is smart, then this is good, and more is not needed. Maybe I would like to, but it is still impossible. Therefore, we need different levels, different works.


- I heard that you participated in the translation of books. Can you tell about it?

- My first book publishing business began with the following. I heard that the publishing house "DMK-Press" should release the book “ Learn Haskell in good name ”. I was interested in this translation, because I needed to recommend something to students that they should read in Russian about Haskell.

And I, as I remember, at the end of December, wrote a letter to the publisher with a question, this way and that, I teach Haskell, I heard that work is underway on publishing the translation. In what state is this work? And Dmitry Movchan, the editor-in-chief of this publishing house, answered me that we are practically finishing up, would you like to see the original layout, what happened there?

He sent me a mock-up, I looked at him and was horrified by the state he was in. There were terrible things. For example, half of the code examples were with incorrect indents. Because the publisher in Haskell does not understand, and somewhere everything is aligned to the left, somewhere else is something. And the quality of the translation was also creepy in many parts. And when I saw it, I wrote that it was impossible to publish this way, and something must be done with it, and let me do something to you.I'll write you a bunch of comments about what to do with this text.

They agreed, and within a month and a half I sent them various comments on the text. Something had to be re-translated there, some sections were not translated, they needed to be translated. So I got acquainted with the publishing house and after a while the book came out. There I am listed as a scientific editor. Roman Dushkin, and I am the second. And so it began.

And after that I started publishing some books for translation. I translated with Artem Pelenitsyn, my university colleague, Bird's book “ Pearls of Functional Programming ”. We translated “ Introduction to the theory of programming languages ​​”, a thin book. I also translated Marlow book “ Parallel and competitive Haskell programming ". Either this is all, or something else, I do not remember, to be honest. Here is the last thing my students translated, “ Haskell Programming ” Will Kurt.

I did these things to make books for the Russian-speaking community, which from my point of view, it would be useful for him to read. I did not work as a translator in order to earn money, but in order to have books in Russian. Because we still have English - this is a problem.


- Did you participate in practice of functional programming ? I did not find this magazine at all.

- Well, yes, I’ve written an article for him in the third issue or something. I wrote about convolutions and how they allow to program many calculations on lists.

- What happened to the magazine? Who started it and why everything died down?

- He went out a few years. I have a complete collection of print. I do not know all the details how it came about. But Lev Valkin, one of the main organizers of this magazine, lionet in LiveJournal. He was, in my opinion, the editor of the first few issues later on doing this Zhenya Kirpichev , who now works in Google. In my opinion, Dmitry Astapov is one of those who are at the very beginning. These were all people who were then active in the Russian segment of LJ. They got posts very popular and with gigantic discussions. So at some point they decided to make a magazine on this topic. And in my opinion, the magazine was very good, the articles were written very well.

They worked like this: the authors wrote articles and these articles were very well reviewed. There was a serious correction process - I was forced to throw a bunch of jokes out of the article. Valkin said to me: “ Here you are reading now, you are funny, and then you will be ashamed ”. Threw a bunch of jokes, and so on. In general, serious work on the text was, and it worked out very well.

After that, I met Valkin in the fall and we talked a little about it and he says that there was some desire to make him more serious. And more serious - it means translating it into English in order to expand the audience. Being engaged in the current form did not seem very promising. But such a decision would have led to the fact that he would not have taken off at the English-speaking audience, because such good is in bulk, and in Russian, too, because Russian-speaking developers are hard to read in English.

Some people had no desire to continue in Russian, they wanted in English, other people did not want in English. In general, fatigue came.That is, there were no people willing to become the driving force of the magazine. Because it is clear that it takes a lot of time, and no one could afford it. And without such a motive force this cannot exist.

For example, the practice of modern Russian magazines is either completely general, and specialized journals are not needed, no one knows about them and no one reads. Even if they exist, they are supported by some organizations, people are paid a salary, and in the case of fprog, they collected some money, but all this did not go to income, but to maintain printing and so on.

- Did they send the printed version right there?

- Yes, there were some services, you could remotely subscribe and receive the next numbers. That is, they were printed, and not only in electronic form. Of course, they are pleasant to hold. The same Valkin spent a lot of time: he bought fonts for a magazine so that it was solid. And it looks beautiful. This is all done in TeX, which is always difficult. It was a lot of work and it was very difficult to do it just like that.


- I wanted to immediately jump to a book that you are writing now on “ Haskell in Depth ”? How will it be different from “ Learn Haskell in the name of goodness ”?

- The book is positioned as the second Haskell. In order to read it, you need Haskell to know already. This is the first difference from “Learn your Haskell” and all the others, because they all enter from the very beginning, and here I even allow myself not to explain the monads. Because already all this must be studied.

The second thing that matters to me when writing it is that this book should emphasize Haskell's ability to solve practical problems. This is such a pragmatic Haskell that can be used in industry. Therefore, I try to use libraries. Very few Haskell books actually use libraries. In a pragmatic approach, there is only one book “ Real World Haskell ”, which came out in 2008, that is, a very long time ago. And that, they very little focused on the library, although they at that time already had, but here they are little used. And I, on the contrary, from the very beginning, consider it necessary to use as many libraries as possible to solve the problem. When you use libraries, you can go much further. This is the second book - orientation for use in industrial programming.

And the third is probably an attempt to describe things that are scattered around a bunch of blog posts. Specifically, now I am working on a chapter on performance, performance, and benchmarks, and how to make code optimization. And I look at “Real World Haskell”, it says fine there, but few. For 10 years, Haskell has gone far ahead in this issue and a lot of scattered information, and here I am somehow trying to collect it in one chapter.

In Haskell, there are many such topics where there is no one source where you can read about it. At the same time, it is clear that, for reasons of volume, I am not able to give everything, but despite the fact that Haskell is in depth, I’m still in depth — you can write a million pages, and it will be deeper and deeper. But I try to give a certain minimum, after which it is already easy to look at separate roadblocks and all sorts of different mailing lists to read.

These are the three goals: the second book, that is, the continuation of education, a pragmatic approach, and such a reader’s preparation on topics that are scattered over many articles.

- I understand that in the near future, two books are being prepared on the issue of Haskel. There is also the Granin book ( graninas ) “Functional Design and Architecture ”.

- Well, he has a different topic. He writes about application architectures there, as I understand it. So, I think, the more books uses Haskel and about Haskel, the better. Therefore, I do not think that I am in some kind of competition with other authors.

- He will get an example of his application through the entire book, how to do it in practice. Do you get a lot of examples?

- By the way, with such an approach of one application I personally do not really like this approach. There is Alejandro Mena book “ Beginning Haskell: A Project-Based Approach, 2014 ” . And she also translated into Russian. There is a site with a basket that is being sawn throughout the book. I don't like it very much. This is more like some kind of real work. And things from a Haskel are recalled, in order to import something concrete. But all approaches have the right to exist.

A year and a half ago, in August 2017, I wrote a set of reviews on existing books on Haskel and realized that everything was bad. And then several books on Haskel were announced with almost no information about them. There was “ Joy of Haskell ” Julie Moronuki, one of the co-authors of Haskell Book . There was “ Intermediate HaskelL ”, in my opinion, which Artem Kazak and Vlad Zavyalov . That is, even then there was information about these books, but in the form of ads. But I have not heard anything else about them since then, although a year and a half has passed. They are in the same incomprehensible state.

In any case, what I heard about these books shows that they are all different and the more they are, the better. There is no competition for books on Haskel, because it is impossible to earn money on book publishing. More precisely, the authors of this money can not earn. Therefore, only a regular form of payment can work here. When an employer pays for sitting and writing a book, or generously sponsors, like on Patriona. Maybe it works. But in any case, this is a non-profit business. Therefore, the more books there are, the better.

- Will there be enough power to translate all this into Russian? Or maybe someone else will do it?

- I prefer not to think about it. The problem is that trusting someone else will, of course, be difficult. I still do not think about it, you must first finish. In fact, a lot of work and it is progressing very slowly.

- Is there a contract or something like that?

- All the deadlines are long gone, but so far no one applies to me. The application of sanctions is possible when it brings a large income. And when it does not bring any income, then the sanctions will not help. If there was an employer who paid me five thousand dollars a month and demanded the work done, then yes.

- On the books finished. Do you have any experience in industrial programming, because it slipped on Twitter. And you leave from teaching, engage in real development?

- I don’t know where exactly I am leaving (at the time of publication, it became known where ). But from the teaching work, I'm really leaving. And I have no industrial experience. It seems to me that it can be obtained, if necessary. Life is arranged in such a way that even any junior position in IT is estimated to be significantly higher than the work at the university and the responsibilities are substantially less. At my age I am ready to start working on industrial programming experience, if necessary. Formally, I finish on July 15, there I will have a summer practice, which I will lead.And that ends my work at the university.



- You're a member of the Haskell 2020 . What sentences there now hang? How can the language change, what to read about it? I heard only about linear types. Does this look like the mechanics in Rust?

- There are 2 committees. Haskell 2020 - its goal was initially to write new standards for the Haskel language, but this committee failed. This can now be accurately asserted. But the new standard of the Haskel language is not about new things. It is about things already settled, which can already be standardized. But work in this committee was practically not carried out.

As for linear haskel - this is another committee. This is a supervisory ghc compiler committee . And his task is different - the task of accepting proposals for implementation within the ghc compiler. That is, it is not about the Haskel language, but about the capabilities of a particular compiler. Well, it so happened that I am a member of both committees.

Here is a linear haskel - it was one of the biggest showrooms. And he was adopted, and adopted conditionally. That is, it will be accepted if certain conditions are met.

It is difficult for me to compare linear types with rastovsky ones, because I don’t really know the details and I don’t really understand the details of this propouzal. As I understand it, this is just an attempt to describe how functions that take a value and use it exactly once should work. That is, there was talk about the fact that the name of linear-types is incorrect and in fact should be linear-arrows. That is, it is not really in the full alignment of linear types, as I understand it. But once again I say that I did not particularly participate in the details of the discussion and do not fully understand.

I am deeply involved in the guts of propozal, where they offer me a shakhferdit - this is such a term within the committee, when a person is responsible for making a decision on this site. Here I have to understand them.

- Are there any interesting ones that you supervise to mention?

- I have very little so far. I entered this committee in August 2018. Even nothing particularly interesting, I do not remember. I am now working on the “ simple limited families of functions ”. I'm trying to wade through a text written in a rather complex language. For example, in this study site it is proposed to add control over families of types of this kind. Now the family of types, like functions on types for which the domain is not defined. And they want to restrict them in such a way that not all types can be substituted, but only those that implement some kind of restriction on the family of functions.

- Is it possible to give quick information, why is the type family used in haskel?

- Well, they have a lot of examples. In ghc, in my opinion, since 2005 exist. This is actually a calculation on the types. When we want to get the results of functions not of a particular type, but of a type that depends on other types.

The simplest example: in the usual haskele we cannot add values ​​of different types, even if they are numeric. That is, we cannot take the type int and the type integer and add. But with this we can always calculate some more general type. For example, if we int and integer add, then the more general would be integer. And, if we double and int add, then double will be more general. And we can write a function that, according to the two given types, will calculate the more general one. And then you can declare a function with input values ​​A and B, and the output depends on these two types.

- Are these almost dependent types?

- No, these are completely independent types, because the work goes only on types. That is, it is a function on types, no values ​​appear here. This is convenient, but there are a lot of dark corners in this implementation. And despite the fact that for almost 15 years the functions of the family of types are with us, there still remain many problems.

- And the last question. At the very beginning, you said that Haskel is only for clever men. Why then write books, give so much information about it, if it is needed only 1% of the entire industry?

- Firstly, 1% is a lot. Secondly - because all this is done not for them, but for themselves. People do what interests them. And this is the most important and best motivation. If this 1% of the industry is happy, then it is very good. If not, I don't care.

FPURE is the only conference on functional programming this year in Russia. The event will be held May 24-25 in Kazan. More than 200 Russian and foreign representatives of various FP communities: Scala, Haskell, Clojure, F #, Elixir and others. You can buy a ticket and find out more information here .

Source text: Interview with Vitaliy Bragilevsky: “The world in which everyone will program in Haskell is hardly a good world”