Skip to content

Deriving clause failure with polymorphic kinds

Consider

{-# Language GADTs, PolyKinds, TypeFamilies, DataKinds #-}
module Fam where

data Cmp a where
 Sup ::      Cmp a
 V   :: a -> Cmp a
 deriving (Show, Eq)

data family   CmpInterval (a :: Cmp k) (b :: Cmp k) :: *
data instance CmpInterval (V c)         Sup          = Starting c
  deriving( Show )

GHC 7.8.3 gives

Fam.hs:12:13:
    Can't make a derived instance of ‘Show (CmpInterval ('V c) 'Sup)’:
      No family instance for ‘CmpInterval ('V c) 'Sup’
    In the data instance declaration for ‘CmpInterval’

which is obviously wrong.

Reported on glasgow-haskell-users.

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information