#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:                  
        Type:  feature request             |      Status:  patch           
    Priority:  low                         |   Milestone:  7.6.1           
   Component:  Compiler                    |     Version:  7.3             
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple            |     Failure:  Other           
  Difficulty:  Unknown                     |    Testcase:                  
   Blockedby:                              |    Blocking:                  
     Related:                              |  
-------------------------------------------+--------------------------------

Comment(by simonpj):

 Thank you for doing this, goldfire.  I'm sorry I've been playing dead. I'm
 surfacing slowly.

 As you say, the implementation is straightforward, but there are design
 choices to make.

  * The existing `Type` data type uses `TupleT 3` plus `AppT`s for
 3-tuples, and it would really be inconsistent not to continue to do this.
 Even arrows work like this!  So I think I strongly prefer  your "simpler
 types" alternative.  Indeed that was the way you went for kinds!

  * If I have   `data Foo = Foo`, then I can use both `Foo` and `'Foo` as a
 type constructor, and they will have different `Name`s. Yet I think it is
 useful to be able to distinguish the two.  So I'm inclined to suggest
 {{{
 data Type = ...
           | VarT Name       -- Type variable
           | ConT Name       -- Ordinary type constructor
           | PromotedT Name  -- Promoted data constructor
           ...
 }}}

  * In GHC we combine `Type` and `Kind` into one data type (called `Type`).
 In TH up to now it's been separate, but as you have found you have to add
 most of the machinery of `Type` to `Kind`, so the two are almost
 duplicates!  (Indeed I think you have left `Forall` out of kinds, but it's
 needed too.)  So I wonder about collapsing the two into one in TH as well.
 {{{
 type Kind = Type
 }}}
   I don't have a firm view, but it looks attractive.

  * I think you will need `ForallT` in kinds.

 Does this make sense?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5612#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to