Quantcast

[GHC] #5612: panic, impossible happened, "Exotic form of kind"

classic Classic list List threaded Threaded
26 messages Options
12
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[GHC] #5612: panic, impossible happened, "Exotic form of kind"

GHC
#5612: panic, impossible happened, "Exotic form of kind"
-----------------------+----------------------------------------------------
    Reporter:  guest   |       Owner:          
        Type:  bug     |      Status:  new    
    Priority:  normal  |   Component:  Compiler
     Version:  7.0.3   |    Keywords:          
    Testcase:          |   Blockedby:          
          Os:  Linux   |    Blocking:          
Architecture:  x86     |     Failure:  Other  
-----------------------+----------------------------------------------------
 Type checking the attached code produces a legitimate type error, and also
 the following message:

 >>>
 Tip.hs:107:14:ghc: panic! (the 'impossible' happened)
   (GHC version 7.0.3 for i386-unknown-linux):
         Exotic form of kind ghc-prim:GHC.Prim.?{(w) tc 34g}
 <<<

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: panic, impossible happened, "Exotic form of kind"

GHC
#5612: panic, impossible happened, "Exotic form of kind"
-----------------------+----------------------------------------------------
    Reporter:  guest   |       Owner:          
        Type:  bug     |      Status:  new    
    Priority:  normal  |   Component:  Compiler
     Version:  7.0.3   |    Keywords:          
    Testcase:          |   Blockedby:          
          Os:  Linux   |    Blocking:          
Architecture:  x86     |     Failure:  Other  
-----------------------+----------------------------------------------------

Comment(by dreixel):

 Could you perhaps say which libraries are necessary to build this (like
 `QuickCheck`), and their versions? Or, even better, minimize the test so
 that it doesn't rely on external libraries? That makes it easier to test
 with the current development branch.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: panic, impossible happened, "Exotic form of kind"

GHC
In reply to this post by GHC
#5612: panic, impossible happened, "Exotic form of kind"
-------------------------+--------------------------------------------------
    Reporter:  guest     |        Owner:  dreixel
        Type:  bug       |       Status:  new    
    Priority:  normal    |    Milestone:  7.4.1  
   Component:  Compiler  |      Version:  7.0.3  
    Keywords:            |     Testcase:        
   Blockedby:            |   Difficulty:        
          Os:  Linux     |     Blocking:        
Architecture:  x86       |      Failure:  Other  
-------------------------+--------------------------------------------------
Changes (by simonpj):

  * owner:  => dreixel
  * milestone:  => 7.4.1


Old description:

> Type checking the attached code produces a legitimate type error, and
> also the following message:
>
> >>>
> Tip.hs:107:14:ghc: panic! (the 'impossible' happened)
>   (GHC version 7.0.3 for i386-unknown-linux):
>         Exotic form of kind ghc-prim:GHC.Prim.?{(w) tc 34g}
> <<<

New description:

 Type checking the attached code produces a legitimate type error, and also
 the following message:

 {{{
 Tip.hs:107:14:ghc: panic! (the 'impossible' happened)
   (GHC version 7.0.3 for i386-unknown-linux):
         Exotic form of kind ghc-prim:GHC.Prim.?{(w) tc 34g}
 }}}

--

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: panic, impossible happened, "Exotic form of kind"

GHC
In reply to this post by GHC
#5612: panic, impossible happened, "Exotic form of kind"
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  dreixel
        Type:  bug                         |      Status:  new    
    Priority:  normal                      |   Milestone:  7.4.1  
   Component:  Compiler                    |     Version:  7.3    
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Linux  
Architecture:  x86                         |     Failure:  Other  
  Difficulty:                              |    Testcase:        
   Blockedby:                              |    Blocking:        
     Related:                              |  
-------------------------------------------+--------------------------------
Changes (by lunaris):

  * keywords:  => PolyKinds, TemplateHaskell
  * version:  7.0.3 => 7.3


Comment:

 I can reproduce what appears to be the same bug with the following:

 First.hs:

 {{{
 {-# LANGUAGE PolyKinds #-}

 module First where

 data Proxy (as :: [*])
   = Proxy

 f :: Proxy as -> ()
 f _
   = ()
 }}}

 Second.hs:

 {{{
 module Second where

 import First

 import Language.Haskell.TH
 }}}

 GHCI session:

 {{{
 % ghci -XTemplateHaskell Second.hs
 GHCi, version 7.3.20111204: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 2] Compiling First            ( First.hs, interpreted )
 [2 of 2] Compiling Second           ( Second.hs, interpreted )
 Ok, modules loaded: Second, First.
 *Second> $(reify 'f >>= stringE . show)
 Loading package array-0.3.0.3 ... linking ... done.
 Loading package deepseq-1.2.0.1 ... linking ... done.
 Loading package containers-0.4.2.0 ... linking ... done.
 Loading package pretty-1.1.0.0 ... linking ... done.
 Loading package template-haskell ... linking ... done.

 <interactive>:2:3:
     Exception when trying to run compile-time code:
       <interactive>: panic! (the 'impossible' happened)
   (GHC version 7.3.20111204 for x86_64-unknown-linux):
         Exotic form of kind [ghc-prim:GHC.Prim.*{(w) tc 34d}]

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

       Code: (>>=) reify 'f (.) stringE show
     In the expression: $(reify 'f >>= stringE . show)
     In an equation for `it': it = $(reify 'f >>= stringE . show)
 }}}

 As far as I can tell, there aren't any TH constructors for promoted kinds
 yet, so reifyKind in TcSplice can't do anything better.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: panic, impossible happened, "Exotic form of kind"

GHC
In reply to this post by GHC
#5612: panic, impossible happened, "Exotic form of kind"
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  dreixel
        Type:  bug                         |      Status:  new    
    Priority:  normal                      |   Milestone:  7.4.1  
   Component:  Compiler                    |     Version:  7.3    
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Linux  
Architecture:  x86                         |     Failure:  Other  
  Difficulty:                              |    Testcase:        
   Blockedby:                              |    Blocking:        
     Related:                              |  
-------------------------------------------+--------------------------------

Comment(by dreixel):

 Replying to [comment:3 lunaris]:
 > I can reproduce what appears to be the same bug with the following:

 I think they are different things, as the original report wasn't using
 promoted kinds at all.

 (Though we should certainly do something about reification of promoted
 kinds too; thanks for reporting.)

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: panic, impossible happened, "Exotic form of kind"

GHC
In reply to this post by GHC
#5612: panic, impossible happened, "Exotic form of kind"
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  dreixel
        Type:  bug                         |      Status:  new    
    Priority:  normal                      |   Milestone:  7.4.1  
   Component:  Compiler                    |     Version:  7.3    
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Linux  
Architecture:  x86                         |     Failure:  Other  
  Difficulty:                              |    Testcase:        
   Blockedby:                              |    Blocking:        
     Related:                              |  
-------------------------------------------+--------------------------------

Comment(by dreixel):

 I cannot reproduce the original error in ghc-7.2.1 (even after fixing a
 probably unintended type error in the source).

 So I'm leaving this to track only lunaris's report with `-XPolyKinds`.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: panic, impossible happened, "Exotic form of kind"

GHC
In reply to this post by GHC
#5612: panic, impossible happened, "Exotic form of kind"
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  dreixel
        Type:  bug                         |      Status:  new    
    Priority:  normal                      |   Milestone:  7.4.1  
   Component:  Compiler                    |     Version:  7.3    
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Linux  
Architecture:  x86                         |     Failure:  Other  
  Difficulty:                              |    Testcase:        
   Blockedby:                              |    Blocking:        
     Related:                              |  
-------------------------------------------+--------------------------------

Comment(by lunaris):

 If there's some sort of design in place for how kinds might be handled in
 TH.Kind, then I'm all up for implementing it, but there doesn't appear to
 be one yet.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell (was: panic, impossible happened, "Exotic form of kind")

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  dreixel        
        Type:  feature request             |      Status:  new            
    Priority:  normal                      |   Milestone:  7.4.1          
   Component:  Compiler                    |     Version:  7.3            
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple            |     Failure:  Other          
  Difficulty:                              |    Testcase:                  
   Blockedby:                              |    Blocking:                  
     Related:                              |  
-------------------------------------------+--------------------------------
Changes (by dreixel):

  * type:  bug => feature request
  * os:  Linux => Unknown/Multiple
  * architecture:  x86 => Unknown/Multiple


Comment:

 http://hackage.haskell.org/trac/ghc/changeset/e328942561be162dd5f42b4ef630249ed34f1ef9
 gives a more civilized error. Also for kinds like `Constraint`, which TH
 doesn't handle either.

 I guess this will do for 7.4, and we should indeed come up with a design
 for handling the new kinds in TH.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  dreixel        
        Type:  feature request             |      Status:  new            
    Priority:  low                         |   Milestone:  7.6.1          
   Component:  Compiler                    |     Version:  7.3            
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple            |     Failure:  Other          
  Difficulty:                              |    Testcase:                  
   Blockedby:                              |    Blocking:                  
     Related:                              |  
-------------------------------------------+--------------------------------
Changes (by goldfire):

 * cc: eir@… (added)


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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  goldfire        
        Type:  feature request             |      Status:  new            
    Priority:  low                         |   Milestone:  7.6.1          
   Component:  Compiler                    |     Version:  7.3            
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple            |     Failure:  Other          
  Difficulty:                              |    Testcase:                  
   Blockedby:                              |    Blocking:                  
     Related:                              |  
-------------------------------------------+--------------------------------
Changes (by goldfire):

  * owner:  dreixel => goldfire


Comment:

 Check out TemplateHaskellRichKinds for implementation plan.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  igloo          
        Type:  feature request             |      Status:  new            
    Priority:  low                         |   Milestone:  7.6.1          
   Component:  Compiler                    |     Version:  7.3            
    Keywords:  PolyKinds, TemplateHaskell  |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple            |     Failure:  Other          
  Difficulty:                              |    Testcase:                  
   Blockedby:                              |    Blocking:                  
     Related:                              |  
-------------------------------------------+--------------------------------
Changes (by goldfire):

  * owner:  goldfire => igloo


Comment:

 Implementation complete and straightforward. Check out the attached
 patches.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:                  
        Type:  feature request             |      Status:  new            
    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:                              |  
-------------------------------------------+--------------------------------
Changes (by igloo):

  * owner:  igloo =>
  * difficulty:  => Unknown


Comment:

 thanks, we'll take a look

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#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:                              |  
-------------------------------------------+--------------------------------
Changes (by igloo):

  * status:  new => patch


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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#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
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  lunaris        
        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:                              |  
-------------------------------------------+--------------------------------
Changes (by lunaris):

  * owner:  => lunaris


Comment:

 I'm having a go at implementing simonpj's changes on top of goldfire's
 patch in HEAD. I'm not too fond on the proposed:

 {{{
 type Kind = Type
 }}}

 But given that there is now a massive overlap between the types it may
 well be the sane option.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  lunaris        
        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 goldfire):

 Thanks for taking a look at this, lunaris. I've been meaning to get back
 to it, but time has been short with a paper deadline looming tomorrow.

 I, too, was worried about {{{Kind = Type}}}, though my biggest fear was
 disrupting code that already uses {{{Kind}}}. In any case, setting {{{Kind
 = Type}}} now may be a sign of what's to come, so it may not be a bad
 idea.

 As for {{{ForallK}}}, it's not clear to me how to implement it. For
 example, consider this:

 {{{
 data Foo (a :: k -> *) (b :: k) where
   Bar :: a b -> Foo a b
 }}}

 The TH rendition of {{{Foo}}} will have two {{{KindedTV}}}s. Where should
 the {{{ForallK}}} be? If we want to explicitly quantify over kind
 variables, it looks like one route would be to make a {{{KindV}}}
 constructor for {{{TyVarBndr}}}. Then, the above declaration would be
 something like (letting {{{Name}}}s be strings):

 {{{
 DataD [] "Foo" [KindV "k",
                 KindedTV "a" ((VarK "k") `ArrowK` StarK),
                 KindedTV (VarK "k")] [...] []
 }}}

 There is also the question of what to do with explicit quantification when
 converting back from TH constructs into GHC's internal constructs, which
 don't have explicit kind variable quantification at that stage of the
 pipeline. Simply ignore the quantification? Error-check?

 In any case, the implementation contained in the patches avoids the
 problem by doing what surface Haskell does: it just uses implicit kind
 variable quantification.

 I'll be back above water by the middle of next week and would be happy to
 contribute again. Lunaris, let me know if there is a way I can help.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  lunaris        
        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):

 In the source language (as it stands) there is no way to ''explicitly''
 quantify over a kind variable; you cannot say `forall k. forall (a::k).
 blah`.  Instead, kind quantification is always implicit.  (This is really
 a missing feature, but that's another story.)

 Currently TH is just concrete syntax for Haskell source syntax.  So I
 think it's proably ok not to have `KindV`, but instead simply not to bind
 kind variables explicitly.

 All of this is ''bound'' to affect TH users using `Kind`; there's really
 no alternative I think.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  lunaris        
        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 lunaris):

 Ok, so the functionality described above seems to be working (patches once
 validation has completed). As it stands, I made the following changes:

   * {{{Type}}} and {{{Kind}}} are one and the same:
 {{{
     data Type = ...
               | PromotedT Name
               | PromotedTupleT Int
               | PromotedNilT
               | PromotedConsT
               | StarT
               | ConstraintT

     type Kind = Type
   }}}

   I'm not sure if this is what was envisaged, but to "compensate" I've
 also provided functions such as {{{varK, conK, arrowK, listK, starK,
 constraintK}}} etc.

   * {{{PromotedT}}} applications are produced by checking an
 {{{HsTyVar}}}'s name to see if it falls in the {{{Data}}} namespace
 ({{{isDataOcc}}}). This appears to work but I'm not sure if it's
 guaranteed to be correct.

   * Since {{{Type}}} and {{{Kind}}} are now the same type, arrows at the
 kind level have changed. It may be worth adding functions to {{{TH.Lib}}}
 that encapsulate the "obvious" folds -- I find myself using {{{foldr (appT
 . appT promotedConsT) promotedNilT}}} and others quite a bit.

   * Reifying a type such as:
 {{{
 data Dict c where
   Dict :: c => Dict c
 }}}

   won't work because irreducible constraints aren't in TH. Is this simply
 a case of adding something like:
 {{{
 data Pred = ...
           | VarP Name
 }}}

   (modulo the name {{{VarP}}} since {{{Pat}}} has taken it already) or are
 we going to end up in trouble if we do this? Similarly, is there ever a
 case where we'll hit {{{TuplePred}}} during a call to {{{reify}}}?

 I think that's it; other than that it seems all right.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  lunaris        
        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 goldfire):

 I, for one, like the idea of fold and unfold operations in the TH library.

 How would one refer to the kind {{{Nat}}}? Is it {{{PromotedT (mkName
 "Nat")}}} or {{{ConT (mkName "Nat")}}} (both used in a context expecting a
 kind)? Does the algorithm in Convert.lhs check for consistent usage of
 {{{ConT}}} vs {{{PromotedT}}}?

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: [GHC] #5612: Better support for kinds in Template Haskell

GHC
In reply to this post by GHC
#5612: Better support for kinds in Template Haskell
-------------------------------------------+--------------------------------
    Reporter:  guest                       |       Owner:  lunaris        
        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 lunaris):

 I'm currently working on the {{{Nat}}} stuff, because I'm pretty sure
 {{{reify}}} can't deal with it yet. There's also the issue that the
 interface in {{{GHC.TypeLits}}} doesn't appear to be finalised yet (at
 least not to my mind).

 I think the folds should be added, though perhaps as a separate
 ticket/patch. I think many of the use-cases for {{{arrowK}}}/{{{arrowT}}}
 and {{{promotedConsT}}}/{{{promotedNilT}}} etc. entail the same two or
 three functions.

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

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