It is said that Haskell is a language for geniuses and academics. True?



    Once I spoke with the founder of an Israeli startup who developed a high-speed database on a GPU. Haskell and C ++ were in their stack, and the founder complained about how hard it was to find people on the team. He flew to Moscow, including looking for good programmers.

    I cautiously asked if it was better to use something more common and new. And although the answer was polite and constructive, between the lines it seemed to me: “Pff, don’t even mention these toy yaps.”

    Everything that I heard about Haskell from the side has since come down to one thing - “the jokes with him are bad.” To get to know the Haskelists better, I came to the telegram chat with them. It was pretty scary, and as it turned out, for good reason.

    People don't want to talk about Haskell, and they seem to look at such undertakings with contempt. If to speak - with the maximum completeness and objectivity. “One of the characteristic qualities of Haskell as a language and community is that together they did not seek to become popular, giving a simple answer to popular questions. Instead, they built a logical principled way of solving real problems, rather than a quick penetration into the heart of a passer-by who is interested, ”they wrote to me there.

    However, several people talked about their experiences, and I gathered their opinions here.

    Denis Mirzoev ( nolane ) : At the university on the subject of “Programming Languages” I was offered to complete a course on Haskell Coursera for one additional point out of a hundred. Then there was another functional programming course, in which Haskel took place. Wrote the undergraduate and graduate work of the bachelor of GHC. Found a job as a Haskel programmer. Now it will be difficult for many to remember how they began their way in programming, how difficult it was to understand what a “pointer” is, what a “function” is, what a “class” is. Perhaps this is why the study of Haskell is so hard. With age, it becomes harder to absorb new things. Doctor_Ryner

    It was hard and hard so far. When you start to study Haskel, you have to comprehend a lot of new concepts. This is a tough job. Literally learn to program again.



    : Once, on a trial period, I fell on Redux, so, looking at lessons from its creator, I decided to get to know everything better. At first I applied the studied practices in JavaScript, but then I learned about Haskell, which is considered to be a true functional language. I was immediately attracted by his elegance and a bunch of new concepts unknown to me.

    It was not easy for endless tutorials about monads using the example of a burrito, which is very confusing. Also, the imperative background greatly hinders the opening of new concepts.

    Yuri Syrovtsy ( cblp ) : The most difficult thing is to study Haskel as the second, when the duckling syndrome did not pass to the first language.

    What is good and what is bad language?


    Doctor_Ryner : The language is very short, elegant and flexible, no wonder that half of the libraries on it are EDSL (at least that impression).

    Yuri Syrovtsy ( cblp ) : High expressiveness, it is easy to transfer the subject area to the code, the optimal combination of imperative and functional paradigms. It is easy to build abstractions on data and algorithms, which allows you to think about the task, without being distracted by untied trifles.

    John Doe : Strong strong (I would say, fascist) typing.

    Igor Shevnin ( interphx ): A very expressive type system. Not as powerful as Idris or Agda, but it reaches the golden mean, when you can express almost everything, and at the same time, type inference works fine. Do not always mark them manually.

    But the powerful type system makes you more attentive to the values ​​passed. A bunch of type definitions can look like a boilerplate. Each team uses its own set of extensions or does not use them at all. The code is more “dense” - one line often carries more information than in other languages, therefore, it is more difficult for an inexperienced developer to read it.

    Doctor_Ryner: Studying Haskell, you will most likely come across the phrase “if it compiles, it is probably correct”. There is no null, the functional paradigm itself is very strict and forces you to follow certain rules, which in most cases lead to a better design.

    For example, there are no variables in the language - only constants. You don't have to keep track of what and where you assign it. Haskell encourages the use of pure functions, which leads to a lack of side effects. The functional design simply makes the program work as one, as opposed to the PLO, where a bunch of objects are thrown into the world and the objects try to communicate with each other by side effects, turning the application into an unpredictable mess. At work we suffer enough from this with C # in Unity.

    Denis Mirzoev: Built-in laziness enhances the expressiveness of the language. Many algorithms are becoming easier. It can increase performance if intermediate results are not used. (For example `head. Sort` works in linear time).

    Igor Shevnin : A lazy model of computation usually helps, but when the order of calling functions is important, it can be difficult to figure out what is going on.

    Doctor_Ryner : It is compiled, which immediately gives a huge increase in speed.

    Denis Mirzoyev : In terms of speed, comparable to Java, but not as fast as C.

    Igor Shevnin: Out of the box there is support for extensions that allow you to finish the language and type system. At the same time there are many widely used extensions that are familiar to the community, have decent examples and documentation, and are not niche.

    Doctor_Ryner : In the standard Prelude library there are very bad functions like read, head, readFile, which can throw Exception and put a program instead of returning Maybe. Therefore, you have to use alternatives or write your own implementations.

    Igor Shevnin: The main problem is the lack of standardization, to the extent that many replace the standard library with one of the incompatible alternatives. There are disagreements in the community on what should be the standard library, what should be included in the core of the language, and what to do with extensions, and according to my feelings this hinders the development of the language.

    Denis Mirzoev : There are not enough bodies: there is no full-fledged IDE, there are very few means for measuring performance, there is no debugging “step by step” - this is generally a fundamental problem.

    For which projects Haskell is best suited?


    Yuri Syrovtsy : For complex tasks related to security or money, where the cost of a mistake is high.

    Doctor_Ryner : For everything where you need to perform calculations, transformation and analysis of data. Strongly surprised that Haskell is less popular in Data Science than Python.

    Igor Shevnin : I would not dare to use it for embedded systems (performance is not bad, but there is still a significant overhead in memory consumption due to lazy calculations) and small scripts (there is no need for this rigor). You also need to understand that finding developers in a team is much more difficult than for mainstream languages.

    John Doe : To write industry code that others will read you will need a whole team of Haskellists. Such a few people managed to collect.

    Igor Shevnin : But thanks to the brevity and rigor Haskell is suitable for almost any task.

    Getting started with Haskell is a good idea?


    Igor Shevnin: To begin is unlikely, because the vast majority of code bases with which a person will have to work are not written on it.

    John Doe : Bad bad idea! Languages ​​are not from the ML family - and such from industrial ones in general - then they will be a shock for you.

    Denis Mirzoev : Usually, people first learn math, then move on to programming. Therefore, learning a language that uses mathematical concepts (algebraic data types, pure functions) should be simpler than imperative ones. So I think this is a good idea.

    Doctor_Ryner: All the newbies that I teach, I will certainly introduce you to Haskell. People who have not studied the imperative style, are much easier to navigate in the functional code and learn faster, then even if they work with object-oriented languages, they bring good architectural solutions and functional practices.

    Yuri Syrovetsky : It is better to start from several fundamentally different languages ​​at once, for example, C, Haskel and Smoltok, in any order. No single language
    will give complete understanding.

    Haskell is an old enough language. Is it good or bad?


    Yuri Syrovetsky: The language is developing very actively, the compatibility load just does not pull compatibility.

    John Doe : The standard was adopted in 1998, but this is not noticeable: until now, new versions of the compiler, potentially breaking backward compatibility, are released about once every six months.

    Denis Mirzoev : Haskell is not old, but time-tested. Unreasonable changes will never fall into the language. So it's rather good.

    Pro Haskell is said to be one of the most difficult languages. This is true?


    Doctor_Ryner : Like the language itself - no. Abstractions that are used in it are more complex. A person who has never seen Haskell code can simply go crazy with the flow of new information and various unusual constructions.

    The fact that the language imposes a bunch of "restrictions" does not allow or greatly complicates a bunch of things that do not fit into the functional concept adds fuel to the fire.

    John Doe : For the first elementary project to compile at least, it took almost two months to smoke textbooks, manuals and tutorials in the evenings. True, after compiling, the project immediately started working and figuring under full load (6k rps with peaks up to 15) six months, without any changes at all.

    Denis Mirzoev: I bet that if a student starts learning programming from Haskell and moves far enough, then imperative programming will seem more complicated and less intuitive to him.

    Igor Shevnin : Complexity is relative. Of the mainstream languages, I still consider C ++ the most difficult. Languages ​​for proving theorems (Agda, Coq) will be more complicated than Haskell in a conceptual sense. Haskell is a simple language, but its patterns and libraries — standard and third-party — cannot be learned immediately.

    Is its complexity always justified?


    Igor Shevnin : Patterns and a high level of abstraction are justified, since they make the code more reliable and shorter. But I think that operators, function names and many other things could be clearer.

    Doctor_Ryner : Often, complex Haskell constructions allow you to create very short solutions that are also very flexible and modular.

    Yuri Syrovetsky : Is that the management of effects is cumbersome, although it is almost
    always better than no control. But over its simplification
    work is underway.

    John doe: The language for those accustomed to the usual python / php / whatever generally gives the impression of being orthogonal to reality. For people who were not originally interested in the theory of categories, to achieve results from absolute zero is very difficult.

    But when you understand a language, you get a new way to think about the problem being solved.

    Haskell is seen as a language for mathematicians, not for developers. Do you think it is not widespread because of this?


    Denis Mirzoev : This is a demonstration of the principle followed by the main developers of Haskell - “avoid success at all costs”. The point, of course, is not that success should be avoided, but that success should be avoided, the cost of which is too high.

    It was possible to make Haskel popular. There is, for example, support for this language by Microsoft. It was possible to make the language more imperative, to make some quick and ill-considered decisions in order to gain popularity. It was possible to use a lot of dirty tricks, but thanks to such a correct position of the main developers nothing like this happened.

    Yes, the popularity of the language is not very high, but its quality does not suffer. The advantages of Haskell in relation to imperative languages ​​are obvious to me, most of his problems are solvable, so I am sure that more popularity will come as it develops.

    Yuri Syrovetsky : He is seen as such only by people who know nothing about him. In the
    "real" development, Haskel has been used for a long time, examples are easy to find in
    your favorite search engine. In particular, we in LK are
    happy with Haskell, and we see nothing else in his place.

    Igor Shevnin: I don’t really know what “language for mathematicians” is. This is either R / MatLab / Mathematica for calculations and statistics, or Python, because it is simple and requires less engineering background. But not Haskell. Algebraic concepts of the type of monoids are used in it for practical reasons, and not just for additional rigor.

    The main role in popularity was played by the historical prevalence of C / C ++ / Java / C # in the enterprise, they occupied a niche. But now many companies are beginning to use Haskell and other functional languages.

    What Japs would you compare Haskell with and in whose favor?


    John Doe : Of the more or less common - with Erlang. But Erlang is still easier to write and easier to learn, as it seems to me.

    Denis Mirzoev : I know C, C ++, Java and Haskell well. C ++ doesn't even need to be compared with anything, the language is terrible. C is a good language for low-level development. In this niche it will be better. Otherwise, I would prefer Haskell.

    The choice between Java and Haskell is more difficult, but here you also need to look at a specific task. Under Android on Haskell it will most likely be difficult to write, in this case Java is better. But to write servers in Haskell is almost as convenient as in Java. If the environment allows - tuling, the availability of libraries - then I usually choose Haskell.

    Doctor_Ryner: With C #, it's enough to google how to implement Maybe in C # and Haskell. It is very strange that the purely functional dictatorial Haskell feels much more flexible and free. In fact, these are two extremes.

    C # is one of the most object-oriented languages, and the benefits of Haskell are in stark contrast with it. In C #, you constantly have to write a bunch of extra things, and this is all very unpleasant. Using higher-order functions can disfigure the code in terms of syntax. Against the backdrop of all this, it is already difficult to return from Haskell’s short and elegant solutions

    Igor Shevnin: With Rust, so far in favor of Rust. It takes a lot from Haskell and other FP languages, but at the same time, the functional approach is imperative, and the developers and the community are much more literate and more consistent in their development of the language from the very beginning.

    Что думаете про сообщество хаскелистов?


    John Doe : The vast majority are very friendly people, always ready to help. A pleasant difference from the communities of many other languages.

    Doctor_Ryner : Haskell communities often have frighteningly smart people who are always ready to help. No wonder local memes about PhD, category theory and academics go. If you go to chat in other languages, you can see that people discuss common production-problems and data structures. In the Haskell chat, monads, Yoneda's lemma, applicative functors, writing crazy types and so on immediately pop up in front of you.

    You immediately see so much new that you didn’t know before - insane compositions, elegant transformations and transformations, problem solving, which occupy dozens of lines in mainstream languages, almost in one line.

    Haskelists are said to be arrogant. True?


    Denis Mirzoev : Yes. It seems to me that arrogance is related to the fact that they love their language very much and are upset by its undervaluation.

    John Doe : Nifiga like that.

    Doctor_Ryner : Most likely, this opinion has gone, due to the fact that many mainstream developers are very annoyed when Haskelists begin to talk about functional programming and its benefits. A terrible misunderstanding, in turn, can annoy the Haskelist himself, and he will begin to rush in terms, for which he is stigmatized.

    Igor Shevnin: Arrogance is too strong a word. It’s probably the case that the OP, OOP, the distinction of OOP classes and the union types, the extension problem and many other concepts once form a very clear picture, and after that it becomes difficult to perceive people who are trying to oppose OOP and OP or otherwise present wide problem in a narrow perspective.

    Why are OP languages ​​still niche?


    Denis Mirzoev : Their advantages are still not enough to interest a large number of programmers. Difficulty in learning is not conducive to popularity. The problems with Tulling also scare many people away, but it seems to me that an increase in the number of the community could solve this problem. It turns out a vicious circle.

    Igor Shevnin : Nishevost gradually passes, and functional concepts are tightened in other languages.

    Doctor_Ryner : The functional principles themselves and the languages ​​that support them are already ubiquitous. Even for sharps there is Linq and some other libraries. Niche rather purely functional languages, as they use non-standard concepts.

    Do not forget that even 20 years ago, iron was not productive enough for functional languages, so the mainstream functional area began to enter in recent years, and interest in Haskell is only growing.

    Also popular now: