A Few Haskell Highlights of 2019

Gints Dreimanis
Article by Gints Dreimanis
Friday, December 27th, 2019

2019 was a great year for us, and for Haskell overall.

While I am contractually obliged to praise a bit biased towards Haskell, it did actually seem that more companies were using Haskell in production and searching for Haskell employees this year, which, hopefully, is a tendency that will persist.

To close out the year, I’ve asked my coworkers about notable highlights from this year and separated the answers into 4 groups: releases, books, talks, and blog posts.

Disclaimer: this is not meant to be an extensive list, think about it more like a “nice conversation starter”.

Releases

Haskell releases

GHC 8.10 Alpha

GHC is the standard compiler for Haskell, and November saw the release of the alpha version for GHC 8.10.

It brought new extensions:

  • UnliftedNewtypes is motivated by the necessity to write performant code with unboxed types in a safe manner. Previously we had little liberty to mash unboxed types with boxed ones in type wrappers (the latter are a cornerstone of writing safe APIs for Haskell libraries). Now we can!
  • StandaloneKindSignatures is an extension which our GHC developer Vladislav Zavialov implemented that allows for more flexibility while writing kind-polymorphic code, bringing us one little step closer to the grand unification promised by the dependent Haskell initiative.

Even if you don’t write complex kinded code, you can use standalone kind signatures to have some practice in thinking with kinds: writing kind signatures explicitly. Just like you could write f x = x + x and let the compiler infer types, and you could write

f :: Num a => a -> a 
f x = x + x 

to check if you understand what you wrote correctly, you can now write

type MyEither :: Type -> Type -> Type
data MyEither a b = Left a | Right b 

to make sure that the types you write are shaped the way you intended.

GHC 8.10 also features several improvements in code generation, and other upgrades beyond that.

Want to contribute to GHC? Check out this contributor’s cheatsheet by Vlad: https://ghc.dev/

Cabal 3.0

Cabal is a package system for Haskell software that helps us to easily distribute programs and use software created by others.

Version 3.0 of Cabal was released in August, and it finally has moved on to Nix-style (reproducible) local builds that combine the best of non-sandboxed and sandboxed Cabal.

You could previously access them through cabal v2-build, but now they have become mature enough to be the main type of build for Cabal. With Cabal switching hell to heaven, stackage becomes more and more of a social phenomenon rather than a technological advance, which is—undoubtedly—a good thing.

Polysemy

polysemy is a library that implements “effects” as seen in languages like PureScript. In its capabilities (no pun intended), it’s similar to mtl and freer-simple, but it is supposed to be advantageous to other libraries for several reasons.

If you want a beginner-friendly tutorial on the library, you can head here.

Agda 2.6

Haskell is a great tool for writing compilers for other languages, and one of those is Agda, a dependently typed programming language / interactive theorem prover.

In 2019, we got the release of Agda 2.6. The key idea of the release is that it goes deeper down the rabid hole of type theory. The reader might be aware that there’s a lot of hype around homotopy type theory lately, however we were yet to obtain a practical computational framework for it. Agda 2.6 bridges that gap. It introduces something called Cubical mode, which adds the pillars of HoTT into the computational system of Agda.

To get to know Agda better, you can read this introductory post by Danya Rogozin.

Books

Haskell books

Thinking with Types

A book by Sandy Maguire, the author of polysemy library mentioned above, Thinking with Types is an extremely detailed guide to type-level programming in Haskell.

While it has managed to dodge getting mentioned in our Haskell beginner guides (here and here), it is a good option for a level-up if you are already a competent Haskell developer.

Optics by Example

Meant to be a comprehensive guide to optics in functional programming, Optics by Example by Chris Penner features both introduction to stuff like Lenses, Folds, Traversals, and yes, Prisms, and a deeper delve into the details.

To give an introduction of what you might get there, you can check out the Adventure of Optics blog posts by the same author on his blog.

Talks

Haskell talks

Monadic Party

Monadic party is a 4-day long summer school that features lengthy talks and workshops that will make you into a better Haskell programmer.

All the videos from this year’s Monadic Party are published here, and I recommend you to check them out as they are quite practical and informative even for beginners.

Painless Software Development with Haskell

In this one, Paweł Szulc shows the magic behind some of the frequently used Haskell libraries (including the aforementioned polysemy). It’s very clearly explained, informative and the presence of alpacas also makes it quite fun.

A Taste of Type Theory

Recursive types, dependent types, propositions as types, identity types, types, types, types.

A great introduction into type theory here, and more.

How GHC Type Inference Engine Actually Works

Simon Peyton Jones showing how the type inference engine of GHC actually works behind the scenes, coupled with his trademark Comic-Sans-powered presentation style.

Unfortunately, the recording cuts out at the end, but you can view all the slides here.

Propagators

Several of my colleagues said it’s worth watching.

And now for an extra round:

Dependently Typed Haskell in Industry (Experience Report)

While not a highlight in the sense of the popularity of the talk, it is a highlight for the progress made that it actually describes: how dependent types are used in Haskell to write correct, fast, extensible and maintainable programs that achieve things.

At Serokell, we believe that Dependent Haskell is the future and act on it; it’s nice to know that we are not the only ones.

Blog posts

Haskell blog posts

What is good about Haskell?

There were a ton of great “Why Haskell” posts this year (we promise we will make one as well :) ), but if I had to choose one, I’d choose this one.

In the article, Haskell code is compared side-by-side with Python code to show how some features of Haskell like pattern matching and algebraic data types make code much cleaner.

It’s short, practical, and something I wouldn’t be embarrassed to show to a friend that uses Python.

Software Written in Haskell: Stories of Success

Talking about the visibility of production Haskell, we compiled places where Haskell is used (and it’s used even in large companies like Facebook and NASA!). A larger list is coming next year; in the meantime, enjoy our list of length 6.

How we made Haskell search strings as fast as Rust

https://tech.channable.com/posts/2019-03-13-how-we-made-haskell-search-strings-as-fast-as-rust.html

Clean, clear, practical, and with images!

In this post from Channable, they describe how they optimized their Haskell implementation Aho–Corasick string searching algorithm to a speed faster than a Rust implementation of the same algorithm.

Parse, don’t validate

https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/

“You, dear reader, ought to be parsing!”

Learn how to make types work for you in this extremely well-written blog post about type-driven design.

Practical introduction to Freer monads

https://captjakk.com/posts/2019-05-12-practical-intro-eff.html

Freer monads is one of the ways of structuring effects in Haskell programs, and this is a clear and (as it says) practical introduction to them.

We see great trends in Haskell this year. Its adoption has increased, there are more and more success stories of people using it in production. Efforts of grand unification (which are so close to our hearts) are yielding fruit, and people fight boilerplate in creative ways, shutting down the whole “too much typing with strong typing” argument. Here’s to productive 2019, and let’s make the 2020 even better!

Is there anything else you would like to add to the list of highlights? Let me know on social media like Facebook and Twitter.