add missing files (#8124)

(cherry picked from commit 3fba87599378afbcf425a0fc2a5a61d21e3719d4)
fix copy/pasto

(cherry picked from commit 176205cf0b89f76d904d381bdcd61e8685116bb7)
Run testcase for 8124 only with threaded ways

(cherry picked from commit 0014fb3dbf4a2096489a4800adf2d79a83a12274)
Make SetLevels do substitution properly (fixes Trac #8714)

Nowadays SetLevels floats case expressions as well as let-bindings,
and case expressions bind type variables.  We need to clone all such
floated binders, to avoid accidental name capture.  But I'd forgotten
to substitute for the cloned type variables, causing #8714.  (In the
olden days only Ids were cloned, from let-bindings.)

This patch fixes the bug and does quite a bit of clean-up refactoring
as well, by putting the context level in the LvlEnv.

There is no effect on performance, except that nofib 'rewrite' improves
allocations by 3%.  On investigation I think it was a fluke to do with
loop-cutting in big letrec nests.  But at least it's a fluke in the
right direction.

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
            Min          -0.4%     -3.0%    -19.4%    -19.4%    -26.7%
            Max          -0.0%     +0.0%    +17.9%    +17.9%      0.0%
 Geometric Mean          -0.1%     -0.0%     -0.7%     -0.7%     -0.4%

(cherry picked from commit ef44a429af4a630a153b5774d0e19dbcad8328d5)
Fix last-minute typo in SetLevels commit ef44a4

Sorry about that...

(cherry picked from commit 41f803105999ffe51a40d3c72d5994520496b7ea)
fix SHELL makefile variable to be set by the configure script (fixes #8783)

The patch provided by Christian Maeder <Christian.Maeder@dfki.de>
Signed-off-by: Karel Gardas <karel.gardas@centrum.cz>
Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit a0bcbb54481297f9ff329766529a8343c4853e3f)
Remove "Safe mode" check for Coercible instances

We assume that library authors supply correct role annotations
for their types, and therefore we do not need to check for
the availability of data constructors in Safe mode. See
discussion in #8725. This effectively fixes #8827 and #8826.

(cherry picked from commit 59722295bb8da8f01d37356fbed6aef7321a8195)
Remove code reporting issues with Safe Haskell and coerce.

This is a followup to the fix for #8827, and should be merged
with that change.

(cherry picked from commit 7602bd4de901e4304a3a45dca08fc630d1bb5bf2)
Fix incorrect blocksize calculation on Win64

Fixes #8839

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit b7e5d722c6811f34253d8202540dd9b0ec1b6766)
Document Coercible in the user guide

as a subsection of "Equality constraints", containing references to the
module's haddock and to the paper. Fixes #8888

(cherry picked from commit 1e36a386042248523de69ad6b02c43a6631ed5d0)
Fix #8884.

There were two unrelated errors fixed here:
 1) Make sure that only the *result kind* is reified when reifying
    a type family. Previously, the whole kind was reified, which
    defies the TH spec.

 2) Omit kind patterns in equations.

(cherry picked from commit 8c5ea91d68cdc79b413e05f7dacfd052f5de8c64)

Conflicts:
	testsuite/tests/th/all.T
Export runTcInteractive from TcRnDriver, and from GHC (Trac #8878)

(cherry picked from commit 60bbc0af79ddfe977d93e271b57c2bc25d3fcde6)
Unify, rather than match, in GND processing (fixes Trac #8865)

Yet another small way in which polymorphic kinds needs a bit of care
See Note [Unify kinds in deriving] in TcDeriv

(cherry picked from commit f521a26cb741409011137115d17232df901c3c94)

Conflicts:
	testsuite/tests/deriving/should_compile/all.T
Fix incorrect maxStkSize calculation (#8858)

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit b99ace39cb2484bfc2d648b55a1a43ed78e4b9a0)
disable shared libs on sparc (linux/solaris) (fixes #8857)

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit 623883f1ed0ee11cc925c4590fb09565403fd231)
DriverPipeline: Ensure -globalopt is passed to LLVM opt

While -O1 and -O2 both include -globalopt, the order in which the passes are
run means that aliases aren't resolved which then causes llc to fall over.
See GHC bug #8855.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit b84b5da4430aacd5bf8422b06a861cd0584f99cf)
Test #8851.

(cherry picked from commit 1ac91146dc3431742eafd33ed4afc552ca17fb64)

Conflicts:
	testsuite/tests/deriving/should_compile/all.T
Improve documentation of standalone deriving (c.f. Trac #8851)

(cherry picked from commit 9d14262299fe721e49eb0efadebca9d095c834b3)
Recharacterize test according to discussion in #8851.

(cherry picked from commit 8ee6162e9a3377cd4c79f49b63f92046b0d5c708)

Conflicts:
	testsuite/tests/deriving/should_compile/all.T
Attach the right location to pattern synonym error message (fixes Trac #8841)

(cherry picked from commit 96daafc3305a691590b88c1175a8f45e5d327471)