1. 15 Sep, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Overhaul of the rewrite rules · 6d2b0ae3
      chak@cse.unsw.edu.au. authored
      - Cleaned up and simplified rules
      - Added many missing cases
      - The rules OccursCheck and swap have been eliminated and integrate with
        the other rules; ie, Subst and Unify perform the occurs check themselves
        and they can deal with left-to-right and right-to-left oriented rewrites.
        This makes the code simpler and more efficient.
      - Also added comments.
      6d2b0ae3
  2. 11 Sep, 2007 1 commit
  3. 10 Sep, 2007 1 commit
  4. 05 Sep, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Refactor, improve, and document the deriving mechanism · 25f84fa7
      simonpj@microsoft.com authored
      This patch does a fairly major clean-up of the code that implements 'deriving.
      
      * The big changes are in TcDeriv, which is dramatically cleaned up.
        In particular, there is a clear split into
      	a) inference of instance contexts for deriving clauses
      	b) generation of the derived code, given a context 
        Step (a) is skipped for standalone instance decls, which 
        have an explicitly provided context.
      
      * The handling of "taggery", which is cooperative between TcDeriv and
        TcGenDeriv, is cleaned up a lot
      
      * I have added documentation for standalone deriving (which was 
        previously wrong).
      
      * The Haskell report is vague on exactly when a deriving clause should
        succeed.  Prodded by Conal I have loosened the rules slightly, thereyb
        making drv015 work again, and documented the rules in the user manual.
      
      I believe this patch validates ok (once I've update the test suite)
      and can go into the 6.8 branch.
      25f84fa7
  5. 04 Sep, 2007 1 commit
  6. 03 Sep, 2007 1 commit
  7. 01 Sep, 2007 1 commit
  8. 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
  9. 09 Aug, 2007 1 commit
  10. 03 Aug, 2007 1 commit
  11. 02 Jul, 2007 1 commit
  12. 02 May, 2007 2 commits
  13. 25 Apr, 2007 1 commit
  14. 24 Apr, 2007 1 commit
  15. 02 Apr, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Make type-tidying work for coercion variables · f2b02ce8
      simonpj@microsoft.com authored
      When tidying a TyVar binder, we must tidy its kind if it's a coercion
      variable!  I had forgotten to do this, which is a serious bug.  As a
      result some more complicated programs were getting a Lint error when
      reading in interface files.  Score one for Core Lint!
      
      f2b02ce8
  16. 11 Jan, 2007 1 commit
  17. 04 Jan, 2007 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Fix and improve deriving for indexed data types · 3548802d
      chak@cse.unsw.edu.au. authored
      - The test for being able to derive the requested classes needs to be made
        with the representation tycon (not the family tycon).
      - Standalone deriving for indexed types requires the instance types in the
        derive clause to match a data/newtype instance exactly (modulo alpha).
      3548802d
  18. 02 Jan, 2007 1 commit
    • simonpj@microsoft.com's avatar
      Big tidy-up of deriving code · 84923cc7
      simonpj@microsoft.com authored
      This tidy-up, triggered by Trac #1068, re-factors the way that 'deriving' 
      happens.  It took me way longer than I had intended.  The main changes,
      by far are to TcDeriv; everyting else is a minor consequence.
      
      While I was at it, I changed the syntax for standalone deriving, so that
      it goes
      	derive instance Show (T a)
      
      (instead of "derive Show for T").  However, there's still an implicit
      context, generated by the deriving code, and I wonder if it shouldn't really
      be
      	derive instance (..) => Show (T a)
      but I have left it simple for now.
      
      I also added a function Type.substTyVars, and used it here and there, which
      led to some one-line changes otherwise unrelated (sorry).
      
      Loose ends:
        * 'deriving Typeable' for indexed data types is still not right
        * standalone deriving should be documented
      84923cc7
  19. 18 Dec, 2006 1 commit
    • chak@cse.unsw.edu.au.'s avatar
      Deriving for indexed data types · 380512de
      chak@cse.unsw.edu.au. authored
      - This patch implements deriving clauses for data instance declarations
        (toplevel and associated)
      - Doesn't support standalone deriving.  This could be easily supported,
        but requires an extension of the syntax of standalone deriving clauses.
        Björn, fancy adding this?
      - We cannot derive Typeable.  This seems a problem of notation, more than 
        anything else.  Why?  For a binary vanilla data type "T a b", we would 
        generate an instance Typeable2 T; ie, the instance is for the constructor
        alone.  In the case of a family instance, such as (S [a] (Maybe b)), we
        simply have no means to denote the associated constuctor.  It appears to
        require type level lambda - something like (/\a b. S [a] (Maybe b).
      - Derivings are for *individual* family *instances*, not for entire families.
        Currently, I know of no simple translation of class instances for entire 
        families to System F_C.  This actually seems to be similar to implementing
        open data types à la Löh & Hinze.
      - This patch only covers data types, not newtypes.
      380512de
  20. 10 Dec, 2006 1 commit
    • mnislaih's avatar
      Closure inspection in GHCi · 121da25a
      mnislaih authored
      The :print, :sprint and :force commands for GHCi.
      This set of commands allows inspection of heap structures of the bindings in the interactive environment.
      This is useful to observe lazyness and specially to inspect things with undespecified polymorphic types, as happens often in breakpoints.
      121da25a
  21. 10 Nov, 2006 1 commit
  22. 06 Nov, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Tidy up substitutions · 94b170a0
      simonpj@microsoft.com authored
      The new simplifer stuff exposed the fact that the invariants on the
      TvSubstEnv and IdSubstEnv were insufficiently explicit.  (Resulted in
      a bug found by Sam Brosnon.)
      
      This patch fixes the bug, and tries to document the invariants pretty
      thoroughly. See 
      	Note [Extending the TvSubst] in Type
      	Note [Extenting the Subst]   in CoreSubst
      
      (Most of the new lines are comments.)
      94b170a0
  23. 01 Nov, 2006 1 commit
  24. 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
  25. 11 Oct, 2006 1 commit
  26. 06 Oct, 2006 1 commit
  27. 23 Sep, 2006 3 commits
  28. 20 Sep, 2006 9 commits
    • chak@cse.unsw.edu.au.'s avatar
      Indexed newtypes · 27897431
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 19:24:27 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Indexed newtypes
        Thu Aug 31 22:09:21 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Indexed newtypes
          - This patch makes indexed newtypes work
          - Only lightly tested
          - We need to distinguish between open and closed newtypes in a number of 
            places, because looking through newtypes doesn't work easily for open ones.
      27897431
    • chak@cse.unsw.edu.au.'s avatar
      Check category of type instances and some newtype family fixes · d5c4754d
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 19:23:39 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Check category of type instances and some newtype family fixes
        Thu Aug 31 16:54:14 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Check category of type instances and some newtype family fixes
      d5c4754d
    • chak@cse.unsw.edu.au.'s avatar
      Extended TyCon and friends to represent family declarations · e8a591c1
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 18:50:35 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Extended TyCon and friends to represent family declarations
        Tue Aug 15 16:52:31 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Extended TyCon and friends to represent family declarations
      e8a591c1
    • chak@cse.unsw.edu.au.'s avatar
      Fix GADT refinement fix-pointing, add ASSERTs and a WARN, make type equality... · 67ee8a93
      chak@cse.unsw.edu.au. authored
      Fix GADT refinement fix-pointing, add ASSERTs and a WARN, make type equality functions work for PredTy Eqtype ...
      Mon Sep 18 17:07:38 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Fix GADT refinement fix-pointing, add ASSERTs and a WARN, make type equality functions work for PredTy Eqtype ...
        Sun Aug  6 20:28:50 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Fix GADT refinement fix-pointing, add ASSERTs and a WARN, make type equality functions work for PredTy Eqtype ...
          Tue Aug  1 06:14:43 EDT 2006  kevind@bu.edu
      67ee8a93
    • chak@cse.unsw.edu.au.'s avatar
      fix bugs, add boolean flag to identify coercion variables · 0b86bc9b
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 16:41:32 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * fix bugs, add boolean flag to identify coercion variables
        Sun Aug  6 17:04:02 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * fix bugs, add boolean flag to identify coercion variables
          Tue Jul 25 06:20:05 EDT 2006  kevind@bu.edu
      0b86bc9b
    • chak@cse.unsw.edu.au.'s avatar
      fix some coercion kind representation things, extend exprIsConApp_maybe to non-vanilla · 6fcf9006
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 14:51:33 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * fix some coercion kind representation things, extend exprIsConApp_maybe to non-vanilla
        Sat Aug  5 21:48:21 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * fix some coercion kind representation things, extend exprIsConApp_maybe to non-vanilla
          Wed Jul 19 08:06:28 EDT 2006  kevind@bu.edu
      6fcf9006
    • chak@cse.unsw.edu.au.'s avatar
      towards unboxing through newtypes · a4c34367
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 14:44:50 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * towards unboxing through newtypes
        Sat Aug  5 21:42:05 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * towards unboxing through newtypes
          Fri Jul 14 12:02:32 EDT 2006  kevind@bu.edu
      a4c34367
    • chak@cse.unsw.edu.au.'s avatar
      Complete the evidence generation for GADTs · 15cb792d
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 14:43:22 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Complete the evidence generation for GADTs
        Sat Aug  5 21:39:51 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Complete the evidence generation for GADTs
          Thu Jul 13 17:18:07 EDT 2006  simonpj@microsoft.com
            
            This patch completes FC evidence generation for GADTs.
            
            It doesn't work properly yet, because part of the compiler thinks
            	(t1 :=: t2) => t3
            is represented with FunTy/PredTy, while the rest thinks it's represented
            using ForAllTy.  Once that's done things should start to work.
      15cb792d
    • chak@cse.unsw.edu.au.'s avatar
      newtype fixes, coercions for non-recursive newtypes now optional · c94408e5
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 14:24:27 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * newtype fixes, coercions for non-recursive newtypes now optional
        Sat Aug  5 21:19:58 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * newtype fixes, coercions for non-recursive newtypes now optional
          Fri Jul  7 06:11:48 EDT 2006  kevind@bu.edu
      c94408e5
  29. 04 Aug, 2006 1 commit