Move strict binds checks to the typechecker
Note [Strict binds checks] in GHC.HsToCore.Binds
says:
There are several checks around properly formed strict bindings. They
all link to this Note. These checks must be here in the desugarer because
we cannot know whether or not a type is unlifted until after zonking, due
to representation polymorphism. These checks all used to be handled in the
typechecker in checkStrictBinds (before Jan '17).
Now that representation polymorphism is on solid ground, I believe those checks could be moved to the typechecker. For example, when typechecking a recursive binding x :: T; x = x
where T :: TYPE R
we can emit R ~ LiftedRep
, rather than checking this fact in the desugarer. This would remove one of the few remaining ways the desugarer could produce an error.
This ticket is a refactoring - there'd be no user-visible effects except slightly different error messages.