summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2023-03-30 18:50:08 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-04-01 18:28:37 -0400
commit3da693466fd3e6a609a1a77361c50ed1b141858d (patch)
tree57bbb60c6e1b33665b53d647569a2a3a1ea0abf1 /libraries
parent6e2eb275a1b6d3d1dae9c2864f001bea69d20c2a (diff)
downloadhaskell-3da693466fd3e6a609a1a77361c50ed1b141858d.tar.gz
Improve haddocks of template-haskell Con datatype
This adds a bit more information, in particular about the lists of constructors in the GadtC and RecGadtC cases.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs38
1 files changed, 27 insertions, 11 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 6668273a14..221fd5ca28 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -2685,7 +2685,7 @@ data DecidedStrictness = DecidedLazy -- ^ Field inferred to not have a bang.
| DecidedUnpack -- ^ Field inferred to be unpacked.
deriving (Show, Eq, Ord, Data, Generic)
--- | A single data constructor.
+-- | A data constructor.
--
-- The constructors for 'Con' can roughly be divided up into two categories:
-- those for constructors with \"vanilla\" syntax ('NormalC', 'RecC', and
@@ -2718,16 +2718,32 @@ data DecidedStrictness = DecidedLazy -- ^ Field inferred to not have a bang.
-- Multiplicity annotations for data types are currently not supported
-- in Template Haskell (i.e. all fields represented by Template Haskell
-- will be linear).
-data Con = NormalC Name [BangType] -- ^ @C Int a@
- | RecC Name [VarBangType] -- ^ @C { v :: Int, w :: a }@
- | InfixC BangType Name BangType -- ^ @Int :+ a@
- | ForallC [TyVarBndr Specificity] Cxt Con -- ^ @forall a. Eq a => C [a]@
- | GadtC (NonEmpty Name) [BangType]
- Type -- See Note [GADT return type]
- -- ^ @C :: a -> b -> T b Int@
- | RecGadtC (NonEmpty Name) [VarBangType]
- Type -- See Note [GADT return type]
- -- ^ @C :: { v :: Int } -> T b Int@
+data Con =
+ -- | @C Int a@
+ NormalC Name [BangType]
+
+ -- | @C { v :: Int, w :: a }@
+ | RecC Name [VarBangType]
+
+ -- | @Int :+ a@
+ | InfixC BangType Name BangType
+
+ -- | @forall a. Eq a => C [a]@
+ | ForallC [TyVarBndr Specificity] Cxt Con
+
+ -- @C :: a -> b -> T b Int@
+ | GadtC (NonEmpty Name)
+ -- ^ The list of constructors, corresponding to the GADT constructor
+ -- syntax @C1, C2 :: a -> T b@
+ [BangType] -- ^ The constructor arguments
+ Type -- ^ See Note [GADT return type]
+
+ -- | @C :: { v :: Int } -> T b Int@
+ | RecGadtC (NonEmpty Name)
+ -- ^ The list of constructors, corresponding to the GADT record
+ -- constructor syntax @C1, C2 :: { fld :: a } -> T b@
+ [VarBangType] -- ^ The constructor arguments
+ Type -- ^ See Note [GADT return type]
deriving (Show, Eq, Ord, Data, Generic)
-- Note [GADT return type]