Empty Haddock comments no longer occur in the AST as `HsDoc`
Summary
Consider the following two type signatures.
foo :: {- |-} A -> B
bar :: {- | -} A -> B
Comparing the AST (with -haddock) of foo and bar, note that foo does not contain a HsDoc (searchf or WithHsDocIdentifiers), but bar does:
|
|
|
|---|---|
|
|
Is there a particular reason for this? In GHC 8.10, the AST contained Haddock comments in both cases.
Concrete effects of this behavior:
- It makes the job of formatters like Ormolu (see issues 1068, 1065, 726) that check of AST discrepancies automatically harder than necessary, as eg a natural rewrite from
to
foo :: -- | -- A -> Bcontains a Haddock comment in the AST in the first snippet, but not in the second.foo :: -- | A -> B - A nice Haddock trick by @tomjaguarpaw1 (blog post, search for "Forced type signatures to wrap") does no longer work.
Ideally, the behavior would be changed as it was in 8.10; I could try to do that in case this behavior is not intentional.
Environment
- GHC version used: Any GHC since 9.0 (I think this change is due to !2377 (closed))