Ticket #6081 (closed bug: fixed)
Kind variables not allowed in class instance declarations
| Reported by: | goldfire | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Compiler (Type checker) | Version: | 7.5 |
| Keywords: | PolyKinds | Cc: | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | polykinds/T6081 | Blocked By: | |
| Blocking: | Related Tickets: | #6064 |
Description
Consider the following code:
{-# LANGUAGE KindSignatures, PolyKinds, DataKinds, RankNTypes #-}
data KProxy (a :: *) = KP
class KindClass (kp :: KProxy k)
instance KindClass (KP :: KProxy [k])
The last line fails to compile, producing the following error message:
Not in scope: type variable `k'
However, there is a workaround. When I change the last line to
instance forall (a :: k). KindClass (KP :: KProxy [k])
all is good. Unfortunately, this last line requires the declaration of an unused type variable a, which is a little messy.
This was tested on 7.5.20120426.
Change History
Note: See
TracTickets for help on using
tickets.
