HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleghc-10.0.0.20260917GHC2024

GHC.Parser.Types

  • 4 types
  • 1 value
datadata PatBuilder p
#
Instances10Outputable, DisambECP, Anno, Body, FunArg, InfixOp, …
datadata DataConBuilder
#

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.

Instances2Outputable, DisambTD