1. 23 Jul, 2012 2 commits
    • Simon Peyton Jones's avatar
      Numerous small changes to the constraint solver · 9c0a6bbb
      Simon Peyton Jones authored
      The main thing is that we now keep unsolved Derived constraints in the
      wc_flats of a WantedConstraints, rather than discarding them each time.
      This actually fixes a poential (admittedly obscure) bug, when we currently
      discard a superclass constraint, and may never re-generate it, and may
      thereby miss a functional dependency.
      
      Instead, reportErrors filters out Derived constraints that we don't want
      to report.
      
      The other changes are all small refactorings following our walk-through.
      9c0a6bbb
    • Simon Peyton Jones's avatar
      be86a8f7
  2. 19 Jul, 2012 3 commits
  3. 18 Jul, 2012 1 commit
  4. 16 Jul, 2012 3 commits
  5. 15 Jul, 2012 2 commits
  6. 14 Jul, 2012 4 commits
  7. 12 Jul, 2012 1 commit
  8. 11 Jul, 2012 1 commit
  9. 10 Jul, 2012 6 commits
  10. 27 Jun, 2012 1 commit
    • Simon Peyton Jones's avatar
      Add silent superclass parameters (again) · aa1e0976
      Simon Peyton Jones authored
      Silent superclass parameters solve the problem that
      the superclasses of a dicionary construction can easily
      turn out to be (wrongly) bottom.  The problem and solution
      are described in
         Note [Silent superclass arguments] in TcInstDcls
      
      I first implemented this fix (with Dimitrios) in Dec 2010, but removed
      it again in Jun 2011 becuase we thought it wasn't necessary any
      more. (The reason we thought it wasn't necessary is that we'd stopped
      generating derived superclass constraints for *wanteds*.  But we were
      wrong; that didn't solve the superclass-loop problem.)
      
      So we have to re-implement it.  It's not hard.  Main features:
      
        * The IdDetails for a DFunId says how many silent arguments it has
      
        * A DFunUnfolding describes which dictionary args are
          just parameters (DFunLamArg) and which are a function to apply
          to the parameters (DFunPolyArg).  This adds the DFunArg type
          to CoreSyn
      
        * Consequential changes to IfaceSyn.  (Binary hi file format changes
          slightly.)
      
        * TcInstDcls changes to generate the right dfuns
      
        * CoreSubst.exprIsConApp_maybe handles the new DFunUnfolding
      
      The thing taht is *not* done yet is to alter the vectoriser to
      pass the relevant extra argument when building a PA dictionary.
      aa1e0976
  11. 25 Jun, 2012 2 commits
  12. 22 Jun, 2012 1 commit
  13. 21 Jun, 2012 2 commits
    • jpm@cs.ox.ac.uk's avatar
      Allow deriving Generic1 · 156ec95a
      jpm@cs.ox.ac.uk authored
      This completes the support for generic programming introduced
      in GHC 7.2. Generic1 allows defining generic functions that
      operate on type containers, such as `fmap`, for instance.
      
      Along the way we have fixed #5936 and #5939, allowing
      deriving Generic/Generic1 for data families, and disallowing
      deriving Generic/Generic1 for instantiated types.
      
      Most of this patch is Nicolas Frisby's work.
      156ec95a
    • Simon Peyton Jones's avatar
      Remove the USAVOURY HACK in simplifyInfer · f450d36a
      Simon Peyton Jones authored
      See the discussion in Trac #4361.  The change fixes
      a regression in test IPRun.
      f450d36a
  14. 18 Jun, 2012 3 commits
  15. 15 Jun, 2012 1 commit
  16. 14 Jun, 2012 1 commit
  17. 13 Jun, 2012 1 commit
    • Simon Peyton Jones's avatar
      Simplify the implementation of Implicit Parameters · 5a8ac0f8
      Simon Peyton Jones authored
      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
      5a8ac0f8
  18. 12 Jun, 2012 5 commits