ekmett / hkd

higher-kinded data
Other
30 stars 2 forks source link

Build failure with GHC 8.6.5 #1

Closed RyanGlScott closed 3 years ago

RyanGlScott commented 3 years ago

Attempting to build hkd using GHC 8.6.5 results in the following error:

``` Resolving dependencies... Build profile: -w ghc-8.6.5 -O1 In order, the following will be built (use -v for more details): - hkd-0.2 (lib) (first run) Preprocessing library for hkd-0.2.. Building library for hkd-0.2.. [ 9 of 10] Compiling Data.HKD.Contravariant ( src/Data/HKD/Contravariant.hs, /home/ryanglscott/Documents/Hacking/Haskell/hkd/dist-newstyle/build/x86_64-linux/ghc-8.6.5/hkd-0.2/build/Data/HKD/Contravariant.o ) src/Data/HKD/Contravariant.hs:333:1: error: • Could not deduce (FSemideciding q1 f) arising from a use of ‘fsemideciding’ from the context: FSemideciding q f bound by the instance declaration at src/Data/HKD/Contravariant.hs:333:1-77 or from: FSemidecidable f1 bound by the type signature for: fsemideciding :: forall (f1 :: (k2 -> Type) -> Type) (s :: k2 -> Type). FSemidecidable f1 => (s ~> Monoid.Alt f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s at src/Data/HKD/Contravariant.hs:333:1-77 or from: FSemidecidable f2 bound by an expression type signature: forall (f2 :: (k2 -> Type) -> Type) (s1 :: k2 -> Type). FSemidecidable f2 => (s1 ~> Monoid.Alt f) -> (forall (b :: k2 -> Type). q b => f2 b) -> f2 s1 at src/Data/HKD/Contravariant.hs:333:1-77 The type variable ‘q1’ is ambiguous Relevant bindings include fsemideciding :: (s ~> Monoid.Alt f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s (bound at src/Data/HKD/Contravariant.hs:333:1) • In the third argument of ‘coerce’, namely ‘fsemideciding’ In the expression: coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s In an equation for ‘fsemideciding’: fsemideciding = coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s When typechecking the code for ‘fsemideciding’ in a derived instance for ‘FSemideciding q (Monoid.Alt f)’: To see the code I am typechecking, use -ddump-deriv | 333 | deriving newtype instance FSemideciding q f => FSemideciding q (Monoid.Alt f) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ src/Data/HKD/Contravariant.hs:333:1: error: • Could not deduce: q b from the context: FSemideciding q f bound by the instance declaration at src/Data/HKD/Contravariant.hs:333:1-77 or from: FSemidecidable f1 bound by the type signature for: fsemideciding :: forall (f1 :: (k2 -> Type) -> Type) (s :: k2 -> Type). FSemidecidable f1 => (s ~> Monoid.Alt f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s at src/Data/HKD/Contravariant.hs:333:1-77 or from: FSemidecidable f2 bound by an expression type signature: forall (f2 :: (k2 -> Type) -> Type) (s1 :: k2 -> Type). FSemidecidable f2 => (s1 ~> Monoid.Alt f) -> (forall (b :: k2 -> Type). q b => f2 b) -> f2 s1 at src/Data/HKD/Contravariant.hs:333:1-77 or from: q1 b bound by a type expected by the context: forall (b :: k2 -> Type). q1 b => f2 b at src/Data/HKD/Contravariant.hs:333:1-77 • In the third argument of ‘coerce’, namely ‘fsemideciding’ In the expression: coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s In an equation for ‘fsemideciding’: fsemideciding = coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Alt f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s When typechecking the code for ‘fsemideciding’ in a derived instance for ‘FSemideciding q (Monoid.Alt f)’: To see the code I am typechecking, use -ddump-deriv • Relevant bindings include fsemideciding :: (s ~> Monoid.Alt f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s (bound at src/Data/HKD/Contravariant.hs:333:1) | 333 | deriving newtype instance FSemideciding q f => FSemideciding q (Monoid.Alt f) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ src/Data/HKD/Contravariant.hs:334:1: error: • Could not deduce (FSemideciding q0 f) arising from a use of ‘fsemideciding’ from the context: FSemideciding q f bound by the instance declaration at src/Data/HKD/Contravariant.hs:334:1-76 or from: FSemidecidable f1 bound by the type signature for: fsemideciding :: forall (f1 :: (k2 -> Type) -> Type) (s :: k2 -> Type). FSemidecidable f1 => (s ~> Monoid.Ap f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s at src/Data/HKD/Contravariant.hs:334:1-76 or from: FSemidecidable f2 bound by an expression type signature: forall (f2 :: (k2 -> Type) -> Type) (s1 :: k2 -> Type). FSemidecidable f2 => (s1 ~> Monoid.Ap f) -> (forall (b :: k2 -> Type). q b => f2 b) -> f2 s1 at src/Data/HKD/Contravariant.hs:334:1-76 The type variable ‘q0’ is ambiguous Relevant bindings include fsemideciding :: (s ~> Monoid.Ap f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s (bound at src/Data/HKD/Contravariant.hs:334:1) • In the third argument of ‘coerce’, namely ‘fsemideciding’ In the expression: coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s In an equation for ‘fsemideciding’: fsemideciding = coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s When typechecking the code for ‘fsemideciding’ in a derived instance for ‘FSemideciding q (Monoid.Ap f)’: To see the code I am typechecking, use -ddump-deriv | 334 | deriving newtype instance FSemideciding q f => FSemideciding q (Monoid.Ap f) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ src/Data/HKD/Contravariant.hs:334:1: error: • Could not deduce: q b from the context: FSemideciding q f bound by the instance declaration at src/Data/HKD/Contravariant.hs:334:1-76 or from: FSemidecidable f1 bound by the type signature for: fsemideciding :: forall (f1 :: (k2 -> Type) -> Type) (s :: k2 -> Type). FSemidecidable f1 => (s ~> Monoid.Ap f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s at src/Data/HKD/Contravariant.hs:334:1-76 or from: FSemidecidable f2 bound by an expression type signature: forall (f2 :: (k2 -> Type) -> Type) (s1 :: k2 -> Type). FSemidecidable f2 => (s1 ~> Monoid.Ap f) -> (forall (b :: k2 -> Type). q b => f2 b) -> f2 s1 at src/Data/HKD/Contravariant.hs:334:1-76 or from: q0 b bound by a type expected by the context: forall (b :: k2 -> Type). q0 b => f2 b at src/Data/HKD/Contravariant.hs:334:1-76 • In the third argument of ‘coerce’, namely ‘fsemideciding’ In the expression: coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s In an equation for ‘fsemideciding’: fsemideciding = coerce @(((~>) s f :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) @(((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s) fsemideciding :: forall (f :: (k -> Type) -> Type) (s :: k -> TYPE GHC.Types.LiftedRep). (FSemidecidable f :: Constraint) => ((~>) s (Monoid.Ap f :: k -> TYPE GHC.Types.LiftedRep) :: TYPE GHC.Types.LiftedRep) -> (forall (b :: k -> Type). q b => f b) -> f s When typechecking the code for ‘fsemideciding’ in a derived instance for ‘FSemideciding q (Monoid.Ap f)’: To see the code I am typechecking, use -ddump-deriv • Relevant bindings include fsemideciding :: (s ~> Monoid.Ap f) -> (forall (b :: k2 -> Type). q b => f1 b) -> f1 s (bound at src/Data/HKD/Contravariant.hs:334:1) | 334 | deriving newtype instance FSemideciding q f => FSemideciding q (Monoid.Ap f) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```

Since this doesn't happen on GHC 8.8.4 or later, I'm guessing that this is due to an old GHC typechecker bug of some sort.

RyanGlScott commented 3 years ago

I've submitted a possible fix in #2.