Haskell is a pure functional programming language. Today Haskell is used by many senior developers as a primary language. Let’s look at the use cases of Haskell and find out why the advanced software development firms chose it.
First, we have Mercury, which provides banking products. The project offers settlement and savings accounts without monthly fees, debit cards, ACH payments, checks, and free international bank transfers. Among the advantages of Mercury is an excellent website, online registration, and almost complete absence of commissions, and all of this is created in the Haskell language.
Haskell has a reputation for being the language most commonly used in financial and cryptocurrency contexts. It mainly has stable and predictive performance and good parsing libraries.
According to the Mercury developers, they chose Haskell for the following reasons:
- Newtypes allows you to create types in one line. You can further customize the capabilities of these types;
- Algebraic data types allow you to model various forms of data;
- Data types (Maybe and Either, for example) help model optional data and check for error cases;
- Metaprogramming at compile time to eliminate fragile patterns;
- The green-thread concurrency model, does not require additional thinking.
Most of these things are present in other languages, but often they are missing in default libraries together with some necessary features, like immutability.
The next project is Channable, a management platform through which online stores can publish their products on trading platforms, advertising domains, or price comparison aggregators.
Developers there use Haskell for various backend functionalities. The largest is a data processing system that provides data import from clients, manages data storage, and applies user-defined rules to data before transferring them to third-party platforms.
Another important part of the platform using Haskell is the API gateway, which handles routing and provides a typical implementation for authentication, authorization, speed limits, etc. There are also several small utilities.
Among the reasons for using Haskell, developers distinguish:
- It complements Python;
- It compiles into fast code while providing security thanks to a strong type system.;
- It makes scaling easier.
Currently, developers are using Haskell in several more projects and seem to be very happy with it.
And finally, we have Haskoin Core, an open-source Haskell library for Bitcoin and Bitcoin Cash. It has been created to replace an outdated backend that was expensive and not very reliable or scalable. Currently, it serves almost all requests for Bitcoin and Bitcoin Cash data coming from the wallet and web viewer.
The developers say that Haskell was chosen because:
- Haskell’s type system and expressive nature made it possible to write accurate code in a short time;
- Haskell pushes the programmer to write lots of small functions, reuse abstractions, and follow a declarative style that is easy to understand;
- The Haskell compiler outputs well-optimized code;
- It is easier to write functions in Haskell, and the data has visual quality.
The main advantages of Haskell are safety based on the strong typization and pure functions. It makes it possible to write software components with high guarantees of accuracy that extend to the composition of such components, creating more complex systems from them. This feature of Haskell means the ability to more easily create complicated multi-functional systems with relatively simple and transparent blocks of code, which usually causes difficulties for most programmers working with large systems.
Overall, it’s no surprise that developers are choosing Haskell as their powerful programming tool programming. If you need other use cases, you can check this section of Serokell’s blog.