Commit 84742c08 authored by jpm@cs.ox.ac.uk's avatar jpm@cs.ox.ac.uk

Fix #7710: do not AutoDeriveTypeable for synonyms and type families

parent e7729b4d
......@@ -15,7 +15,8 @@ module HsDecls (
HsDecl(..), LHsDecl, HsDataDefn(..),
-- ** Class or type declarations
TyClDecl(..), LTyClDecl, TyClGroup,
isClassDecl, isDataDecl, isSynDecl, isFamilyDecl, tcdName,
isClassDecl, isDataDecl, isSynDecl, tcdName,
isFamilyDecl, isTypeFamilyDecl, isDataFamilyDecl,
tyFamInstDeclName, tyFamInstDeclLName,
countTyClDecls, pprTyClDeclFlavour,
tyClDeclLName, tyClDeclTyVars,
......@@ -476,7 +477,7 @@ data FamilyDecl name = FamilyDecl
data FamilyFlavour
= TypeFamily
| DataFamily
deriving( Data, Typeable )
deriving( Data, Typeable, Eq )
\end{code}
......@@ -500,10 +501,20 @@ isClassDecl :: TyClDecl name -> Bool
isClassDecl (ClassDecl {}) = True
isClassDecl _ = False
-- | type family declaration
-- | type/data family declaration
isFamilyDecl :: TyClDecl name -> Bool
isFamilyDecl (FamDecl {}) = True
isFamilyDecl _other = False
-- | type family declaration
isTypeFamilyDecl :: TyClDecl name -> Bool
isTypeFamilyDecl (FamDecl d) = fdFlavour d == TypeFamily
isTypeFamilyDecl _other = False
-- | data family declaration
isDataFamilyDecl :: TyClDecl name -> Bool
isDataFamilyDecl (FamDecl d) = fdFlavour d == DataFamily
isDataFamilyDecl _other = False
\end{code}
Dealing with names
......
......@@ -379,7 +379,7 @@ tcDeriving tycl_decls inst_decls deriv_decls
deriveTypeable tys =
[ L l (DerivDecl (L l (HsAppTy (noLoc (HsTyVar typeableClassName))
(L l (HsTyVar (tcdName t))))))
| L l t <- tys ]
| L l t <- tys, not (isSynDecl t), not (isTypeFamilyDecl t) ]
-- Prints the representable type family instance
pprRepTy :: FamInst Unbranched -> SDoc
......
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