Draft: Use Concrete# for defaulting of RuntimeReps
This MR attempts to address the two issues outlined in #17201.
(1)
f1 :: forall (p :: RuntimeRep -> Type) (r :: RuntimeRep). p r -> p r
f1 x = x
g1 = f1
We want to infer the same type for g1
as for f1
, instead of the p LiftedRep -> p LiftedRep
we get currently, because of RuntimeRep
defaulting.
(2)
f x = x
g = f 0#
we would like to accept this with f :: forall (a :: TYPE IntRep). a -> a
How?
When inferring a type:
- Make type variables that appear within a
Concrete#
constraints monoTyVars inGHC.Tc.Solver.decideMonoTyVars
. This means we don't quantify over them. - After constraint solving, we do typeclass-like defaulting for
Concrete#
constraints.