diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2020-12-28 18:03:18 +0300 |
---|---|---|
committer | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2020-12-29 10:50:02 +0300 |
commit | 39a2def15c0d38bb1f7eef6db81676dd13785982 (patch) | |
tree | 45acda4dab1b8f153c4fabddc1836eedf0fbe427 /haddock-api/test/Spec.hs | |
parent | 8a5ccf93c53a40abe42134c2282ac9b9d653224c (diff) |
Inline and fix getGADTConTypeG
The getGADTConTypeG used HsRecTy, which is at odds with GHC issue #18782.
I noticed that getGADTConTypeG was only used in the Hoogle backend.
Interestingly, when handling H98 constructors, Hoogle converts RecCon to
PrefixCon (see Haddock.Backends.Hoogle.ppCtor).
So I changed getGADTConTypeG to handle RecConGADT in the same manner as
PrefixConGADT, and after this simplification moved it into the 'where'
clause of ppCtor, to the only place where it is used.
The practical effect of this change is as follows.
Consider this example:
data TestH98 = T98 { bar::Int }
data TestGADT where
TG :: { foo :: Int } -> TestGADT
Before this patch, haddock --hoogle used to produce:
T98 :: Int -> TestH98
[TG] :: {foo :: Int} -> TestGADT
Notice how the record syntax was discarded in T98 but not TG.
With this patch, we always produce signatures without record syntax:
T98 :: Int -> TestH98
[TG] :: Int -> TestGADT
I suspect this might also be a bugfix, as currently Hoogle doesn't seem
to render GADT record constructors properly.
Diffstat (limited to 'haddock-api/test/Spec.hs')
0 files changed, 0 insertions, 0 deletions