ouroboros-network icon indicating copy to clipboard operation
ouroboros-network copied to clipboard

ghc-9.2.4 compatibility

Open angerman opened this issue 1 year ago • 1 comments

This merges #4003 and #4001, and tries to look at the codebase with 9.2.4

I'm not sure the FlexibleContexts fix is proper.

angerman avatar Sep 16 '22 03:09 angerman

For reference, this is the error 9.2.4 provides:

	src/Ouroboros/Network/Testing/ConcreteBlock.hs:124:10: error:
	    • Non type-variable argument
	        in the constraint: Hashable (HeaderHash b)
	      (Use FlexibleContexts to permit this)
	    • In the instance declaration for ‘Hashable (ChainHash b)’
	    |
	124 | instance Hashable (HeaderHash b) => Hashable (ChainHash b)
	    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

following the FlexibleContexts suggestion, GHC then suggests:

src/Ouroboros/Network/Testing/ConcreteBlock.hs:125:10: error:
    • Could not deduce (StandardHash b)
        arising from the superclasses of an instance declaration
      from the context: Hashable (HeaderHash b)
        bound by the instance declaration
        at src/Ouroboros/Network/Testing/ConcreteBlock.hs:125:10-58
      Possible fix:
        add (StandardHash b) to the context of the instance declaration
    • In the instance declaration for ‘Hashable (ChainHash b)’
    |
125 | instance Hashable (HeaderHash b) => Hashable (ChainHash b)
    |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

which leaves us with this fix, but that feels rather fishy.

angerman avatar Sep 16 '22 03:09 angerman