Skip to main content
BOB 2019

Logo of BOB 2019 BOB 2019

22nd March 2019

Berlin, Germany

Part of the BOB series

Inspection Testing

A Promise Checked is a Promise Kept

Some high-quality Haskell libraries, including old friends like text and new kids on the block like generic-lens, promise that the abstractions provided by these libraries are actually free and will be completely dissolved by the compiler. In the case of text the promise is that certain pipelines of text-processing functions will be optimizes (“fused”) to never allocate a full text value; generic-lens promises that its generically derived lenses are, after optimization, identical to handwritten ones.

But, in practice, these promises often don’t hold. They held at some point in the past, when the author checked them manually, but later versions regressed.

This problem can be fixed with inspection-testing, a Haskell library and plugin to the compiler that allows you to explicitly state what you expect from the compilers optimizations, and have the compiler check that it actually happens. This can be used by library authors to test their promises, but also by users to learn more about what the compiler does with their code.

In this talk, you will discover the tale of broken promises in commonly used Haskell libraries, and you will learn how these promises can be checked automatically using inspection-testing.

This session is held on in Talks #1