Changes between Version 32 and Version 33 of GhcKinds


Ignore:
Timestamp:
Jun 7, 2012 12:20:16 PM (3 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GhcKinds

    v32 v33  
    1010 * [wiki:ExplicitTypeApplication] proposes a syntax for explicit kind application 
    1111 
     12------------------------ 
     13= Future work = 
    1214 
    13  
    14  
    15  
    16 = Kind defaulting in type families = 
    17  
    18 At the moment, when you define a type family without `-XPolyKinds` like this: 
    19 {{{ 
    20 type family F a 
    21 }}} 
    22 it gets kind `* -> *`. There are no constraints on the kind of `a`, so we 
    23 default it to `*`. We also default the return kind of `F` to `*`. 
    24 The same happens for data families, and also for plain datatypes with phantom 
    25 types. 
    26  
    27 When you turn `-XPolyKinds` on, however, we currently give `F` the kind 
    28 `forall (k :: BOX). k -> *`. This is unsatisfactory for two reasons: 
    29  
    30  1. The behaviour of kind generalisation changes when we turn `-XPolyKinds` on, 
    31     even though it doesn't really have to. We could still default to `*` unless 
    32     you give a kind signature. So if you want `F` to be kind polymorphic, you 
    33     should write `type family F (a :: k)`. This, of course, requires supporting 
    34     [GhcKinds#Explicitkindvariables explicit kind variables]. 
    35      
    36   2. Unlike the parameters, however, the return kind of `F` is defaulted to `*`. 
    37      This seems rather arbitrary. We should either generalise both arguments and 
    38      return kind, or default both. In case we choose to default, the more 
    39      general kind can be obtained by giving a signature: 
    40      {{{ 
    41      type family F (a :: k1) :: k2 
    42      }}} 
    43  
    44 '''Future work:''' do more consistent kind defaulting. 
    45   
    46  
    47 = [http://hackage.haskell.org/trac/ghc/ticket/5682 #5682] (proper handling of infix promoted constructors) = 
     15== [http://hackage.haskell.org/trac/ghc/ticket/5682 #5682] (proper handling of infix promoted constructors) == 
    4816 
    4917Bug report [http://hackage.haskell.org/trac/ghc/ticket/5682 #5682] shows a 
     
    5321 
    5422 
    55 = Kind synonyms (from type synonym promotion) = 
     23== Kind synonyms (from type synonym promotion) == 
    5624 
    5725At the moment we are not promoting type synonyms, i.e. the following is invalid: 
     
    6836 
    6937 
    70 = Generalized Algebraic Data Kinds (GADKs) = 
     38== Generalized Algebraic Data Kinds (GADKs) == 
    7139 
    7240'''Future work:''' this section deals with a proposal to collapse kinds and sorts into a single system