
#9563: Support for deriving Generic1 for data families -------------------------------------+------------------------------------- Reporter: mnislaih | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: MacOS X Architecture: Unknown/Multiple | Type of failure: GHC Difficulty: Unknown | rejects valid program Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- The following code: {{{#!hs import GHC.Generics data family F typ :: * -> * data A data instance F A a = AData a deriving Generic1 }}} produces an error when run with ghc 7.8.2 or 7.8.3: {{{ Couldn't match type ‘Rep1 (F A)’ with ‘M1 t0 t1 (M1 t2 t3 (M1 t4 t5 Par1))’ The type variables ‘t0’, ‘t1’, ‘t2’, ‘t3’, ‘t4’, ‘t5’ are ambiguous Expected type: Rep1 (F A) a Actual type: M1 t0 t1 (M1 t2 t3 (M1 t4 t5 Par1)) a In the pattern: M1 (M1 (M1 g1)) In an equation for ‘to1’: to1 (M1 (M1 (M1 g1))) = AData (unPar1 g1) In the instance declaration for ‘Generic1 (F A)’ }}} whereas ghc 7.6.3 simply refuses to go ahead with the message: {{{ generic1.hs:14:40: Derived instance `Generic1 (F A)' requires illegal partial application of data type family F In the data instance declaration for `F' }}} Either a check has gone missing in 7.8.x, or a bug has crept up in the Generic1 support. I have gone through past tickets and https://ghc.haskell.org/trac/ghc/ticket/5936 suggests that it is the latter. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9563 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler