Commit 946cbcef authored by jpm@cs.ox.ac.uk's avatar jpm@cs.ox.ac.uk

Fix support for deriving Generic1 for data families (FIX #9563)

parent 695d15d0
......@@ -486,10 +486,11 @@ tc_mkRepFamInsts gk tycon metaDts mod =
-- `appT` = D Int a b (data families case)
Just (famtycon, apps) ->
-- `fam` = D
-- `apps` = [Int, a]
let allApps = apps ++
drop (length apps + length tyvars
- tyConArity famtycon) tyvar_args
-- `apps` = [Int, a, b]
let allApps = case gk of
Gen0 -> apps
Gen1 -> ASSERT(not $ null apps)
init apps
in [mkTyConApp famtycon allApps]
-- `appT` = D a b (normal case)
Nothing -> [mkTyConApp tycon tyvar_args]
......
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
module T9563 where
import GHC.Generics
data family F typ :: * -> *
data A
data instance F A a = AData a
deriving (Generic, Generic1)
data family G a b c d
data instance G Int b Float d = H deriving Generic
deriving instance Generic1 (G Int b Float)
......@@ -32,3 +32,4 @@ test('T7878', extra_clean(['T7878A.o' ,'T7878A.hi'
test('T8468', normal, compile_fail, [''])
test('T8479', normal, compile, [''])
test('T9563', normal, compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment