Data package:ghc-lib-parser

A data constructor
Data Constructor Representation See Note [Data constructor workers and wrappers]
Type constructors representing an *instance* of a *data* family. Parameters: 1) The type family in question 2) Instance types; free variables are the tyConTyVars of the current TyCon (not the family one). INVARIANT: the number of types matches the arity of the family TyCon 3) A CoTyCon identifying the representation type with the type instance family
Represents an open type family without a fixed right hand side. Additional instances can appear at any time. These are introduced by either a top level declaration:
data family T a :: Type
Or an associated data type declaration, within a class declaration:
class C a b where
data T b :: Type
Information about those TyCons derived from a data declaration. This includes data types with no constructors at all.
Data Family Instance Declaration
An accumulator to build a prefix data constructor, e.g. when parsing MkT A B C, the accumulator will evolve as follows:
1. PrefixDataConBuilder []        MkT
2. PrefixDataConBuilder [A]       MkT
3. PrefixDataConBuilder [A, B]    MkT
4. PrefixDataConBuilder [A, B, C] MkT

There are two reasons we have a separate builder type instead of using HsConDeclDetails GhcPs directly:
  1. It's faster, because OrdList gives us constant-time snoc.
  2. Having a separate type helps ensure that we don't forget to finalize a RecTy into a RecCon (we do that in dataConBuilderDetails).
See Note [PatBuilder] for another builder type used in the parser. Here the technique is similar, but the motivation is different.