projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 1997-03-14 07:52:06 by simonpj]
[ghc-hetmet.git]
/
ghc
/
compiler
/
types
/
TyCon.lhs
diff --git
a/ghc/compiler/types/TyCon.lhs
b/ghc/compiler/types/TyCon.lhs
index
d473ea4
..
0460e6e
100644
(file)
--- a/
ghc/compiler/types/TyCon.lhs
+++ b/
ghc/compiler/types/TyCon.lhs
@@
-34,7
+34,7
@@
module TyCon(
getSynTyConDefn,
maybeTyConSingleCon,
getSynTyConDefn,
maybeTyConSingleCon,
- isEnumerationTyCon,
+ isEnumerationTyCon, isTupleTyCon,
derivedFor
) where
derivedFor
) where
@@
-79,6
+79,11
@@
data TyCon
[TyVar]
[(Class,Type)] -- Its context
[Id] -- Its data constructors, with fully polymorphic types
[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
[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
= 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
\end{code}
@derivedFor@ reports if we have an {\em obviously}-derived instance