Haskell, Strong Types, and the Next Generation of Bioinformatics: interview with Michal Gajda

4 min read Original article ↗

Bioinformatics sits at the intersection of scientific discovery and software engineering, where complex algorithms must operate on large, irregular, and often imperfect datasets. Although much of the field relies on Python, C++, R, and FORTRAN, functional languages such as Haskell offer a different approach, one built around strong types, composable abstractions, purity, and parallel scalability.

In this interview with Michal Gajda, we explore how Haskell can support reliable and high performance biological data processing, drawing on his experience with projects such as hPDB, JSON Autotype, and XML TypeLift. The conversation examines what strong typing brings to real world biotech pipelines, why purity may matter more than laziness, and how functional programming can help scientific software scale across an increasing number of processor cores.

We also discuss the practical barriers that continue to limit the adoption of Haskell, SML, OCaml, and related languages in bioinformatics, including education, beginner friendly tooling, streaming parsers, and ecosystem maturity. Finally, we consider whether AI assisted programming can make functional languages more accessible to the next generation of scientists.

aawljtf.personal_card-Michał_Gajda.jpg

You have worked across bioinformatics, Haskell, Python, SML, FORTRAN, and commercial software. What makes Haskell a good fit for scientific and biological data problems, and where did it make the work harder than expected?

Haskell excels in the efficient expression of complex algorithmic problems. Its advanced type system prevents many errors in advance. Typesafe generics express common programming patterns without sacrificing this safety. With decent library support that speeds up the code development allows one to focus on science instead of debugging segfaults, which are common in either C/C++ and Fortran.

Your hPDB project applied Haskell to processing biomolecular structures in Protein Data Bank format. What did this project teach you about using strong types, laziness, and functional abstractions for real-world biotech data?

My experience falsified most of the classical criticism of Haskell and functional programming: either Haskell and functional programming is now fast enough to compare with any other language. And the greatest strength of Haskell is strongly typed pure functional programming, not laziness! The consistent and mature support for pure functional programming allows us to scale our algorithms to multicore.

hPDB is still one of the fastest Protein Data Bank parsers in serial mode, and the only one that is ultrascalable as far as I know. Ultrascalability is a big thing for our future. With a growing number of cores, we need algorithms that scale performance linearly or almost linearly with the number of cores. This needs a lot of hard work on ultrascalability to bring the future!

Haskell has a lot of mature parser libraries for many of these formats. Whenever they can be parsed efficiently, implementing your analysis in Haskell may be the quickest way to a working prototype. We still need to work on incremental, streaming parsers, but most of the parsing projects read small data items, so this is not a big issue. But we usually see JSON-LD instead of multigigabyte XML files.

Data formats have two main issues: diversity and scale. The diversity issue is best solved by automatically generating parsers to implement libraries quickly from example data or schemas. But the scale of terabyte and petabyte data calls for different solutions that save memory by deforestation and streaming. I hope we will have memory efficient parsers that scale linearly and in parallel to huge datasets. Despite pioneering libraries like hPDB, these need work in the future.

I also used PureScript and Agda, and I am certain all four offer a lot to each other, since innovation transfer between these languages is easier. As a parallel programmer, I would love to see purity annotations in OCaml just like SAFE modules in Haskell and PURE/ELEMENTAL in Fortran. ML family modules. OCaml’s relatively lightweight RTS receives admiration from Haskell followers looking to MicroHS. Agda redefined theorem proving by allowing operator syntax that closely matches mathematical notation and equational style. PureScript has the easiest FFI that I have ever used.

Despite excellent tooling that is frequently faster than Python and C++, we still need to bring easy tutorials to the first-year bioinformatics courses, since research is most frequently done using methods learned during the basic courses. Bioinformatics thrives on the ease of expressing simple analyses and tuning them without advanced knowledge of laziness, algorithms, or type theory. Helium and Elm made excellent steps towards actionable error messages, but we still struggle to make functional programming a “drive-by” experience for junior students. AI lowers the accessibility barrier, so I hope to see more juniors using Haskell in the future.