Skip to content

Draft: Use Concrete# for defaulting of RuntimeReps

sheaf requested to merge sheaf/ghc:T17201 into master

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 in GHC.Tc.Solver.decideMonoTyVars. This means we don't quantify over them.
  • After constraint solving, we do typeclass-like defaulting for Concrete# constraints.
Edited by sheaf

Merge request reports