Keep kind-inconsistent Given type equalities (fixes Trac #8705)

I was too eager when fixing Trac #8566, and dropped too many
equalities on the floor, thereby causing Trac #8705.

The fix is easy: delete code.  Lots of new comments!

(cherry picked from commit 89d2c048c81020a701ac94d949b4d6f1ced37cfa)
Allow ($) to return an unlifted type (Trac #8739)

Since ($) simply returns its result, via a tail call, it can
perfectly well have an unlifted result type; e.g.
    foo $ True    where  foo :: Bool -> Int#
should be perfectly fine.

This used to work in GHC 7.2, but caused a Lint failure.  This patch
makes it work again (which involved removing code in TcExpr), but fixing
the Lint failure meant I had to make ($) into a wired-in Id.  Which
is not hard to do (in MkId).

(cherry picked from commit 5dd1cbbfc0a19e92d7eeff6f328abc7558992fd6)
Use NoGen plan for unboxed-tuple bindings

There was a small mixup here, exposed by Trac #8762.
Now clarified with better function names and comments.

(cherry picked from commit 47f473b0f7ddf21b2cde825166d092cb6e72329d)
Revert "Add comments explaining #8754"

This reverts commit b626c3d4ce0e66216705ba8355c914dc809e3fe7.

(cherry picked from commit 642bba349fda1508aa136f7169c0ba63fb00a6f9)
Revert "Fix #8754 in a round-about way."

This reverts commit 5023c91780e90947680fe0640f7564a4f6448bea.

(cherry picked from commit e789a4f51b6205160a696e3e6e13ecefb5ae16f7)
add omitted FP_PROG_AR_SUPPORTS_ATFILE into the distribution configure.ac (fixes #8794)

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

(cherry picked from commit 43c314c730d205a3ec8ef5d54e5bf72a7900f01d)
fix build failure on Solaris 10 due to RANLIB being set to ':' by configure (#8795)

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

(cherry picked from commit 5c6ced556a989e7fccfa2d4adc6f6bbe538a8e6c)
add more information about the nature of support of prefetch primops on none x86/AMD64 -fasm platforms (and -fvia)
to the 7.8 release notes

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

(cherry picked from commit 27fe12856a34488ea94291990238c37e5353d1a3)
fix sed expression in build dependencies rules to work well with non-GNU sed (fixes #8764)

The patch is 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 e638acb6a825559fbd93bdaf8ae2704535c157f1)
Switch on -dynamic-too with QuasiQuotes as well.

As pointed out by Albert Y. C. Lai on glasgow-haskell-users.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit e75ebc487b68a07bd632b51df62d9047c559f19f)
Clear up docs regarding LLVM backend (#8792)

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

(cherry picked from commit 2b34947b60069e51abfcada9c45a6d7b590f5a2b)
Fix #8801: exclude extra packages from the sdist.

This is special cased a little since it's cleaner, and we don't
necessarily want to remove nofib anyway - just the extra packages.

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

(cherry picked from commit f99a0321a8cf0507924a0d30b6b7b586d7855129)
Really fix #5682 (parsing of promoted datacons)

Patch submitted by an anonymous friend on the bug tracker.

This also fixes TH_RichKinds2 which had a slight message output wibble
(it uses the qualified name of the promoted datacon)

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

(cherry picked from commit d3af9807ca8a1db0bc9298ea50895ee9df55edb7)
RetainerProfile.c: include missing header (#8810)

Found by clang:

  rts_dist_HC rts/dist/build/RetainerProfile.p_o

  rts/RetainerProfile.c:1779:5:
     error: implicit declaration of function 'markStableTables' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        markStableTables(retainRoot, NULL);

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit 925b0a499dba8a891af06f1bd3f5caf063682b0b)
Add a test for d3af980 (#5682)

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

(cherry picked from commit 5a576754d745171422d13cd1dba69dd874714cf1)
Fix #8754 again.

This time, we carefully initialize the GC stats only if they're not
already initialized - this way the user can override them (e.g. `+RTS -t
--machine-readable`).

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

(cherry picked from commit c72e8898447b2a8e55f2d16594b5944c2ae13e24)
Fix installation of ghc-split (#8760)

The rules weren't correctly setting INSTALL_TOPDIRS, and on top of that
the dependencies were wrong when BINDIST=YES.

Authored-by: Evan Hauck <khyperia@live.com>
Authored-by: Austin Seipp <austin@well-typed.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>

(cherry picked from commit beac5252d444bafb0722bc6d13c6dd2d49a12070)
Update to primitive-0.5.2.1

This contains a compile-fix for Solaris

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
(cherry picked from commit 47d725f29376fa1be726e913cdf3dd69c46327c2)
Merge latest 'upstream/ghc-7.8' into ghc-7.8