Fix #8958.

We now do role inference on stupid datatype contexts, allowing a
lightweight role annotation syntax.

(cherry picked from commit d468cd376ffc02cf9f4755275a316be914c482be)
windows: Fix #8870

This bumps the amount of default reserved and committed stack for GHC
executables to 8mb, to work around #8870. A proper fix should happen in
7.8.2

See note [Windows stack usage] in SysTools for the details.

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit f0af58df4b5d5ace750e7d7a91ad471284c1b429)
Make sure that polykinded Typeable is defaultable (Trac #8931)

(cherry picked from commit 791f4fa24dd6929ab2e55c9f8b870d8078337427)
Test Trac #8931

(cherry picked from commit 8bf8ce1e7cb1b97a1f18ec6f5552e339808ffba9)
Fix copy/paste error (#8937)

(cherry picked from commit 59b9b067b030d551f9b42423b50770c661c9d86c)
Fix desguaring of bang patterns (Trac #8952)

A palpable bug, although one that will rarely bite

(cherry picked from commit 3671d0027329804a31a628a5bee355e0640a2045)
Revert "Revert ad15c2, which causes Windows seg-faults (Trac #8834)"

This reverts commit a79613a75c7da0d3d225850382f0f578a07113b5.

(cherry picked from commit c6c86789c95462216a3167d7b98b202a5bf4c0b2)
Require PatternSynonyms language flag when encountering a use of pattern synonym
(#8961)

(cherry picked from commit 8f831ec578d22419788542290e164c50524d90f6)
T8958: fix stderr

Signed-off-by: Austin Seipp <austin@well-typed.com>
users_guide: note -XPatternSynonyms is required for use sites

Signed-off-by: Austin Seipp <austin@well-typed.com>
(cherry picked from commit b059dcc81e9c4097b5f04f85e1ac33586c494110)
Update ANNOUNCE for GHC 7.8.1

Signed-off-by: Austin Seipp <austin@well-typed.com>
Set VERSION=7.8.1, RELEASE=YES

Signed-off-by: Austin Seipp <austin@well-typed.com>
Set RELEASE=NO

Signed-off-by: Austin Seipp <austin@well-typed.com>
Fix egregious blunder in the type flattener

In tidying up the flattener I introduced an error that no
regression test caught, giving rise to Trac #8978, #8979.
It shows up if you have a type synonym whose RHS mentions
type functions, such sas
     type family F a
     type T a = (F a, a)   -- This synonym isn't properly flattened

The fix is easy, but sadly the bug is in the released GHC 7.8.1

(cherry picked from commit b8132a9d2fdb93c5d30107b1d531dd73ac27b262)
Place static closures in their own section.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
BC-breaking changes to C-- CLOSURE syntax.

Previously, there were two variants of CLOSURE in C--:

    - Top-level CLOSURE(foo_closure, foo, lits...), which defines a new
      static closure and gives it a name, and

    - Array CLOSURE(foo, lits...), which was used for the static char
      and integer arrays.

They used the same name, were confusing, and didn't even generate
the correct internal label representation!  So now, we have two
new forms:

    - Top-level CLOSURE(foo, lits...) which automatically generates
      foo_closure (along with foo_info, which we were doing already)

    - Array ANONYMOUS_CLOSURE(foo, lits...) which doesn't generate
      a foo_closure identifier.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Properly generate info tables for static closures in C--.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Rename _closure to _static_closure, apply naming consistently.

In preparation for indirecting all references to closures,
we rename _closure to _static_closure to ensure any old code
will get an undefined symbol error.  In order to reference
a closure foobar_closure (which is now undefined), you should instead
use STATIC_CLOSURE(foobar).  For convenience, a number of these
old identifiers are macro'd.

Across C-- and C (Windows and otherwise), there were differing
conventions on whether or not foobar_closure or &foobar_closure
was the address of the closure.  Now, all foobar_closure references
are addresses, and no & is necessary.

CHARLIKE/INTLIKE were not changed, simply alpha-renamed.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Implement closure indirections.

Closure indirections live in the staticclosureinds section
and initially point to their corresponding closure in
the staticclosures.  The intent is that all code goes through
a closure indirection, and at runtime the indirections can
change.

These pieces of code have to go through closure indirections:

    - Code references to a static closure
    - SRTs
    - Heap check (but we want to fix this)
    - References to closures in RTS (see STATIC_CLOSURE) macro
    - Runtime symbol lookup (e.g. GHCi, dynwrapper)
    - The main closure passed to hs_main

Closure indirections should simplify these components (but that
is not implemented yet):

    - Windows DLL handling (which already needed an indirection)

In order to keep the code running, the fields of static closures
are not indirected (although they should be); this will be switched
over in a later commit.

Important invariant: an indirection may only be dereferenced
after the runtime is setup.  In particular, references to
closures in __attribute__(constructor) need to be kept indirections;
this is what the stable pointer deferral is for.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Implement runtime setup code for static closures.

Fields of static closures are now indirected, and we have a simple
runtime initialization code initStaticClosures() which merely rewrites
all of the indirections into untagged pointers and untangles references
between the static closures.  This also copies static closures into
blocks, although this data is unused.

The runtime system finds out about indirections by way of
__attribute__(constructor) methods; thus C-- compilation may now
generate foreign stubs (if it defines closures).

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>