More type functions
~~~~~~~~~~~~~~~~~~~
* Allow {tv = TYPE ty) as a non-rec binding in Core
* Use this to make equality constraints more uniform
* Can a Dict can contain an EqPred?  
  How does that differ from an EqInst?
* Make DictBinds into Core

* In zonking, do we need to zonk the kinds of coercion variables?

Type functions
~~~~~~~~~~~~~~
* A Given inst should be a CoVar, not a coercion

* finaliseEqInst should not need to call zonk

* Why do we need fromGivenEqDict?  How could we construct 	
	a Dict that had an EqPred?
	newDictBndr should make an EqInst directly

* tc_co should be accessed only inside Inst

* Inst.mkImplicTy needs a commment about filtering out EqInsts
  How *do* we deal with wanted equalities?

* Inst.instType behaves inconsistently for EqInsts: it should
  return an EqPred, like the instType' hack in pprDictsTheta

  Consequences: adjust the uses of instType in TcSimplify

* tcDeref* functions are unused, except in tcGenericNormalizeFamInst, when
  we can equally well use TcMType.lookupTcTyVar

* Coercion.mkEqPredCoI looks very peculiar.




-------------------------
*** unexpected failure for jtod_circint(opt)


	New back end thoughts

-----------------------------------------------------------------------------
Codegen notes

* jumps to ImpossibleBranch should be removed.

* Profiling:
	- when updating a closure with an indirection to a function,
	  we should make a permanent indirection.

	- check that we're bumping the scc count appropriately

* check perf & binary sizes against the HEAD

-----------------------------------------------------------------------------
C backend notes

* use STGCALL macros for foreign calls (doesn't look like volatile regs
  are handled properly at the mo).

-----------------------------------------------------------------------------
Cmm parser notes

* switches

* need to cater for unexported procedures/info tables?

* We should be able to get rid of entry labels, use info labels only.
  - we need a %ENTRY_LBL(info_lbl) macro, so that instead of
     JMP_(foo_entry) we can write jump %ENTRY_LBL(foo_info).

-----------------------------------------------------------------------------

* Move arg-descr from LFInfo to ClosureInfo? 
  But: only needed for functions

* Move all of CgClosure.link_caf into NewCaf, and newDynCaf

* If the case binder is dead, and the constr is nullary,
  do we need to assign to Node?


-------------------------------
NB: all floats are let-binds, but some non-rec lets
    may be unlifted (with RHS ok-for-speculation)


simplArg:  [use strictness]
	   [used for non-top-lvl non-rec RHS or function arg]
  if strict-type || demanded
	simplStrictExpr
  else
	simplExpr ---> (floats,expr)
	float all the floats if exposes constr app, return expr

simpl (applied lambda)	    ==> simplNonRecBind
simpl (Let (NonRec ...) ..) ==> simplNonRecBind

simpl (Let (Rec ...)    ..) ==> simplRecBind

simplRecBind:
  simplify binders (but not its IdInfo)
  simplify the pairs one at a time
	using simplRecPair

simplNonRecBind:	[was simplBeta]
	[used for non-top-lvl non-rec bindings]
  - check for PreInlineUnconditionally
  - simplify binder, including its IdInfo
  - simplArg
  - if strict-type 
	addCaseBind [which makes a let if ok-for-spec]
    else
	completeLazyBind

simplLazyBind:	[binder already simplified, but not its IdInfo]
	  	[used for both rec and top-lvl non-rec]
		[must not be strict/unboxed; case not allowed]
  - check for PreInlineUnconditionally
  - substituteIdInfo and add result to in-scope 
	[so that rules are available in rec rhs]
  - simplExpr --> (floats,expr)
  - float: lifted floats only
	if exposes constructor or pap (even if non-triv args)
	or if top level
  - completeLazyBind
  

completeLazyBind: 	[given a simplified RHS]
	[used for both rec and non-rec bindings, top level and not]
  - try discarding dead
  - try PostInlineUnconditionally
  - let-bind coerce arg and repeat
  - try rhs tylam (float)
  - try eta expand (float)    [not if any float is unlifted && (non-spec || top_lvl || rec)]
  - let-bind constructor args [not if any float is ..as above..]

  - add unfolding [this is the only place we add an unfolding]
    add arity




Eta expansion
~~~~~~~~~~~~~~
For eta expansion, we want to catch things like

	case e of (a,b) -> \x -> case a of (p,q) -> \y -> r

If the \x was on the RHS of a let, we'd eta expand to bring the two
lambdas together.  And in general that's a good thing to do.  Perhaps
we should eta expand wherever we find a (value) lambda?  Then the eta
expansion at a let RHS can concentrate solely on the PAP case.
