1. 09 Aug, 2007 1 commit
  2. 23 May, 2007 1 commit
  3. 11 May, 2007 1 commit
  4. 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
  5. 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
  6. 11 Jan, 2007 1 commit
  7. 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
  8. 11 Oct, 2006 2 commits
    • Simon Marlow's avatar
      ab22f4e6
    • Simon Marlow's avatar
      Interface file optimisation and removal of nameParent · b00b5bc0
      Simon Marlow authored
      This large commit combines several interrelated changes:
      
        - IfaceSyn now contains actual Names rather than the special
          IfaceExtName type.  The binary interface file contains
          a symbol table of Names, where each entry is a (package,
          ModuleName, OccName) triple.  Names in the IfaceSyn point
          to entries in the symbol table.
      
          This reduces the size of interface files, which should
          hopefully improve performance (not measured yet).
      
          The toIfaceXXX functions now do not need to pass around
          a function from Name -> IfaceExtName, which makes that
          code simpler.
      
        - Names now do not point directly to their parents, and the
          nameParent operation has gone away.  It turned out to be hard to
          keep this information consistent in practice, and the parent info
          was only valid in some Names.  Instead we made the following
          changes:
      
          * ImportAvails contains a new field 
                imp_parent :: NameEnv AvailInfo
            which gives the family info for any Name in scope, and
            is used by the renamer when renaming export lists, amongst
            other things.  This info is thrown away after renaming.
      
          * The mi_ver_fn field of ModIface now maps to
            (OccName,Version) instead of just Version, where the
            OccName is the parent name.  This mapping is used when
            constructing the usage info for dependent modules.
            There may be entries in mi_ver_fn for things that are not in
            scope, whereas imp_parent only deals with in-scope things.
      
          * The md_exports field of ModDetails now contains
            [AvailInfo] rather than NameSet.  This gives us
            family info for the exported names of a module.
      
      Also:
      
         - ifaceDeclSubBinders moved to IfaceSyn (seems like the
           right place for it).
      
         - heavily refactored renaming of import/export lists.
      
         - Unfortunately external core is now broken, as it relied on
           IfaceSyn.  It requires some attention.
      b00b5bc0
  9. 29 Sep, 2006 1 commit
  10. 23 Sep, 2006 1 commit
    • simonpj@microsoft.com's avatar
      Re-work the newtype-deriving support · 2ce87c70
      simonpj@microsoft.com authored
      The newtype deriving mechanism is much trickier to support than it
      seems at first.  Kevin didn't get it quite right when moving to FC,
      and I ended up re-writing quite a bit of it.  
      
      I think it's right now, but I have not yet tested it thoroughly.
      2ce87c70
  11. 20 Sep, 2006 9 commits
    • chak@cse.unsw.edu.au.'s avatar
      Straightened out implicit coercions for indexed types · d76c18e0
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 19:35:24 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Straightened out implicit coercions for indexed types
        Mon Sep  4 23:46:14 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Straightened out implicit coercions for indexed types
          - HscTypes.implicitTyThings and LoadIface.ifaceDeclSubBndrs now
            include the coercion of indexed data/newtypes.
          - Name generation for the internal names of indexed data/newtypes now uses
            the same counter that generates the dfun unique indexes (ie, class and type
            instances are counted with the one counter).  We could make this two 
            separate counters if that's what's preferred.
          - The unique index of a data/newtype instances needs to go into the iface, so
            that we can generate the same names on slurping in the iface as when the
            original module was generated.  This is a bit yucky, but I don't see a way
            to avoid that (other than putting the full blown internal tycon name and 
            coercion name into the iface, which IMHO would be worse).
          - The predicate for when a datacon has a wrapper didn't take GADT
            equations nor whether it comes froma  family instance into account.
          
          *** WARNING!  This patch changed the interface file format. ***
          ***           Please recompile from scratch.                ***
      d76c18e0
    • 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
      Fixed bug in coercion for indexed data types · a7a32655
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 19:12:51 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Fixed bug in coercion for indexed data types
        Fri Aug 25 16:45:29 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Fixed bug in coercion for indexed data types
          - Significant examples are starting to work; eg, generic finite maps:
          
          class GMapKey k where
            data GMap k :: * -> *
            empty       :: GMap k v
            lookup      :: k -> GMap k v -> Maybe v
            insert      :: k -> v -> GMap k v -> GMap k v
          
          instance GMapKey Int where
            data GMap Int v        = GMapInt (Map.Map Int v)
            empty                  = GMapInt Map.empty
            lookup k (GMapInt m)   = Map.lookup k m
            insert k v (GMapInt m) = GMapInt (Map.insert k v m)
          
          instance GMapKey Char where
            data GMap Char v        = GMapChar (GMap Int v)
            empty                   = GMapChar empty
            lookup k (GMapChar m)   = lookup (ord k) m
            insert k v (GMapChar m) = GMapChar (insert (ord k) v m)
          
          instance GMapKey () where
            data GMap () v           = GMapUnit (Maybe v)
            empty                    = GMapUnit Nothing
            lookup () (GMapUnit v)   = v
            insert () v (GMapUnit _) = GMapUnit $ Just v
          
          instance (GMapKey a, GMapKey b) => GMapKey (a, b) where
            data GMap (a, b) v            = GMapPair (GMap a (GMap b v))
            empty		                = GMapPair empty
            lookup (a, b) (GMapPair gm)   = lookup a gm >>= lookup b 
            insert (a, b) v (GMapPair gm) = GMapPair $ case lookup a gm of
          				    Nothing  -> insert a (insert b v empty) gm
          				    Just gm2 -> insert a (insert b v gm2  ) gm
          
          instance (GMapKey a, GMapKey b) => GMapKey (Either a b) where
            data GMap (Either a b) v                = GMapEither (GMap a v) (GMap b v)
            empty                                   = GMapEither empty empty
            lookup (Left  a) (GMapEither gm1  _gm2) = lookup a gm1
            lookup (Right b) (GMapEither _gm1 gm2 ) = lookup b gm2
            insert (Left  a) v (GMapEither gm1 gm2) = GMapEither (insert a v gm1) gm2
            insert (Right a) v (GMapEither gm1 gm2) = GMapEither gm1 (insert a v gm2)
          
      a7a32655
    • chak@cse.unsw.edu.au.'s avatar
      Pattern matching of indexed data types · 6791ad22
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 19:11:24 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Pattern matching of indexed data types
        Thu Aug 24 14:17:44 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Pattern matching of indexed data types
          - This patch is the last major puzzle piece to type check and desugar indexed 
            data types (both toplevel and associated with a class).
          - However, it needs more testing - esp wrt to accumlating CoPats - and some 
            static sanity checks for data instance declarations are still missing.
          - There are now two detailed notes in MkIds and TcPat on how the worker/wrapper
            and coercion story for indexed data types works.
      6791ad22
    • chak@cse.unsw.edu.au.'s avatar
      Introduce coercions for data instance decls · 909d2dd8
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 19:07:30 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Introduce coercions for data instance decls
        Tue Aug 22 20:33:46 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Introduce coercions for data instance decls
          - data instance declarations implicitly generate a coercion moving between the
            representation type and family instance type.
          - The coercion is *implicitly* generated when type checking both source and 
            ifaces.  Ie, we don't safe it in ifaces - this is really exactly as newtype 
            coercions are handled.
          - The previous addition of the instance types to DataCons has been moved to 
            the representation TyCon.  This is more efficient as it is shared between all
            constructors of one representation tycon and it also gathers everything about
            data instances (family tycon, instance types, and coercion) in one place: the
            algTcParent field of TyCon.
          - The coercion is already used in the datacon wrappers, but not yet during type
            checking pattern matching of indexed data types.
          - The code has only been lightly tested, but doesn't seem to break features not
            related to indexed types.  For indexed data types only the pattern matching
            tc code (in TcPat.tcConPat) and some well-formedness checks are still 
            missing.  And there will surely be some bugs to fix.  (newtypes still require
            some more work.)
          
          	   ** WARNING: Interface file format changed! **
          	   **          Recompile from scratch!        **
      909d2dd8
    • chak@cse.unsw.edu.au.'s avatar
      Make newtype Coercion eta-contract if the tails of lhs and rhs match up · fadef64b
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 17:20:17 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Make newtype Coercion eta-contract if the tails of lhs and rhs match up
        Sun Aug  6 20:57:10 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Make newtype Coercion eta-contract if the tails of lhs and rhs match up
          Thu Aug  3 12:26:52 EDT 2006  kevind@bu.edu
      fadef64b
    • chak@cse.unsw.edu.au.'s avatar
      Flip direction of newtype coercions, fix some comments · 5e0ea427
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 17:19:19 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Flip direction of newtype coercions, fix some comments
        Sun Aug  6 20:56:23 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Flip direction of newtype coercions, fix some comments
          Thu Aug  3 10:53:37 EDT 2006  kevind@bu.edu
      5e0ea427
    • chak@cse.unsw.edu.au.'s avatar
      Make sym coercion smart constructor smarter, add comments · a7bda9e6
      chak@cse.unsw.edu.au. authored
      Mon Sep 18 17:11:59 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
        * Make sym coercion smart constructor smarter, add comments
        Sun Aug  6 20:32:58 EDT 2006  Manuel M T Chakravarty <chak@cse.unsw.edu.au>
          * Make sym coercion smart constructor smarter, add comments
          Tue Aug  1 11:30:14 EDT 2006  kevind@bu.edu
      a7bda9e6
    • 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
  12. 07 Aug, 2006 2 commits
  13. 06 Aug, 2006 2 commits