1. 13 Sep, 2010 1 commit
  2. 14 Jun, 2010 1 commit
  3. 01 Mar, 2010 1 commit
  4. 04 Jan, 2010 1 commit
    • simonpj@microsoft.com's avatar
      Substantial improvements to coercion optimisation · b06d623b
      simonpj@microsoft.com authored
      The main purpose of this patch is to add a bunch of new rules
      to the coercion optimiser.  They are documented in the (revised)
      Appendix of the System FC paper.  
      
      Some code has moved about:
      
      - OptCoercion is now a separate module, mainly because it
        now uses tcMatchTy, which is defined in Unify, so OptCoercion
        must live higehr up in the hierarchy
      
      - Functions that manipulate Kinds has moved from 
        Type.lhs to Coercion.lhs.  Reason: the function typeKind
        now needs to call coercionKind.  And in any case, a Kind is
        a flavour of Type, so it builds on top of Type; indeed Coercions
        and Kinds are both flavours of Type.
      
        This change required fiddling with a number of imports, hence
        the one-line changes to otherwise-unrelated modules
      
      - The representation of CoTyCons in TyCon has changed.   Instead of
        an extensional representation (a kind checker) there is now an
        intensional representation (namely TyCon.CoTyConDesc).  This was
        needed for one of the new coercion optimisations.
      b06d623b
  5. 16 Dec, 2009 3 commits
  6. 11 Dec, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Use full equality for CSE · 21eeb926
      simonpj@microsoft.com authored
      In CSE we were getting lots of apprarently-unequal expressions with
      the same hash code.  In fact they were perfectly equal -- but we were
      using a cheap-and-cheerful equality tests for CoreExpr that said False
      for any lambda expression!
      
      This patch adds a proper equality test for Core, with alpha-renaming.
      It's easy to do, and will avoid silly cases of CSE failing to fire.
      
      We should get less of this:
        WARNING: file compiler/simplCore/CSE.lhs line 326
        extendCSEnv: long list, length 18
      from a compiler built with -DDEBUG
      21eeb926
  7. 12 Nov, 2009 1 commit
    • simonpj@microsoft.com's avatar
      A radical overhaul of the coercion infrastucture · cd0e2c0c
      simonpj@microsoft.com authored
      * Core Lint now does full checking of kinds and coercion terms
        which picks up kind errors in coercions that were previously
        simply not checked for
      
      * Coercion.lhs now provides optCoercion which optimises coercion
        terms.  It implements all of Dimitrios's rules
      
      * The constructors for coercion terms now make no attempt to be
        "smart"; instead we rely solely on the coercion optimiser
      
      * CoercionTyCons in TyCon.lhs always had a "custom" kinding rule
        (the coKindFun field of CoercionTyCon) but its type was not 
        clever enough to do both 
           (a) *figure out the result kind*, assuming the whole thing
               is well-kinded in the first place
           (b) *check* the kinds of everything, failing gracefully if
               they aren't right. 
        We need (b) for the new CoreLint stuff. The field now has type
              CoTyConKindChecker
        which does the job nicely.
      cd0e2c0c
  8. 08 Nov, 2009 1 commit
  9. 06 Nov, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Tidy up coercions, and implement csel1, csel2, cselR · bcadca67
      simonpj@microsoft.com authored
      In preparation for implementing the PushC rule for coercion-swizzling
      in the Simplifier, I had to inmplement the three new decomposition
      operators for coercions, which I've called csel1, csel2, and cselR.
      
           co :: ((s1~t1) => r1) ~ ((s2~t2) => r2)
           ---------------------------------------
                    csel1 co :: s1~s2
      
      and similarly csel2, cselR.
      
      On the way I fixed the coercionKind function for types of form
                (s1~t2) => r2
      which currently are expressed as a forall type.  
      
      And I refactored quite a bit to help myself understand what is
      going on.
      bcadca67
  10. 30 Oct, 2009 1 commit
  11. 28 Oct, 2009 1 commit
  12. 26 Oct, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Add a coercion optimiser, to reduce the size of coercion terms · 48196c3c
      simonpj@microsoft.com authored
      Coercion terms can get big (see Trac #2859 for example), so this
      patch puts the infrastructure in place to optimise them:
      
        * Adds Coercion.optCoercion :: Coercion -> Coercion
      
        * Calls optCoercion in Simplify.lhs
      
      The optimiser doesn't work right at the moment, so it is 
      commented out, but Tom is going to work on it.
      48196c3c
  13. 06 Jul, 2009 1 commit
  14. 15 Mar, 2009 1 commit
  15. 13 Jan, 2009 1 commit
  16. 29 Oct, 2008 1 commit
  17. 20 Sep, 2008 1 commit
  18. 31 Jul, 2008 1 commit
  19. 12 Apr, 2008 1 commit
  20. 29 Mar, 2008 1 commit
  21. 15 Mar, 2008 1 commit
  22. 06 Feb, 2008 1 commit
    • rl@cse.unsw.edu.au's avatar
      Teach cheapEqExpr about casts · a4835b8b
      rl@cse.unsw.edu.au authored
      Previously, cheapEqExpr would always return False if it encountered a cast.
      This was bad for two reasons. Firstly, CSE (which uses cheapEqExpr to compare
      expressions) never eliminated expressions which contained casts and secondly,
      it was inconsistent with exprIsBig. This patch fixes this.
      a4835b8b
  23. 26 Jan, 2008 1 commit
  24. 03 Oct, 2007 1 commit
  25. 29 Sep, 2007 1 commit
  26. 10 Sep, 2007 1 commit
  27. 04 Sep, 2007 1 commit
  28. 03 Sep, 2007 1 commit
  29. 01 Sep, 2007 1 commit
  30. 28 Aug, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Type checking for type synonym families · 5822cb8d
      chak@cse.unsw.edu.au. authored
      This patch introduces type checking for type families of which associated
      type synonyms are a special case. E.g.
      
              type family Sum n m
      
              type instance Sum Zero n = n
              type instance Sum (Succ n) m = Succ (Sum n m)
      
      where
      
              data Zero       -- empty type
              data Succ n     -- empty type
      
      In addition we support equational constraints of the form:
      
              ty1 ~ ty2
      
      (where ty1 and ty2 are arbitrary tau types) in any context where
      type class constraints are already allowed, e.g.
      
              data Equals a b where
                      Equals :: a ~ b => Equals a b
      
      The above two syntactical extensions are disabled by default. Enable
      with the -XTypeFamilies flag.
      
      For further documentation about the patch, see:
      
              * the master plan
                http://hackage.haskell.org/trac/ghc/wiki/TypeFunctions
      
              * the user-level documentation
                http://haskell.org/haskellwiki/GHC/Indexed_types
      
      The patch is mostly backwards compatible, except for:
      
              * Some error messages have been changed slightly.
      
              * Type checking of GADTs now requires a bit more type declarations:
                not only should the type of a GADT case scrutinee be given, but also
                that of any identifiers used in the branches and the return type.
      
      Please report any unexpected behavior and incomprehensible error message 
      for existing code.
      
      Contributors (code and/or ideas):
              Tom Schrijvers
              Manuel Chakravarty
              Simon Peyton-Jones
              Martin Sulzmann 
      with special thanks to Roman Leshchinskiy
      5822cb8d
  31. 09 Aug, 2007 1 commit
  32. 23 May, 2007 1 commit
  33. 11 May, 2007 1 commit
  34. 25 Apr, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Generating synonym instance representation tycons · 13cd965d
      chak@cse.unsw.edu.au. authored
      - Type synonym instances are turned into representation synonym tycons
      - They are entered into the pool of family instances (FamInst environments)
        in the same way as data/newtype instances
      - Still missing is writing the parent tycon information into ifaces and 
        various well-formedness checks.
      13cd965d
  35. 05 Feb, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Improve simplification of coercions · 77241a03
      simonpj@microsoft.com authored
      At the moment GHC really does very little simplification of coercions.
      This patch improves matters, but it's still not great, especially when
      you have chains linked together with 'trans'. 
      
      I'm also concerned that I have not yet implemented the 'leftc' and 'rightc'
      coercions we added to the paper. 
      
      But at least things are better than they were.  In particular
      	g `trans` sym g
      now cancels to give the identity.
      
      77241a03
  36. 11 Jan, 2007 1 commit
  37. 13 Oct, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Add assertion checks for mkCoVar/mkTyVar · ac704fca
      simonpj@microsoft.com authored
      A type variable has a flag saying whether it is a *type* variable or
      a *coercion* variable.  This patch adds assertions to check the flag.
      
      And it adds fixes to places which were Wrong (and hence fired the
      assertion)! 
      
      Also removed isCoVar from Coercion, since it's done by Var.isCoVar.
      
      
      ac704fca
  38. 11 Oct, 2006 1 commit