
Is this a weakness in the deriving process? Because as I understand it,
#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 RyanGlScott): Replying to [comment:41 alanz]: there is a concrete value for every `(GhcPass p)`, given the way `GhcPass` is defined as being indexed by `Pass`. This is not how type families work. Type families only reduce when you provide arguments that match an instance in scope. `XOverlit (GhcPass p)` does not match any instances, and thus it doesn't reduce. If you want this to compile, you'll need something like this: {{{#!hs {-# LANGUAGE TypeFamilies, GADTs, FlexibleInstances, StandaloneDeriving, DeriveDataTypeable #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE UndecidableInstances #-} 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 (XOverLit (GhcPass p))) => Data (Foo (GhcPass p)) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14490#comment:43 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler