Merge branch 'master' of http://darcs.haskell.org/ghc

Conflicts:
	compiler/basicTypes/MkId.lhs
	compiler/iface/IfaceSyn.lhs
A bit more tracing
Remember to zonk when taking free variables in simpl_top

Forgetting this meant that we were upating the same
meta-tyvar twice.  Fixes Trac #7525.
Merge branch 'master' of http://darcs.haskell.org/ghc
Comment typo only
Simplify the binder-swap transformation

The occurrence analyser implements the "binder-swap" transformation,
described in Note [Binder swap] in OccAnal. For some reason I had
implemeted an extremely complicated version, I believe intended to get
as much as possible done in single simplifier pass.  But it turned
out (Trac #7258) that the 'getProxies' bit of this complicated code
scaled rather non-linearly, and all by itself could consume half of
the entire compile time.

The patch dramatically simplifies the transformation, so that
we simply swizzle
     case x of y { I# v -> e }
to
     case x of y { I# v -> let x = y in e }

I can't see any reason not to do this

  * Compiler allocation for #7258 with 200 fields goes down by 25%
    and compile time by 20%

  * The nofib figures do not budge

  * Quite a bit of complicated code goes away
Add traceSmpl for simplifier tracing, now that the simplifier has the IO monad
Make combine-identical-alternatives work again (Trac #7360)

Move the "combine indentical alternatives" transformation *before*
simplifying the alternatives.  For example
     case x of y
        [] -> length y
        (_:_) -> length y }

If we look *post* simplification, since 'y' is used in the
alterantives, the case binders *might* be (see the keep_occ_info test
in Simplify.simplAlt); and hence the combination of the two
alteranatives does not happen.  But if we do it *pre* simplification
there is no problem.

This fixes Trac #7360.
Make the treatment of addAltUnfoldings handle casts

This minor refactoring re-attaches Note [Add unfolding for scrutinee].
It had become detached, which led me on a bit of a wild goose
chase.

While I was at it, I made the code work right for the case where
the scrutinee is of form (x |> co); I don't think this is an important
improvement.

I also make simplAlt unconditionally zap occurrence information on
case-alternative binders (see Note [Case alternative occ info]);
it was almost always being zapped and the additional complexity seems
not worth it.
Fix dictionaries for SingI.

This adds the missing coercions in the constructed evidence for SingI.
Previously we simply passed an integer or a string for the evidence,
which was not quite correct and causes errors when the core lint is
enabled.   This patch corrects this by inserting the necessary
coercions.
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Remove references to GHC 6.6 in docs
Fix typo in comment (Trac #7526)
Refactor the invariants for ClsInsts

We now have the invariant for a ClsInst that the is_tvs field
is always completely fresh type variables. See
Note [Template tyvars are fresh] in InstEnv.

(Previously we frehened them when extending the instance environment,
but that seems messier because it was an invariant only when the
ClsInst was in an InstEnv.  Moreover, there was an invariant that
thet tyvars of the DFunid in the ClsInst had to match, and I have
removed that invariant altogether; there is no need for it.)

Other changes I made at the same time:

 * Make is_tvs into a *list*, in the right order for the dfun type
   arguments.  This removes the wierd need for the dfun to have the
   same tyvars as the ClsInst template, an invariant I have always
   hated. The cost is that we need to make it a VarSet when matching.
   We could cache an is_tv_set instead.

 * Add a cached is_cls field to the ClsInst, to save fishing
   the Class out of the DFun.  (Renamed is_cls to is_cls_nm.)

 * Make tcSplitDFunTy return the dfun args, not just the *number*
   of dfun args

 * Make InstEnv.instanceHead return just the *head* of the
   instance declaration.  Add instanceSig to return the whole
   thing.
Comments and white space only
Make the comments about SingI and EvLit match current reality

See Note [SingI and EvLit] in TcEvidence.
In type or data instances, check that all variables are bound

Trac #7536 points out that it's possible for the LHS to *look*
as if it binds variables, but does not acutally do so

         type T a = Int
         type instance F (T a) = a

This patch makes it an error.
Merge branch 'master' of http://darcs.haskell.org/ghc
Make the fib_tvs field of FamInstBranch into a *list* not a *set*

This follows the correspondig change in ClsInst
Merge branch 'master' of http://darcs.haskell.org/ghc