+type ArgVrcs = [(Bool,Bool)] -- Tyvar variance info: [(occPos,occNeg)]
+ -- [] means "no information, assume the worst"
+
+data AlgTyConRhs
+ = AbstractTyCon -- We know nothing about this data type, except
+ -- that it's represented by a pointer
+ -- Used when we export a data type abstractly into
+ -- an hi file
+
+ | DataTyCon
+ [DataCon] -- The constructors; can be empty if the user declares
+ -- the type to have no constructors
+ Bool -- Cached: True <=> an enumeration type
+
+ | NewTyCon -- Newtypes always have exactly one constructor
+ DataCon -- The unique constructor; it has no existentials
+ Type -- Cached: the argument type of the constructor
+ -- = the representation type of the tycon
+
+ Type -- Cached: the *ultimate* representation type
+ -- By 'ultimate' I mean that the rep type is not itself
+ -- a newtype or type synonym.
+ -- The rep type isn't entirely simple:
+ -- for a recursive newtype we pick () as the rep type
+ -- newtype T = MkT T
+ --
+ -- The rep type has free type variables the tyConTyVars
+ -- Thus:
+ -- newtype T a = MkT [(a,Int)]
+ -- The rep type is [(a,Int)]
+ -- NB: the rep type isn't necessarily the original RHS of the
+ -- newtype decl, because the rep type looks through other
+ -- newtypes.
+
+visibleDataCons :: AlgTyConRhs -> [DataCon]
+visibleDataCons AbstractTyCon = []
+visibleDataCons (DataTyCon cs _) = cs
+visibleDataCons (NewTyCon c _ _) = [c]
+\end{code}