This cherry picks the commit referenced on the associated trac ticket: https://ghc.haskell.org/trac/ghc/ticket/10232