+
+data AlgTyConFlavour
+ = DataTyCon -- Data type
+
+ | EnumTyCon -- Special sort of enumeration type
+
+ | NewTyCon Type -- Newtype, with its *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. If you want hte original RHS, look at the
+ -- argument type of the data constructor.
+
+data DataConDetails datacon
+ = DataCons [datacon] -- Its data constructors, with fully polymorphic types
+ -- A type can have zero constructors
+
+ | Unknown -- We're importing this data type from an hi-boot file
+ -- and we don't know what its constructors are
+
+ | HasCons Int -- In a quest for compilation speed we have imported
+ -- only the number of constructors (to get return
+ -- conventions right) but not the constructors themselves
+
+visibleDataCons (DataCons cs) = cs
+visibleDataCons other = []