#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
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs