Can't compile vector-space with GHC 9.10.1
Summary
The vector-space package (unchanged for 5 years) will not compile under GHC 9.10.1.
Steps to reproduce
With appropriate GHC & cabal, just try to build the repo. Fails with the following errors:
[5 of 9] Compiling Data.AffineSpace ( src/Data/AffineSpace.hs, dist/build/Data/AffineSpace.o, dist/build/Data/AffineSpace.dyn_o )
src/Data/AffineSpace.hs:152:10: error: [8;;https://errors.haskell.org/messages/GHC-39999GHC-399998;;]
• Could not deduce ‘AdditiveGroup
(Scalar
(Diff (Gnrx.Rep p ghc-internal-9.1001.0:GHC.Internal.Base.Void)))’
arising from the superclasses of an instance declaration
from the context: InnerSpace (Diff (VRep p))
bound by the instance declaration
at src/Data/AffineSpace.hs:152:10-65
Possible fix:
If the constraint looks soluble from a superclass of the instance context,
read 'Undecidable instances and loopy superclasses' in the user manual
• In the instance declaration for ‘InnerSpace (GenericDiff p)’
|
152 | instance InnerSpace (Diff (VRep p)) => InnerSpace (GenericDiff p)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
src/Data/AffineSpace.hs:163:10: error: [8;;https://errors.haskell.org/messages/GHC-39999GHC-399998;;]
• Could not deduce ‘AdditiveGroup (Scalar (Diff (g p)))’
arising from the superclasses of an instance declaration
from the context: (AffineSpace (f p), AffineSpace (g p),
InnerSpace (Diff (f p)), InnerSpace (Diff (g p)),
Scalar (Diff (f p)) ~ Scalar (Diff (g p)),
Num (Scalar (Diff (f p))))
bound by the instance declaration
at src/Data/AffineSpace.hs:(163,10)-(167,48)
Possible fix:
If the constraint looks soluble from a superclass of the instance context,
read 'Undecidable instances and loopy superclasses' in the user manual
• In the instance declaration for
‘InnerSpace (AffineDiffProductSpace f g p)’
|
163 | instance ( AffineSpace (f p), AffineSpace (g p)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
Expected behavior
Did this code have a long-standing bug, or is GHC doing the wrong thing here?
The fix is pretty simple - just add those contexts to the instance declaration.
Environment
- GHC version used: 9.10.1
Optional:
- Operating System: MacOS
- System Architecture: M2