WIP: Clean up printing of foralls

Open Chaitanya Koparkar requested to merge ckoparkar/ghc:T16320 into master

This patch implements the Clean up printing of foralls proposal:

  • Whenever printing variables quantified in a forall, print inferred variables with braces.

  • Maximally instantiate any inferred or dictionary arguments (class constraints) to expressions passed to :type

It also addresses a part of #16320. Specifically, it adds two more conditions to the predicate that decides if foralls should be printed. GHC will now print foralls if any of these is also true:

  • The foralls are not all at the top. Exception: foralls are allowed to be mixed with class constraints, but no foralls can appear under a proper ->.

  • Two quantified type variables are spelled the same

It does not address Inefficient implementation of eliminateRuntimeReps and Extremely confusing swizzling of foralls and contexts yet.

Edited by Chaitanya Koparkar

Merge request reports