[GHC] #14490: TTG Snags

GHC ghc-devs at haskell.org
Thu Nov 30 21:02:50 UTC 2017


#14490: TTG Snags
-------------------------------------+-------------------------------------
        Reporter:  alanz             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #14482            |  Differential Rev(s):
       Wiki Page:                    |
  ImplementingTreesThatGrow          |
-------------------------------------+-------------------------------------

Comment (by alanz):

 Given the following module

 {{{#!hs
 {-# LANGUAGE TypeFamilies, GADTs, FlexibleInstances, StandaloneDeriving,
 DeriveDataTypeable #-}
 {-# LANGUAGE DataKinds #-}

 module Oddity where

 import Data.Data

 data GhcPass (p :: Pass)
 data Pass = Parsed | Renamed | Typechecked
          deriving (Data)

 deriving instance Typeable p => Data (GhcPass p)

 type family XOverLit x

 type instance XOverLit (GhcPass 'Parsed)      = Int
 type instance XOverLit (GhcPass 'Renamed)     = Int
 type instance XOverLit (GhcPass 'Typechecked) = Char

 data Foo p = Foo (XOverLit p)
 deriving instance (Typeable p) => Data (Foo (GhcPass p))
 }}}

 I do not understand why deriving the `Data` instance for `Foo (GhcPass p)`
 fails

 {{{
 Oddity.hs:21:1-56: error:
     • Could not deduce (Data (XOverLit (GhcPass p)))
         arising from a use of ‘k’
 }}}

 Is this a weakness in the deriving process? Because as I understand it,
 there is a concrete value for every `(GhcPass p)`, given the way `GhcPass`
 is defined as being indexed by `Pass`.

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


More information about the ghc-tickets mailing list