[GHC] #14457: Data family with non-Type return kind, can't figure out type despite annotating

GHC ghc-devs at haskell.org
Sun Nov 12 18:31:02 UTC 2017


#14457: Data family with non-Type return kind, can't figure out type despite
annotating
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:  duplicate         |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #12369, #14111    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * status:  new => closed
 * resolution:   => duplicate
 * related:  #12369 => #12369, #14111


Comment:

 This is a duplicate of #14111, so I'll close this ticket in favor of that
 one.

 The issue actually has nothing to do with the return kind. We can see this
 in this stripped-down version of your example:

 {{{#!hs
 {-# Language KindSignatures, DataKinds, TypeFamilyDependencies, GADTs,
 TypeInType #-}

 import Data.Kind

 type family
   ToNat (n::Type) = (res :: Type) | res -> n where
   ToNat Type           = Bool
   ToNat (Type -> Type) = Maybe Bool

 data family FN (a :: k) (b :: Type) :: Type

 data instance
   FN (a :: Maybe Bool) (b :: Type) :: Type where
   A  :: FN Nothing a
 }}}
 {{{
 $ /opt/ghc/8.2.1/bin/ghci Bug.hs
 GHCi, version 8.2.1: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Main             ( Bug.hs, interpreted )

 Bug.hs:14:3: error:
     • Data constructor ‘A’ returns type ‘FN 'Nothing a1’
         instead of an instance of its parent type ‘FN a b’
     • In the definition of data constructor ‘A’
       In the data instance declaration for ‘FN’
    |
 14 |   A  :: FN Nothing a
    |   ^
 }}}

 In principle, there should be enough types here that GHC can figure out
 what to do, but unfortunately that's not the case at the moment (due to
 #14111).

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


More information about the ghc-tickets mailing list