-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
generics-sop seems to be broken when Generic
constraint used with data or type family on ghc 9.4.2
Minimal failing example:
The following typechecks on ghc <= 9.2
import qualified GHC.Generics as GHC
import Generics.SOP
data MyType a = MyType
{ field1 :: Int
, field2 :: String
}
deriving (GHC.Generic)
deriving anyclass (Generic)
data family MyDataFamilyType a
type family MyTypeFamilyType a
tstT :: Generic (MyType a) => ()
tstT = ()
tstDF :: Generic (MyDataFamilyType a) => ()
tstDF = ()
tstTF :: Generic (MyTypeFamilyType a) => ()
tstTF = ()
but fails to typecheck on 9.4.2 with error
• solveWanteds: too many iterations (limit = 4)
Unsolved: WC {wc_simple =
[W] irred_aeIP {0}:: Data.SOP.Constraint.AllF
SListI (Code (MyDataFamilyType a0)) (CIrredCan(irred))
[W] irred_aeIV {0}:: Data.SOP.Constraint.AllF
Top (Code (MyDataFamilyType a0)) (CIrredCan(irred))
[W] $dGeneric_aeIG {0}:: Generic (MyDataFamilyType a0) (CDictCan)
[W] $dAll_aeIO {0}:: All
SListI (Code (MyDataFamilyType a0)) (CDictCan)
[W] $dAll_aeIW {0}:: All
Top (Code (MyDataFamilyType a0)) (CDictCan(psc))}
Simples: {[W] irred_aeIP {0}:: Data.SOP.Constraint.AllF
SListI (Code (MyDataFamilyType a0)) (CIrredCan(irred)),
[W] irred_aeIV {0}:: Data.SOP.Constraint.AllF
Top (Code (MyDataFamilyType a0)) (CIrredCan(irred)),
[W] $dGeneric_aeIG {0}:: Generic (MyDataFamilyType a0) (CDictCan),
[W] $dAll_aeIO {0}:: All
SListI (Code (MyDataFamilyType a0)) (CDictCan),
[W] $dAll_aeIW {0}:: All
Top (Code (MyDataFamilyType a0)) (CDictCan(psc))}
• In the type signature:
tstDF :: forall a. Generic (MyDataFamilyType a) => ()
• Set limit with -fconstraint-solver-iterations=n; n=0 for no limit
-fconstraint-solver-iterations
does nothing here on n >= 0, and fails with OOM error on n = 0
Metadata
Metadata
Assignees
Labels
No labels