Changes between Version 16 and Version 17 of GhcKinds

Dec 13, 2011 2:03:45 PM (6 years ago)



  • GhcKinds

    v16 v17  
    1 = GHC Kind level =
     1= Kind polymorphism and datatype promotion =
    3 This page gives the theory, implementation overview and details about GHC's kind level.  This work is related to [ Conor's SHE system] and will be related to Iavor's work on [wiki:TypeNats] to deal with primitive types (promoted {{{Int}}} and {{{Char}}}).
     3This page gives additional implementation details for the `-XPolyKinds` flag. The grand design is described in the paper [ Giving Haskell a Promotion]. Most of the work has been done and merged into GHC 7.4.1. The relevant user documentation is in [the user's guide (add link when it's up)] and on the [ Haskell wiki page]. What still doesn't work, or doesn't work correctly, is described here.
    5 == Theory ==
     5= Explicit kind variables =
    7 We use the mechanism of promotion to lift a data type to the kind level.  This gives access at the type level to the data constructors, and at the kind level to the type constructor.  Not all data types can be promoted; for example, GADTs or data types with higher-order kinds cannot be promoted.  We add kind polymorphism to allow promotion of polymorphic data constructors (like {{{Nil}}} or {{{Cons}}}).
     7= Kind defaulting in type families =
    9 More details can be found in [ this theory pdf].
     9= [ #5682] (proper handling of infix promoted constructors) =
    11 == User's Guide and Examples ==
     11= Kind synonyms (from type synonym promotion) =
    13 There is a [ user guide] available on the haskellwiki explaining how to build the compiler and how to use the extension.
    15 Examples of reimplementation of existing Haskell librairies can be found in [ this examples pdf].  I use a repository for what works and what does not [].
    17 == Implementation ==
    19 The GHC branch is called {{{ghc-kinds}}}.  There is also a branch with the same name for haddock and the testsuite. The implementation will follow these steps (in bold is the first phase (parser, renamer, type checker, ...) that does not work):
    20   1. Promotion of Haskell98 data types of kind star: {{{*}}}.
    21   1. Promotion of Haskell98 data types of first order kind: {{{* -> .. * -> *}}}. It involves kind polymorphism.
    22   1. '''[theory design]''' Kind polymorphic data types, type families, and type classes.
    23      This step needs some design choices about [wiki:GhcKinds/KindPolymorphism kind polymorphism].
    24   1. Singleton types.
    25   1. Built-in types.
    27 Promotion-related changelog:
    28   * Extend {{{TyCon}}} with {{{PromotedDataTyCon}}} to have data constructors in type constructors.
    29   * Extend the parser, renamer, type and kind checker, and core-lint accordingly.
    32 Not promotion-related changelog:
    33   * Change the kind representation in {{{HsSyn}}} from {{{Kind}}} to {{{LHsKind name}}} adding some {{{PostTcKind}}} when necessary.
    34     * Rename {{{rnHsType}}} into {{{rnHsTyKi}}} and parametrize with a boolean to know if we are renaming a type or a kind.
    35   * Use {{{HsDocContext}}} instead of {{{SDoc}}} to track renaming context.
    36   * Kind check and type check by strongly connected components, instead of kind checking the whole module, and then type checking it.  This implies that some modules now need additional kind annotations (since each strongly component gets zonkTcKindToKind before going to the next one).
    37   * Rename {{{KindVar}}} which is used during type checking into {{{MetaKindVar}}}.
     13= Generalized Algebraic Data Kinds (GADKs) =