X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypes%2FTyCon.lhs;h=0460e6ef7e16b82ed82c49d6dd043b6c4679bb6a;hb=1fb1ab5d53a09607e7f6d2450806760688396387;hp=d473ea48d78571ede8dac961bac3827814e51634;hpb=7a3bd641457666e10d0a47be9f22762e03defbf0;p=ghc-hetmet.git diff --git a/ghc/compiler/types/TyCon.lhs b/ghc/compiler/types/TyCon.lhs index d473ea4..0460e6e 100644 --- a/ghc/compiler/types/TyCon.lhs +++ b/ghc/compiler/types/TyCon.lhs @@ -34,7 +34,7 @@ module TyCon( getSynTyConDefn, maybeTyConSingleCon, - isEnumerationTyCon, + isEnumerationTyCon, isTupleTyCon, derivedFor ) where @@ -79,6 +79,11 @@ data TyCon [TyVar] [(Class,Type)] -- Its context [Id] -- Its data constructors, with fully polymorphic types + -- This list can be empty, when we import a data type abstractly, + -- either (a) the interface is hand-written and doesn't give + -- the constructors, or + -- (b) in a quest for fast compilation we don't import + -- the constructors [Class] -- Classes which have derived instances NewOrData @@ -275,6 +280,13 @@ isEnumerationTyCon (TupleTyCon _ _ arity) = arity == 0 isEnumerationTyCon (DataTyCon _ _ _ _ _ data_cons _ _) = not (null data_cons) && all isNullaryDataCon data_cons + + +isTupleTyCon (TupleTyCon _ _ arity) = arity >= 2 -- treat "0-tuple" specially +isTupleTyCon (SpecTyCon tc tys) = isTupleTyCon tc +isTupleTyCon other = False + + \end{code} @derivedFor@ reports if we have an {\em obviously}-derived instance