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



    Vitaly Bragilevsky ( @_bravit ) still teaches courses in Haskell and theory of algorithms at SFedU. He also gives on-site courses in other cities, is the editor and translator of many books on Haskell and functional programming, is a member of the Haskell 2020 committees and the GHC compiler, and he actively speaks at conferences. For example, he will give a short compiler- building course on Haskell at the FPURE functional conference in Kazan.

    Due to such a huge number of activities, the final recording was released for almost an hour ( link to audio)! Read her text transcript below, where Vitaliy talks about the advantages of a teacher’s career, a lot of books about Haskell and not only and, of course, about Haskell himself, and whether you need to be a genius to write in this language.

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


    - Well, teachers are changing. 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 imagined myself to be 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 the university, I started teaching at the lyceum school, which I graduated from. And when he graduated from university, he began to teach at the university. This was a very natural way, and then I did not imagine myself as anyone else. Therefore, for me this path was simple, direct, and I had no options: I always wanted this, and began to teach.

    - And how did it get to the institute? Did you specialize in programming?

    - I graduated from Rostov State University with a degree in Applied Mathematics and Computer Science.

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

    Many of my classmates who went along the programmer line now work as some kind of programmer's bosses.

    “Then you stayed there and went to graduate school?”

    - Yes, I stayed at the same university. I did not go to graduate school. And I did not engage in scientific activity. There were some attempts, but I can’t say that I was engaged in purposeful science. All the time I had things that seemed to me more interesting than doing science. Here it was still superimposed that in our country there were no areas of science that were interesting to me. And we can say that no so far. And to practice science remotely, without guidance, on my own, practically I could not.


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

    - Compilers are a little different after all. The compiler school in our country is quite strong, but I was interested in things more theoretical. For example, related to types.

    If we take the Dragon Book , then a small chapter is devoted to type theory and there is nothing really there. Giant sections devoted to parsing, all sorts of such things, but what interests me is not there ...

    When I graduated from university, it attracted me, but nothing more. I was more interested in learning theoretical things. And it so happened that I studied them. But it was purely self-education. No concrete result, no exhaust in the form of scientific work.

    - And which of the books on this subject could be read then? Pier?

    - If I'm not mistaken, Pierce ( TAPL - Types and Programming Languages ) in English was released in the year 2005th . Then it 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 slowly studied all this, made presentations, and solved problems.

    But before that, books in English also appeared. 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 various constructions of programming languages. There was some book in English, Springer's . That is, you read and at the same time tell those who wish to listen to you.

    - You teach different disciplines, and you generally started with Java. How did it happen that they started teaching Haskell?

    - When a young teacher comes to work at a university, they give him courses, usually not of his choice, but what to read. My first special course that I read was called “Web XML Technologies”. The first time I read it in 2003. At the beginning of July, they take me to the department, they say that this is your load, and in September you begin to read the course. I was not a specialist either. Assigned - then you study and start reading. I studied XML as part of this course, then I began to study web services, somehow programming, and from there I switched to Java. A Java course appeared, and taught it a bit for several years.

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

    And by that time I knew Haskell very badly. We can assume that he did not know. But this usually does not stop reading a 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. I already figured it out at some point and began to teach better, it seems to me.

    - And what were the reviews from students who received the material already worked out?

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

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

    - How did this affect the graduates? Are there those who have gone into functionalism?
    - I know units who Haskell uses from those who attended this course. The course was not called Haskell, but FP. And for me it was always important that students try to understand the ideas of the FP, but 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 some other industrial programming languages.

    And I think this is absolutely normal. The 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 - that's good.

    - And why will it 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 so many programmers to solve all problems on Haskell. The less the programmer level is required, the better, the more tasks we can solve. Therefore, simple languages ​​are better than complex ones.

    We cannot demand from all of humanity that everyone is a genius and that everyone understands category theory. And we cannot demand that everyone understand Haskell. But we can create programming languages ​​that almost anyone can work with. And just such programming languages ​​should be common. It is already the task of their developers to make programmers make fewer mistakes so that programs break less often. But this is different. Developer requirements should not be high. And in my opinion, this is happening in any field of activity.

    Take some cars. The expert level of the driver should fall all the time. That is, it should be easier and easier to drive. The same goes for programming. And Haskell, of course, imposes high requirements, and that's not very promising. Or we will take: do not understand the monad, shoot!

    - Here is an example with drivers, this is understandable. I'm trying on with 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 level of software. Things related to diagnostics, right now, are well solved by software. There are analyzes, there are different methods of machine learning that help to make a diagnosis. And the doctor’s task is to use all this. The software should be such that the doctor’s level is sufficient to use this software.

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

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


    - I heard that you participated in translations of books. Can you talk about this?

    - My first business in book publishing began with the following. I heard that the publishing house DMK-Press should publish the book “ Explore Haskell for Good .” I was interested in this translation, because I needed to recommend something to students that it was advisable to read in Russian about Haskell.

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

    He sent me the original layout, I looked at him and was horrified by the state in which he was. There were terrible things. For example, half of the code examples were indented incorrectly. Because the publishers at Haskell are not versed, and somewhere everything is aligned to the left, somewhere else. And the quality of the translation was also creepy in many parts. And when I saw this, I wrote that you can’t publish this way, and you need to do something about it and let me do something about it. I will 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 there had to be translated again, 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 began to offer publishing houses some books for translation. I translated with Artyom Pelenitsyn, my university colleague, Byrd’s book “ Pearls of Functional Programming ”. We have translated “ Introduction to the Theory of Programming Languages ”, a thin book. I also translated the book Marlowe “ Parallel and competitive programming in Haskell" Or is it all, or something else, I don’t remember, frankly. Here is the last thing my students translated, Will Kurt's “ Haskell Program ”.

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


    - Did you participate in the Functional Programming Practice ? I did not find this magazine at all.

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

    “What happened to the magazine?” Who started it and why did everything stall?

    - He went out for several years. I have a complete collection of print. I do not know all the details of how it came about. But one of the main organizers of this magazine is Lev Valkin, a lionet in LiveJournal. He was, in my opinion, the editor of the first few issues, then this was done by Zhenya Kirpichev , who now works in Google. In my opinion, Dmitry Astapoveven from those at the very beginning. These were all people who were then active in the Russian LJ segment. Their posts were 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 peer-reviewed. There was a serious correction process - I was forced to throw a bunch of jokes from the article. Valkin told me: “ You are reading now, it’s funny for you, and then you’ll be ashamed .” Threw out a bunch of jokes, and so on. In general, there was serious work on the text, and it turned 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. But more serious - this means translating it into English to expand the audience. Engaging in the current form did not seem very promising. But such a decision would lead to the fact that he would not take off in an English-speaking audience, because such good in bulk, and in Russian, too, because it is difficult for Russian-speaking developers to read in English.

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

    For example, the practice of modern Russian magazines is either completely general, and specialized magazines are not needed, no one knows about them and no one reads. Even if they exist, they are supported by some kind of organization, people are paid a salary, and in the case of fprog they raised some money, but it all didn’t go to income, but to support the press and so on.

    “Did they send a printed version directly?”

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


    “Wanted to jump immediately to the book you are currently writing on Haskell in Depth ?” How will it differ from “ Explore Haskell for Good ”?

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

    The second thing that is important to me when writing it is that this book should emphasize the ability of Haskell 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 was published in 2008, that is, a very long time ago. And then, they focused very little on libraries, although they were already at that time, but they are not used much here. And on the contrary, from the very beginning I 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 on use in industrial programming.

    And the third is probably an attempt to describe things that are scattered across a bunch of blog posts. Specifically, now I am working on a chapter on performance, performance, and benchmarks all sorts and how to do code optimization. And I look at “Real World Haskell”, it says fine, but not enough. For 10 years, Haskell has gone far ahead in this matter and a lot of scattered information, and now I'm somehow trying to collect it in one chapter.

    Haskell has many topics where there is no single source to read about. It’s clear that for volume reasons I’m not able to give everything, but despite the fact that it’s called Haskell in depth, I’m still in depth - you can write a million pages, and all this will be deeper and deeper. But I try to give a certain minimum, after which it is already easy to watch individual blog posts and read all kinds of different mailing lists.

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

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

    - Well, his theme is still different. He writes there about application architectures, as I understand it. So, I think the more books Haskell uses and about Haskell, the better. Therefore, I do not believe that I am in any kind of competition with other authors.

    - An example of his application, how to do it in practice, will be drawn through him throughout the book. Will there be many examples in yours?

    - By the way, with this approach of one application, I personally don’t really like this approach. There is Alejandro Mena book “ Beginning Haskell: A Project-Based Approach, 2014" And she, too, has been translated into Russian. There is a site with a basket that is sawn throughout the book. I don’t really like it. It looks more like some kind of real job. And things from the Haskell are remembered in order to implement something concrete. But all approaches have a right to exist.

    A year and a half ago, already in August 2017, I wrote a set of reviews of existing Haskell books and realized that everything was bad. And then several Haskell books were announced with almost no information about them. There was “ Joy of Haskell ” by Julie Moronuki, one of the co-authors of the Haskell Book . There was “ Intermediate HaskelL ”, in my opinion, which was made by Artem Kazak and Vlad Zavyalov. That is, even then there was information about these books, but in the form of announcements. But I have not heard anything more 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 there will be, the better. There is no competition for Haskell books, because money cannot be made from book publishing. More precisely, the authors of this money cannot earn. Therefore, only some regular form of payment can work here. When the employer pays for sitting and writing a book, or like Patron, generous sponsors. Maybe it works. But in any case, this is a non-profitable business. Therefore, the more books there are, the better.

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

    “I prefer not to think about it.” The problem is that trusting someone else will, of course, be difficult. I don’t think about it yet, I need to add it first. In fact, a lot of work and it is moving very slowly.

    “Is there any kind of agreement or something like that?”

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

    “We finished the books.” Do you have any experience in industrial programming because it slipped on twitter. And you leave teaching, to be engaged in real development?

    - Where exactly I am leaving, I do not know yet (at the time of publication it was already known where) But I really am leaving the teaching work. And I have no industrial experience. It seems to me that you can get it if necessary. Life is structured in such a way that even any junior position in IT is evaluated significantly higher than work at the university and there are significantly fewer responsibilities. I am ready at my age to begin to gain experience in industrial programming, if necessary. Formally, I finish July 15, there I will have a summer practice, which I will lead. And this is where my work at the university ends.



    “You are on the Haskell 2020 committee .” What proposals are there now hanging? How can the language change, what to read about this? I only heard about linear types. Does it look like mechanics in Rust?

    - There are 2 committees. Haskell 2020 - its goal was originally to write new Haskell standards, but this committee failed. This can now be precisely stated. But the new Haskell language standard is not about new things. He's talking about things already settled that can already be standardized. But virtually no work was done on this committee.

    Regarding linear Haskell , this is a different committee. This is the ghc compiler oversight committee. And his task is different - the task of accepting proposals for implementation inside the ghc compiler. That is, this is not about the Haskell language, but about the capabilities of a particular compiler. Well, it so happened that I am on both committees.

    Here's a linear Haskell - it was one of the biggest pro-nodes. And he was accepted, and conditionally adopted. That is, it will be accepted if certain conditions are met.

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

    I penetrate deep into the interior of the propozel, where I am offered a shefferdit - this is such a term inside the committee when the person is responsible for making a decision on this propozel. Here I have to understand them.

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

    - I have had very little so far. I joined this committee in August 2018. I don’t even remember anything particularly interesting. I'm working on the “ Simple limited function families ” propozel right now . I'm trying to get through text written in a rather complicated language. For example, this pro-node suggests adding control over type families of this kind. Now a family of types, as it were, functions on types for which the scope is not defined. And they want to limit them in such a way that not any types can be substituted, but only those that implement some kind of restriction on a family of functions there.

    - But will it be possible to give quick information, why are type families used in the Haskell?

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

    The simplest example: in a normal Haskell, we cannot add values ​​of different types, even if they are numeric. That is, we cannot take the int type and the integer type and add. But with this we can always calculate some more general type. For example, if we add int and integer, integer will be more general. And, if we add double and int, then double will be more common. And we can write a function that, by two given types, will calculate a 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 ​​arise here. This is convenient, but there are a lot of, however, dark corners in this implementation. And despite the fact that for almost 15 years the functions of the type family have been with us, there still remain a lot of problems.

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

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

    FPURE is the only conference on functional programming in Russia this year. 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 .

    Also popular now: