Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3bf54e78cfd4b94756e3f21c00ae187f80c3341d

>---------------------------------------------------------------

commit 3bf54e78cfd4b94756e3f21c00ae187f80c3341d
Author: Simon Peyton Jones <[email protected]>
Date:   Fri Mar 2 16:32:58 2012 +0000

    Hurrah!  This major commit adds support for scoped kind variables,
    which (finally) fills out the functionality of polymorphic kinds.
    It also fixes numerous bugs.
    
    Main changes are:
    
    Renaming stuff
    ~~~~~~~~~~~~~~
    * New type in HsTypes:
         data HsBndrSig sig = HsBSig sig [Name]
      which is used for type signatures in patterns, and kind signatures
      in types.  So when you say
           f (x :: [a]) = x ++ x
      or
           data T (f :: k -> *) (x :: *) = MkT (f x)
      the signatures in both cases are a HsBndrSig.
    
    * The [Name] in HsBndrSig records the variables bound by the
      pattern, that is 'a' in the first example, 'k' in the second,
      and nothing in the third.  The renamer initialises the field.
    
    * As a result I was able to get rid of
         RnHsSyn.extractHsTyNames :: LHsType Name -> NameSet
      and its friends altogether.  Deleted the entire module!
      This led to some knock-on refactoring; in particular the
      type renamer now returns the free variables just like the
      term renamer.
    
    Kind-checking types: mainly TcHsType
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    A major change is that instead of kind-checking types in two
    passes, we now do one. Under the old scheme, the first pass did
    kind-checking and (hackily) annotated the HsType with the
    inferred kinds; and the second pass desugared the HsType to a
    Type.  But now that we have kind variables inside types, the
    first pass (TcHsType.tc_hs_type) can go straight to Type, and
    zonking will squeeze out any kind unification variables later.
    
    This is much nicer, but it was much more fiddly than I had expected.
    
    The nastiest corner is this: it's very important that tc_hs_type
    uses lazy constructors to build the returned type. See
    Note [Zonking inside the knot] in TcHsType.
    
    Type-checking type and class declarations: mainly TcTyClsDecls
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I did tons of refactoring in TcTyClsDecls.  Simpler and nicer now.
    
    Typechecking bindings: mainly TcBinds
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I rejigged (yet again) the handling of type signatures in TcBinds.
    It's a bit simpler now.  The main change is that tcTySigs goes
    right through to a TcSigInfo in one step; previously it was split
    into two, part here and part later.
    
    Unsafe coercions
    ~~~~~~~~~~~~~~~~
    Usually equality coercions have exactly the same kind on both
    sides.  But we do allow an *unsafe* coercion between Int# and Bool,
    say, used in
        case error Bool "flah" of { True -> 3#; False -> 0# }
    -->
        (error Bool "flah") |> unsafeCoerce Bool Int#
    
    So what is the instantiation of (~#) here?
       unsafeCoerce Bool Int# :: (~#) ??? Bool Int#
    I'm using OpenKind here for now, but it's un-satisfying that
    the lhs and rhs of the ~ don't have precisely the same kind.
    
    More minor
    ~~~~~~~~~~
    * HsDecl.TySynonym has its free variables attached, which makes
      the cycle computation in TcTyDecls.mkSynEdges easier.
    
    * Fixed a nasty reversed-comparison bug in FamInstEnv:
      @@ -490,7 +490,7 @@ lookup_fam_inst_env' match_fun one_sided ie fam tys
         n_tys = length tys
         extra_tys = drop arity tys
         (match_tys, add_extra_tys)
    -       | arity > n_tys = (take arity tys, \res_tys -> res_tys ++ extra_tys)
    +       | arity < n_tys = (take arity tys, \res_tys -> res_tys ++ extra_tys)
            | otherwise     = (tys,            \res_tys -> res_tys)

 compiler/basicTypes/DataCon.lhs      |    2 +-
 compiler/coreSyn/PprCore.lhs         |    8 +-
 compiler/deSugar/DsMeta.hs           |    8 +-
 compiler/ghc.cabal.in                |    1 -
 compiler/hsSyn/Convert.lhs           |   16 +-
 compiler/hsSyn/HsDecls.lhs           |   32 +-
 compiler/hsSyn/HsPat.lhs             |    2 +-
 compiler/hsSyn/HsTypes.lhs           |   90 ++-
 compiler/hsSyn/HsUtils.lhs           |   10 +-
 compiler/parser/Parser.y.pp          |    5 +-
 compiler/parser/ParserCore.y         |    4 +-
 compiler/parser/RdrHsSyn.lhs         |    8 +-
 compiler/prelude/TysPrim.lhs         |   24 +-
 compiler/prelude/TysWiredIn.lhs      |    8 +-
 compiler/rename/RnBinds.lhs          |   42 +-
 compiler/rename/RnEnv.lhs            |  127 ++--
 compiler/rename/RnExpr.lhs           |    9 +-
 compiler/rename/RnHsSyn.lhs          |  159 ----
 compiler/rename/RnNames.lhs          |   80 +--
 compiler/rename/RnPat.lhs            |   21 +-
 compiler/rename/RnSource.lhs         |  353 ++++-----
 compiler/rename/RnTypes.lhs          |  465 ++++++++----
 compiler/stgSyn/StgLint.lhs          |   30 +-
 compiler/typecheck/FamInst.lhs       |   40 +-
 compiler/typecheck/Inst.lhs          |    5 +-
 compiler/typecheck/TcArrows.lhs      |    4 +-
 compiler/typecheck/TcBinds.lhs       |  382 ++++------
 compiler/typecheck/TcCanonical.lhs   |   18 +-
 compiler/typecheck/TcClassDcl.lhs    |   61 +-
 compiler/typecheck/TcDeriv.lhs       |   20 +-
 compiler/typecheck/TcEnv.lhs         |   58 +-
 compiler/typecheck/TcErrors.lhs      |   23 +-
 compiler/typecheck/TcHsSyn.lhs       |   31 +-
 compiler/typecheck/TcHsType.lhs      | 1374 +++++++++++++++++-----------------
 compiler/typecheck/TcInstDcls.lhs    |  160 ++--
 compiler/typecheck/TcInteract.lhs    |   15 +-
 compiler/typecheck/TcMType.lhs       |  225 +++---
 compiler/typecheck/TcPat.lhs         |   21 +-
 compiler/typecheck/TcRnDriver.lhs    |    2 +-
 compiler/typecheck/TcRnMonad.lhs     |    3 +
 compiler/typecheck/TcRnTypes.lhs     |    8 +-
 compiler/typecheck/TcRules.lhs       |    6 +-
 compiler/typecheck/TcSMonad.lhs      |    4 +-
 compiler/typecheck/TcSimplify.lhs    |   22 +-
 compiler/typecheck/TcSplice.lhs      |   30 +-
 compiler/typecheck/TcSplice.lhs-boot |    7 +-
 compiler/typecheck/TcTyClsDecls.lhs  |  473 ++++++------
 compiler/typecheck/TcTyDecls.lhs     |    8 +-
 compiler/typecheck/TcType.lhs        |   19 +-
 compiler/typecheck/TcUnify.lhs       |   16 +-
 compiler/types/Coercion.lhs          |    4 +-
 compiler/types/FamInstEnv.lhs        |   12 +-
 compiler/types/InstEnv.lhs           |    3 +-
 compiler/types/Kind.lhs              |    9 +-
 compiler/types/Type.lhs              |   81 ++-
 compiler/types/TypeRep.lhs           |   43 +-
 56 files changed, 2319 insertions(+), 2372 deletions(-)


Diff suppressed because of size. To see it, use:

    git show 3bf54e78cfd4b94756e3f21c00ae187f80c3341d

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to