Skip to content

Broken backward compatibility from GHC 9.4.5 to GHC 9.6.1 in Eq and Ord instances of Data.Functor.Compose

Edit: this is now fully explained by @Bodigrim and not a bug, only the question of meta-documentation remaining, please see the last comments.

Summary

Eq and Ord instances of Data.Functor.Compose have to be manually written in 9.4.5 to compile a code, while 9.6.1 errors out claiming they are duplicate (presumably already written in module Data.Functor.Compose). 9.6.1 is probably right, but how to avoid CPPs? I can't find anything in Release Notes for 9.6.1. From a quick look, the classes are defined in base both for 9.6.1 and 9.4.5, but I haven't verified if the definition is the same.

Steps to reproduce

Clone

https://github.com/Mikolaj/horde-ad/commit/0152cfac4569ade762e4aa0bd7fda661ee94a6f5

and compile cabal test simplifiedOnlyTest under GHC 9.6.1 [Edit: it requires also --allow-newer]. (The test is going to fail, but that's another ticket.) With GHC 9.4.5 [Edit: with no --allow-newer required] the compilation fails.

Then clone

https://github.com/Mikolaj/horde-ad/commit/da16d0d4650f96e70917ea39dc830bd39c103734

which contains all but the last commit from above. This time, GHC 9.4.5 should succeed, but GHC 0.6.1 should fail.

Expected behavior

Bpth compilers should be able to accept a single version of this code.

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