carp-lang/Carp

CarpHask fails to build with hashable >= 1.4 (GHC 9.2 / Stackage LTS-20)

sternenseemann opened this issue · 4 comments

Building library for CarpHask-0.5.5.0..
[ 1 of 53] Compiling Map              ( src/Map.hs, dist/build/Map.o, dist/build/Map.dyn_o )
[ 2 of 53] Compiling Set              ( src/Set.hs, dist/build/Set.o, dist/build/Set.dyn_o )
[ 3 of 53] Compiling Util             ( src/Util.hs, dist/build/Util.o, dist/build/Util.dyn_o )
[ 4 of 53] Compiling SymPath          ( src/SymPath.hs, dist/build/SymPath.o, dist/build/SymPath.dyn_o )
[ 5 of 53] Compiling Types            ( src/Types.hs, dist/build/Types.o, dist/build/Types.dyn_o )
[ 6 of 53] Compiling TypesToC         ( src/TypesToC.hs, dist/build/TypesToC.o, dist/build/TypesToC.dyn_o )
[ 7 of 53] Compiling TypePredicates   ( src/TypePredicates.hs, dist/build/TypePredicates.o, dist/build/TypePredicates.dyn_o )
[ 8 of 53] Compiling Path             ( src/Path.hs, dist/build/Path.o, dist/build/Path.dyn_o )
[ 9 of 53] Compiling Info             ( src/Info.hs, dist/build/Info.o, dist/build/Info.dyn_o )
[10 of 53] Compiling Project          ( src/Project.hs, dist/build/Project.o, dist/build/Project.dyn_o )
[11 of 53] Compiling Obj              ( src/Obj.hs, dist/build/Obj.o, dist/build/Obj.dyn_o )

src/Obj.hs:1011:10: error:
    • No instance for (Eq Context)
        arising from the superclasses of an instance declaration
    • In the instance declaration for ‘Hashable Context’
     |
1011 | instance Hashable Context where
     |          ^^^^^^^^^^^^^^^^
[35 of 53] Compiling ColorText        ( src/ColorText.hs, dist/build/ColorText.o, dist/build/ColorText.dyn_o )

The cause is probably hashable-1.4.0.0 which changed the following:

Eq is now a superclass of Hashable. Also Eq1 is a superclass of Hashable1 and Eq2 is a superclass of Hashable2 when exists.

Thanks for reporting! Do you have a suggestion for what the correct fix is?

Looks like we'd need to declare an instance Eq Context or just derive Eq

So I fixed that, but there are further issues. We have a lot of "uni patterns" in let bindings let (FooData x y) = which we don't permit because we compile w/ exhaustive pattern checking, so we'll have to fix all those too. I'm guessing the prior version of GHC we were using didn't apply this check to let bindings or something.

see #1449 for a fix. let's see if the tests pass, though. it required touching a lot of code