FP Complete


This is a short and non-technical blog post demonstrating why the Haskell programming language is a good choice for building cryptocurrencies.

Cryptocurrencies are not your average software

Cryptocurrencies are different from other programs in one key way: One mistake in the code can result in the instantaneous loss of all value of all users.

This is not often the case with other software. In conventional applications and services, mistakes in the code lead to downtime, unsatisfied users, or a successful hack of the service provider. Only in the rarest cases does this mean the complete and permanent destruction of the service and all invested money being gone for good. Recovery is usually possible for ordinary business software. In cryptocurrencies code is money, so extra caution is needed when writing it.

While other financial software also needs lots of caution, mistakes in cryptocurrencies can be especially severe due to their decentralised nature. Traditional banking has safety mechanisms like chargebacks and contracts between banks that make it possible to undo transactions correct mistakes after they happened. In cryptocurrencies, money that’s gone is usually gone for good.

Avoiding mistakes through good tooling

How do you avoid mistakes in your code? One way is to hire excellent programmers. However, all programmers are humans and they will eventually make mistakes. It’s safer to have human-written code cross-checked by a machine to the fullest extent possible. It is crucial to use a programming language that makes mandatory automated checks easy to write.

Haskell is a programming language that was designed for safety. Haskell provides hard guarantees that certain kinds of mistakes cannot be in the code. How does it do this? Let’s look at some features that make this possible.

Haskell safety features

Haskell forces you to write code that is explicit, covers all corner cases, and is hard to misunderstand.

Blockchain HandShake

Benefits of the Haskell ecosystem

Raw technical features are not the only reason why Haskell is becoming popular for writing cryptocurrencies. It is also the ecosystem that surrounds the language, and the mind set of Haskell programmers that make it an attractive choice.

Quality focused community

Haskell tends to select for engineers who are particularly interested in creating quality focused, high reliability software. Some Haskellers started their programming career with Haskell and stuck to it, but this is still rare. Most Haskellers chose Haskell after a long journey in search for better tools and improved productivity. They are often versed in many programming languages and have explored myriad techniques.

Haskell programmers tend to be well trained and enjoy understanding the problem domain before starting to code. This discipline is crucial when working on high-risk projects like cryptocurrencies.

The design and implementation of new programming language features often happens in Haskell before they are adapted into other languages. This entices software developers that wish to work outside of current boundaries. The diversity, passion, and experience makes the Haskell community a great place to build teams for creating new technology.

Owning the toolchain

While Haskell and the surrounding tools and libraries are sophisticated and require effort to get into, those that do master them find themselves equipped with an unexpected power: being able to own their entire programming toolchain. An expert Haskell programmer can modify the code their team writes, the libraries that the project depends on, down to the Haskell compiler that creates the final machine code. This “hackability” of the Haskell toolchain brings various benefits:

This is different compared to many other programming languages. Even an expert C++ programmer often does not feel equipped to make changes to the C++ compiler due to the complexities and sheer amount of code involved. The GCC compiler has over 7 million lines of code.

The Haskell toolchain is clean and consists of relatively small amounts of code. GHC totals around 0.5 million lines, including all of its Haskell dependencies. This makes it possible for a single programmer to be familiar with Haskell’s compiler, runtime, and libraries in their entirety.

Summary

A number of technical and non-technical points come together in making Haskell a great choice for cryptocurrency implementations. This is especially true when it comes to safety and programming ecosystems.

One of the biggest strengths of Haskell for cryptocurrencies is its advertisability:

Haskell has a reputation for excelling in these areas. It is already known and respected for providing strong guarantees and for being made and used by experts. At time of writing coinmarketcap.com listed 1595 existing cryptocurrencies. A new cryptocurrency can set itself apart from that competition by drawing attention to the improved safety and quality derived from being built in Haskell.

If you liked this post you may also like:

fpc-fintech-tofu-banner

Subscribe to our blog via email

Email subscriptions come from our Atom feed and are handled by Blogtrottr. You will only receive notifications of blog posts, and can unsubscribe any time.

Tagged