diff options
| author | Simon Peyton Jones <simonpj@microsoft.com> | 2012-06-13 17:21:09 +0100 | 
|---|---|---|
| committer | Simon Peyton Jones <simonpj@microsoft.com> | 2012-06-13 17:21:09 +0100 | 
| commit | 5a8ac0f823c151c062a3f1903574030423bb255c (patch) | |
| tree | 60c7bbe1091ddba9c404f8024928fcea83480523 /utils/parallel | |
| parent | 03f78f0686f048e75d671f2797c8684b71655c49 (diff) | |
| download | haskell-5a8ac0f823c151c062a3f1903574030423bb255c.tar.gz | |
Simplify the implementation of Implicit Parameters
This patch re-implements implicit parameters via a class
with a functional dependency:
    class IP (n::Symbol) a | n -> a where
      ip :: a
This definition is in the library module GHC.IP. Notice
how it use a type-literal, so we can have constraints like
   IP "x" Int
Now all the functional dependency machinery works right to make
implicit parameters behave as they should.
Much special-case processing for implicit parameters can be removed
entirely. One particularly nice thing is not having a dedicated
"original-name cache" for implicit parameters (the nsNames field of
NameCache).  But many other cases disappear:
  * BasicTypes.IPName
  * IPTyCon constructor in Tycon.TyCon
  * CIPCan constructor  in TcRnTypes.Ct
  * IPPred constructor  in Types.PredTree
Implicit parameters remain special in a few ways:
 * Special syntax.  Eg the constraint (IP "x" Int) is parsed
   and printed as (?x::Int).  And we still have local bindings
   for implicit parameters, and occurrences thereof.
 * A implicit-parameter binding  (let ?x = True in e) amounts
   to a local instance declaration, which we have not had before.
   It just generates an implication contraint (easy), but when
   going under it we must purge any existing bindings for
   ?x in the inert set.  See Note [Shadowing of Implicit Parameters]
   in TcSimplify
 * TcMType.sizePred classifies implicit parameter constraints as size-0,
   as before the change
There are accompanying patches to libraries 'base' and 'haddock'
All the work was done by Iavor Diatchki
Diffstat (limited to 'utils/parallel')
0 files changed, 0 insertions, 0 deletions
