Make splitStrProdDmd (and similarly Use) more robust

Signed-off-by: Austin Seipp <austin@well-typed.com>
Better debug printing

(cherry picked from commit b60df0fa017eac8800a3848650dbad09acb6f1b8)
Line up kind and type variables correctly when desugaring TH brackets

This bug was causing Trac #9199

(cherry picked from commit 571f0adccda687098d59f63524357f4ac98e72fb)

Conflicts:
	testsuite/tests/th/all.T
Fix Trac #9071, an egregious bug in TcDeriv.inferConstraints

The constraints for Functor don't line up 1-1 with the arguments
(they are fetched out from sub-terms of the type), but the surrounding
code was mistakenly assuming they were in 1-1 association.

(cherry picked from commit 13a330e87cf459311a7f164e1e57baf877741da6)

Conflicts:
	compiler/typecheck/TcDeriv.lhs
Adding missing test files for #9071

(cherry picked from commit 59b4e6d0ba504b33cc7064d489b8ec485a7703f4)
Fix elemLocalRdrEnv (Trac #9160)

This was pretty obscure.  elemLocalRdrEnv was utterly wrong (replied
False when it should reply True) when given an Exact Name. That
doesn't happen often, but it does happen in the result of a TH splice.
The result was that an associated type didn't get a type variable that
lined up with its parent class (elemLocalRdrEnv is used in
RnTypes.bindHsTyVars), and that messed up the singletons package.

I've made a completely different test case to show up the bug:
indexed_types/should_fail/T9160

I also refactored RdrName.LocalRdrEnv to be a record with named
fields, which makes the code more robust and easy to understand.

(cherry picked from commit b637585dcbfc1ba53aa49bcb9b730cd08fea4b59)

Conflicts:
	testsuite/tests/indexed-types/should_fail/all.T
Fix merge fallout, killing validate

Signed-off-by: Austin Seipp <austin@well-typed.com>