1. 28 Sep, 2012 1 commit
  2. 20 Sep, 2012 1 commit
  3. 17 Sep, 2012 3 commits
    • Simon Peyton Jones's avatar
      Remove cc_ty from CIrredCan and cc_hole_ty from CHoleCan · 1a6ab644
      Simon Peyton Jones authored
      A simple refactoring with no complicated fiddling.
      1a6ab644
    • Simon Peyton Jones's avatar
      Another refactoring of constraints · d30b9cf4
      Simon Peyton Jones authored
      1. Rejig CtLoc
         * CtLoc is now *not* parameterised (much simpler)
         * CtLoc includes the "depth" of the constraint
         * CtLoc includes the TcLclEnv at the birthplace
           That gives (a) the SrcSpan, (b) the [ErrCtxt]
           (c) the [TcIdBinder]
         * The CtLoc of a constraint is no longer in its CtEvidence
         * Where we passed 'depth' before, now we pass CtLoc
      
      2. Some significant refactoring in TcErrors
         * Get rid of cec_extra
         * Traverse every constraint, so that we can be
           sure to generate bindings where necessary.
           (This was really a lurking bug before.)
      
      3. Merge zonking into TcCanonical.  This turned out to be
         almost trivial; just a small change to TcCanonical.flattenTyVar.
      
         The nice consequence is that we don't need to zonk a constraint
         before solving it; instead it gets zonked "on the fly" as it were.
      d30b9cf4
    • Simon Peyton Jones's avatar
      Add type "holes", enabled by -XTypeHoles, Trac #5910 · 8a9a7a8c
      Simon Peyton Jones authored
      This single commit combines a lot of work done by
      Thijs Alkemade <thijsalkemade@gmail.com>, plus a slew
      of subsequent refactoring by Simon PJ.
      
      The basic idea is
      * Add a new expression form "_", a hole, standing for a not-yet-written expression
      * Give a useful error message that
         (a) gives the type of the hole
         (b) gives the types of some enclosing value bindings that
             mention the hole
      
      Driven by this goal I did a LOT of refactoring in TcErrors, which in turn
      allows us to report enclosing value bindings for other errors, not just
      holes.  (Thijs rightly did not attempt this!)
      
      The major data type change is a new form of constraint
        data Ct = ...
          	  | CHoleCan {
          	      cc_ev       :: CtEvidence,
          	      cc_hole_ty  :: TcTauType,
          	      cc_depth    :: SubGoalDepth }
      
      I'm still in two minds about whether this is the best plan. Another
      possibility would be to have a predicate type for holes, somthing like
         class Hole a where
           holeValue :: a
      
      It works the way it is, but there are some annoying special cases for
      CHoleCan (just grep for "CHoleCan").
      8a9a7a8c
  4. 14 Sep, 2012 1 commit
  5. 03 Sep, 2012 2 commits
  6. 01 Sep, 2012 2 commits
  7. 31 Aug, 2012 1 commit
    • Simon Peyton Jones's avatar
      More simplifications to the constraint solver · b737a453
      Simon Peyton Jones authored
      * inert_solved becomes dictionaries-only, inert_solved_dicts
      
      * inert_solved_dicts is used only to cache the result of uses
        of a top level instance declaration, just like inert_solved_funeqs
      
      * That in turn simplifies xCtFlavor and rewriteCtFlavor, because
        they no longer need a "should I cache" parameter.  (Moreover the
        settings for this parameter were very subtle; it's easy to get
        loops if you cache too much.  Caching only top-level instance
        uses is much safer, and eliminates all these subtle cases.)
      b737a453
  8. 30 Aug, 2012 1 commit
    • Simon Peyton Jones's avatar
      A raft more changes, · 2b69233d
      Simon Peyton Jones authored
       * simplifying and tidying up canonicalisation,
       * removing the flat cache altogether
       * making the FunEq worklist into a deque
      2b69233d
  9. 29 Aug, 2012 1 commit
  10. 28 Aug, 2012 1 commit
  11. 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
  12. 19 Jul, 2012 1 commit
  13. 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
  14. 08 Jun, 2012 1 commit
    • dimitris's avatar
      Significant refactoring of TcSimplify, in particular simplifyInfer and · 3891a056
      dimitris authored
      simplifyTop, code beautification etc. Important things:
      
      (a) New top-level defaulting plan, gotten rid of the SimplContext field.
          See Note [Top-level Defaulting Plan]
      
      (b) Serious bug fix in the floatEqualities mechanism
          See Note [Extra TcS Untouchables],[Float Equalities out of Implications]
      
      The changes are mostly confined in TcSimplify but there is a
      simplification wave affecting other modules as well.
      3891a056
  15. 16 May, 2012 1 commit
  16. 11 May, 2012 1 commit
    • Simon Peyton Jones's avatar
      Refactor LHsTyVarBndrs to fix Trac #6081 · fc8959ac
      Simon Peyton Jones authored
      This is really a small change, but it touches a lot of files quite
      significantly. The real goal is to put the implicitly-bound kind
      variables of a data/class decl in the right place, namely on the
      LHsTyVarBndrs type, which now looks like
      
        data LHsTyVarBndrs name
          = HsQTvs { hsq_kvs :: [Name]
                   , hsq_tvs :: [LHsTyVarBndr name]
            }
      
      This little change made the type checker neater in a number of
      ways, but it was fiddly to push through the changes.
      fc8959ac
  17. 09 May, 2012 2 commits
  18. 07 May, 2012 1 commit
    • Simon Peyton Jones's avatar
      Yet another major refactoring of the constraint solver · dd7522c3
      Simon Peyton Jones authored
      This is the result of Simon and Dimitrios doing a code walk through.
      There is no change in behaviour, but the structure is much better.
      Main changes:
      
      * Given constraints contain an EvTerm not an EvVar
      
      * Correspondingly, TcEvidence is a recursive types that uses
        EvTerms rather than EvVars
      
      * Rename CtFlavor to CtEvidence
      
      * Every CtEvidence has a ctev_pred field.  And use record fields
        consistently for CtEvidence
      
      * The solved-constraint fields of InertSet (namely inert_solved and
        inert_solved_funeqs) contain CtEvidence, not Ct
      
      There is a long cascade of follow-on changes.
      dd7522c3
  19. 27 Apr, 2012 1 commit
  20. 22 Apr, 2012 1 commit
  21. 20 Apr, 2012 1 commit
  22. 16 Apr, 2012 1 commit
    • Simon Peyton Jones's avatar
      Simplify the typechecking of RULES · 5aa1ae24
      Simon Peyton Jones authored
      Not only does this fix Trac #5853, but it also eliminate
      the horrid SimplEqsOnly part of the constraint simplifier.
      
      The new plan is described in TcRules
       Note [Simplifying RULE constraints]
      5aa1ae24
  23. 10 Apr, 2012 2 commits
  24. 05 Apr, 2012 1 commit
  25. 04 Apr, 2012 2 commits
  26. 03 Apr, 2012 2 commits
  27. 30 Mar, 2012 1 commit
  28. 29 Mar, 2012 2 commits
  29. 28 Mar, 2012 2 commits