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