Opened 5 years ago

Closed 5 years ago

#5530 closed feature request (wontfix)

TyVarBndr inside type quotations don't have kinds ascribed

Reported by: nfrisby Owned by:
Priority: normal Milestone: 7.6.1
Component: Template Haskell Version: 7.0.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The top-level splice

  [t| Functor f => f a |] >>= \ty -> report False (show ty) >> return [] 

gives (I cleaned up the names)

  ForallT [PlainTV f,PlainTV a] [ClassP Functor [VarT f]] (AppT (VarT f) (VarT a))

Notice the PlainTV f bit, which suggests f :: *. I can't find the documentation on PlainTV, but I suspect it isn't actually specified such that the resulting type variable is *.

This does seem like inconsistent behavior out of GHC, however: it usually provides KindedTV where it can. Since GHC catches kind errors inside [t|...|], it seems it ought to be able to generate KindedTV where possible.

Change History (1)

comment:1 Changed 5 years ago by igloo

Milestone: 7.6.1
Resolution: wontfix
Status: newclosed

Thanks for the suggestion.

As far as I know, PlainTV just means that the TV doesn't have a kind signature.

It looks to me like we get KindedTV when the quasi-quoted code gives a kind signature, e.g.:

Prelude Language.Haskell.TH> runQ [d| data T a = T a |]
[DataD [] T_7 [PlainTV a_9] [NormalC T_8 [(NotStrict,VarT a_9)]] []]
Prelude Language.Haskell.TH> runQ [d| data T (a :: *) = T a |]
[DataD [] T_10 [KindedTV a_12 StarK] [NormalC T_11 [(NotStrict,VarT a_12)]] []]

which I believe is by design. I'm therefore closing this ticket, but please reopen it if there is support on the mailing lists for an alternative design.

Note: See TracTickets for help on using tickets.