Scripts for Cardano smart contracts are actually written in Haskell and then automatically compiled into their own blockchain language, Plutus Core. However, our love for Haskell began with Haskell itself and before getting to know the blockchain, so first we will pay tribute to it and tell you how and why we chose this language.
Haskell is not as popular as JavaScript, Python, Elixir or C/C++/C# - languages that we ourselves used a lot in development - it ranks 27th in the "Programming Language Popularity Index" as of June 2022. But it has undeniable advantages over the rest. The most important thing for us has always been to make the function as readable and unambiguous as possible, so that anyone can go into the codebase and understand what is happening there. And since we worked with fintech and high-load systems, another two priority tasks were to reduce the possibility of errors and make the reliability of the code independent of a particular developer and his cognitive load. Haskell, a pure functional language, has allowed us to do both. Here are the features of Haskell that opened the way for it to our hearts and software:
Quality, practicality, speed. And also the ultimate expressiveness of the language and its flexibility (for example, operators can be used both in infix and prefix notation, and you can also define your own);
Easy refactoring. Any long-term project involves refactoring; writing new functionality is only 10-15% of the development process, the rest is either adding existing parts or refactoring design errors;
Flexibility and combinatoriality. Haskell offers formal abstractions (functors and monads) that are easily combined and allow you to describe all sorts of relationships between parts of the program, the correctness of which is checked by the compiler;
Haskell has a set of parallel programming tools that almost all popular code editors support;
A powerful high-quality library and the use of Haskell packages allows you to create commercial software, clearly separate pure parts of the program from parts with side effects, and at the same time not rewrite what has already been written before us: the contents of the library modules are automatically imported into all modules of our project.
We understand that Haskell is not a wonderful unicorn, but we are ready to accept its shortcomings, such as a high entry threshold and the lack of a single instruction with best practices and satisfactory IDEs. Haskell allows you to write pure functional code - that is, to do what every developer aspires to. Many of our colleagues agree that Haskell has completely changed their vision of programming and approach to using other languages, and also allowed them to develop their skills in writing code.