Skip to content

Adding a quantified constraint harms type reconstruction without a good reason

GHC 9.6.2 and older. A partially minimized example

https://play.haskell.org/saved/qfYAIPzc

The quantified constraint at the bottom necessitates an addition of a type applications elsewhere, as shown in the comment in the middle, for no good reason. It looks like the quantified constraint distracts the type-checker and it forgets some type variables.

A disastrous example in the wild, which may potentially exhibit also other problems:

https://github.com/Mikolaj/horde-ad/commit/58d9301a2062fe5adc6a66ff52498a74f493920f

(compile with cabal build --disable-optimization --allow-newer).

Edited by Mikolaj Konarski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information