[GHC] #15874: Data families with higher-rank kinds

GHC ghc-devs at haskell.org
Wed Nov 7 20:50:15 UTC 2018


#15874: Data families with higher-rank kinds
-------------------------------------+-------------------------------------
           Reporter:  Iceland_jack   |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.6.2
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# Language RankNTypes   #-}
 {-# Language DataKinds    #-}
 {-# Language PolyKinds    #-}
 {-# Language GADTs        #-}
 {-# Language TypeFamilies #-}

 import Data.Kind

 data Var where
   Op :: Var
   Id :: Var

 -- type family
 --   Flip (var :: Var) = (res :: Var) | res -> var where
 --   Flip Op = Id
 --   Flip Id = Op

 type Varianced = (forall (var :: Var). Type)

 -- data A :: Varianced where
 --   MkA :: Int -> A @Id

 -- data OpA :: Varianced where
 --   MkOpA :: Int -> OpA @Op

 -- data Exp :: Varianced -> Varianced where
 --   X :: forall (ext::Varianced) (var :: Var). Exp ext @var
   -- OpExp1 :: forall (var :: Varianced). var @op -> Exp var @(Flip op)

 data family   Parser :: Varianced
 data instance Parser = P
 }}}

 {{{
 $ ~/code/unmodifiedghc/inplace/bin/ghc-stage2 --interactive -ignore-dot-
 ghci 656.hs
 GHCi, version 8.7.20181029: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( 656.hs, interpreted )
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.7.20181029 for x86_64-unknown-linux):
         ASSERT failed!
   kind axiom D:R:Parservar0 ::
          Parser = R:Parservar -- Defined at 656.hs:31:15
   forall (var :: Var). *
   Var -> *
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in
 ghc:Outputable
         pprPanic, called at compiler/utils/Outputable.hs:1219:5 in
 ghc:Outputable
         assertPprPanic, called at compiler/typecheck/FamInst.hs:158:61 in
 ghc:FamInst

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

 >
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15874>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list