Haskell in Production: Haskoin
Tags: haskell, blockchain
Published: 2022-06-07 20:39:03

---
title: Haskell in Production: Haskoin
published: true
date: 2022-06-07 00:00:00 UTC
tags: haskell, blockchain
canonical_url: https://serokell.io/blog/haskell-in-production-haskoin
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wt468wo2kjysd6vtlsww.png
---

In this article of our [Haskell in Production](https://serokell.io/blog/haskell-in-production) series, I interview Jean-Pierre Rupp. Jean is the main developer of a set of Haskell libraries for Bitcoin and Bitcoin Cash. One of these, [Haskoin Store](https://github.com/haskoin/haskoin-store), serves all [Blockchain.com](https://www.blockchain.com/) requests for Bitcoin data from wallet and web explorer.

Read further to find out about the pros and cons of Haskell, why it is a popular choice for blockchain applications, and what tips Jean would give to people that want to develop a career working with functional programming languages.

## Interview with Jean-Pierre Rupp

### Hi! Could you tell us more about Haskoin and your role in this project?

[Haskoin Core](https://github.com/haskoin/haskoin-core) and [Node](https://github.com/haskoin/haskoin-node) are open source Haskell libraries for Bitcoin and Bitcoin Cash, I am one of the authors and primary maintainer of these.

While working for [Blockchain.com](https://www.blockchain.com/), I wrote [Haskoin Store](https://github.com/haskoin/haskoin-store), an open source blockchain indexer to replace their legacy backend, which was expensive and not very reliable or scalable. It currently serves almost all requests for Bitcoin and Bitcoin Cash data coming from the wallet and web explorer. It is the single service that handles the largest amount of traffic at the company.

![Jean-Pierre_Rupp, Haskoin](https://serokell.io/files/3c/3cgafz3h.card-Jean-Pierre_Rupp_(1).png)

### What features of Haskell were vital for the development of Haskoin?

Haskell’s type system and its expressive nature allowed for writing accurate code in a short timeframe. Property testing using [QuickCheck](https://hackage.haskell.org/package/QuickCheck) ensured that the code doesn’t break at the edges.

Explicit side effects and the use of mathematically sound abstractions makes code easier to reuse and compose, and also allows me to use libraries of higher-level functions and data structures instead of having to roll my own. That accelerates the process of writing software, while guaranteeing reliability of the resulting system.

Finally, using [Software Transactional Memory (STM)](https://hackage.haskell.org/package/stm) I wrote an actor framework called [NQE](https://github.com/jprupp/nqe). Using that framework I could make Haskoin Store use the great concurrency capabilities of Haskell to make the application performant, responsive, while keeping it easy to maintain and refactor.

### Based on your experience, what are pros and cons of using Haskell?

Haskell’s main advantage is soundness, the ability to write software components that have strong guarantees of accuracy, and for these guarantees to extend to the composition of such components building more complex systems out of them. This soundness of Haskell translates into being capable of reasoning about code more easily, which I find is usually where most programmers struggle when working with larger systems.

Haskell will nudge the programmer towards writing multiple small functions, reusing abstractions and following a declarative style that is easy to understand. On the other hand, object-oriented programs tend to have more dependencies and complex behaviors involving multiple classes and side effects galore that are much more difficult to reason about.

Not only are functions easy to write in Haskell, but data has this visual quality to it. It is a lot easier to convey meaning by using complex data types than by writing complex code. Haskell’s types are very rich, and the code can be often understood by just looking at data types being used.

The Glasgow Haskell Compiler outputs well-optimized code. I rarely find myself doing hacks on idiomatic Haskell code to get it to perform better. It is good enough out of the box. I have had people come to me with performance anxiety, asking me how I could live without being able to reason about low-level performance characteristics of my software. I simply learned to trust that once I get my big-O right, the program will run right.

The only thing that I may complain about Haskell is its syntax. On occasion I would like to refer to a data structure by using something similar to the object-oriented dot notation instead of having every field accessor be a function, to keep namespace pollution low and be able to reuse field names on my own data types. Sometimes I wish that function names could be reused for different type signatures for the same reason.

### Some people tend to describe Haskell as a language better suited for research or other academic needs. Is that true?

I don’t know, I have never done any research on computer science myself. I’m a high-school dropout. My only relationship with code has been working in industry and getting things done. I like Haskell because it helps me get things done.

### What is the language missing and what are the blockers to making Haskell more popular for commercial projects?

The learning curve can be steep. Monads do not compose. Perhaps a different abstraction for IO could help it become more popular, I don’t know.

All I know is if you want code that can be written quickly, while being both correct and easy to maintain, and can be used to write complex systems that just work and run fast, there’s hardly anything that can beat Haskell out there. That surely has to be worth something.

### Haskell seems like a very popular choice for blockchains and decentralized applications. Why do you think it is so?

Mathematically sound algorithms and money tend to fit together well. I think these sorts of decentralized applications are devilishly difficult to write properly, and Haskell makes it possible to get one person to do it in a reasonable timeframe.

I bet there are quite a few people writing blockchain software in multiple programming languages, but the ones who write Haskell, which I bet are a tiny fraction, tend to get it done well, which is why it gets so much visibility.

### Do you plan to develop more projects in Haskell at [Blockchain.com](http://Blockchain.com)? Can you describe them if they already exist?

I’ve moved on from [Blockchain.com](http://Blockchain.com). I’m still doing consulting for them and other companies in the space, but I’m looking to deploy my Haskell skills in an industry other than finance. Hopefully aviation. It’d be fun to work on projects involving avionics and automation. We’ll see.

### How has hiring Haskellers been for you? Have you noticed a lack of experienced developers or hirees in general?

People love Haskell. The learning curve is steep, but I’ve worked with colleagues who learned the language at a much faster rate than I did, and write better code than I do. It’s a matter of finding a problem that is engaging and keeps one interested.

### Do you have any initiatives in-house to train or upskill Haskell developers?

Not that I know of. All people I know who understand Haskell have taught themselves. It’d be interesting if demand in the industry were to grow such that training becomes a thing. I hope it comes to that.

### What do you think is the future of Haskell in the world of software development?

In my opinion, I expect that Haskell gets more widely adopted, as it is a quality programming language with a mature toolset that is loved by its users and allows to get things done faster and better.

Something that I find encouraging is Haskell’s influence in the development of other programming languages, as functional programming becomes the new paradigm, displacing object orientation over the next decade. This is happening already to languages like Kotlin and Rust, and I expect it to continue. Haskell is often a testbed for new ideas and research into functional programming that eventually find themselves permeating the industry at large.

### Are there any tips you’d like to give to people that want to have a career working with functional programming languages?

It is difficult to convince a client or employer to let you write a project for them in Haskell at first, but maybe you’d have an easier time getting to use Kotlin instead of Java, which would be a win for both already. And if you gain his trust and make him happy, perhaps you can convince him to try Haskell on a future project.

* * *

Big thanks to Jean for the interview! 🙏

To read more interviews with people that use Haskell to solve real-world problems, head to our [interview](https://serokell.io/blog/interviews) section. Also, be sure to follow us on [Twitter](https://twitter.com/serokell) or subscribe to our mailing list (via form below) to get updates whenever we release new articles.