Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Commit 53997f3

Browse files
authored
Keep forall on H98 existential data constructors (#1003)
The information about whether or not there is a source-level `forall` is already available on a `ConDecl` (as `con_forall`), so we should use it instead of always assuming `False`! Fixes #1002.
1 parent a650450 commit 53997f3

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

haddock-api/src/Haddock/Backends/LaTeX.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,9 @@ ppSideBySideConstr subdocs unicode leader (L _ con) =
758758
decl = case con of
759759
ConDeclH98{ con_args = det
760760
, con_ex_tvs = tyVars
761+
, con_forall = L _ forall_
761762
, con_mb_cxt = cxt
762763
} -> let context = unLoc (fromMaybe (noLoc []) cxt)
763-
forall_ = False
764764
header_ = ppConstrHdr forall_ tyVars context unicode
765765
in case det of
766766
-- Prefix constructor, e.g. 'Just a'

haddock-api/src/Haddock/Backends/Xhtml/Decl.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,9 @@ ppShortConstrParts summary dataInst con unicode qual
800800
= case con of
801801
ConDeclH98{ con_args = det
802802
, con_ex_tvs = tyVars
803+
, con_forall = L _ forall_
803804
, con_mb_cxt = cxt
804805
} -> let context = unLoc (fromMaybe (noLoc []) cxt)
805-
forall_ = False
806806
header_ = ppConstrHdr forall_ tyVars context unicode qual
807807
in case det of
808808

@@ -873,9 +873,9 @@ ppSideBySideConstr subdocs fixities unicode pkg qual (L _ con)
873873
decl = case con of
874874
ConDeclH98{ con_args = det
875875
, con_ex_tvs = tyVars
876+
, con_forall = L _ forall_
876877
, con_mb_cxt = cxt
877878
} -> let context = unLoc (fromMaybe (noLoc []) cxt)
878-
forall_ = False
879879
header_ = ppConstrHdr forall_ tyVars context unicode qual
880880
in case det of
881881
-- Prefix constructor, e.g. 'Just a'

html-test/ref/PatternSyns.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@
104104
>data</span
105105
> <a href="#"
106106
>BlubType</a
107-
> = <a href="#" title="Text.Show"
107+
> = <span class="keyword"
108+
>forall</span
109+
> x.<a href="#" title="Text.Show"
108110
>Show</a
109111
> x =&gt; <a href="#"
110112
>BlubCtor</a
@@ -274,7 +276,9 @@
274276
><table
275277
><tr
276278
><td class="src"
277-
><a href="#" title="Text.Show"
279+
><span class="keyword"
280+
>forall</span
281+
> x.<a href="#" title="Text.Show"
278282
>Show</a
279283
> x =&gt; <a id="v:BlubCtor" class="def"
280284
>BlubCtor</a

html-test/ref/Test.html

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,17 +579,23 @@
579579
>Ex</a
580580
> a<ul class="subs"
581581
><li
582-
>= <a href="#" title="Test"
582+
>= <span class="keyword"
583+
>forall</span
584+
> b.<a href="#" title="Test"
583585
>C</a
584586
> b =&gt; <a href="#"
585587
>Ex1</a
586588
> b</li
587589
><li
588-
>| <a href="#"
590+
>| <span class="keyword"
591+
>forall</span
592+
> b. <a href="#"
589593
>Ex2</a
590594
> b</li
591595
><li
592-
>| <a href="#" title="Test"
596+
>| <span class="keyword"
597+
>forall</span
598+
> b.<a href="#" title="Test"
593599
>C</a
594600
> a =&gt; <a href="#"
595601
>Ex3</a
@@ -2069,7 +2075,9 @@
20692075
><table
20702076
><tr
20712077
><td class="src"
2072-
><a href="#" title="Test"
2078+
><span class="keyword"
2079+
>forall</span
2080+
> b.<a href="#" title="Test"
20732081
>C</a
20742082
> b =&gt; <a id="v:Ex1" class="def"
20752083
>Ex1</a
@@ -2079,15 +2087,19 @@
20792087
></tr
20802088
><tr
20812089
><td class="src"
2082-
><a id="v:Ex2" class="def"
2090+
><span class="keyword"
2091+
>forall</span
2092+
> b. <a id="v:Ex2" class="def"
20832093
>Ex2</a
20842094
> b</td
20852095
><td class="doc empty"
20862096
></td
20872097
></tr
20882098
><tr
20892099
><td class="src"
2090-
><a href="#" title="Test"
2100+
><span class="keyword"
2101+
>forall</span
2102+
> b.<a href="#" title="Test"
20912103
>C</a
20922104
> a =&gt; <a id="v:Ex3" class="def"
20932105
>Ex3</a

0 commit comments

Comments
 (0)