Haddock drops {- -} comments
Summary
Haddock drops {- -}
comments inside a haddock comment itself delimited with {- | ... -}
.
My understanding is that the GHC API is responsible for parsing this, but please let me know if this is wrong and I should file a haddock issue instead.
Steps to reproduce
Process the following module with haddock:
{- |
A Haskell comment looks like this: {- comment -}
-}
module Test where
I expect the full doc string to show up in html, but the {- comment -}
part is dropped.
Environment
- GHC version used:
Tested with 8.6 and 8.8.
As a side note, I tried to reproduce this bug using raw ghc api like this:
import GHC
import GHC.Paths
import Outputable
import GhcMonad
main =
runGhc (Just libdir) $ do
dynflags <- getSessionDynFlags
setSessionDynFlags dynflags { packageFlags = [] }
setTargets [Target (TargetFile "Test.hs" Nothing) False Nothing]
load LoadAllTargets
ms <- getModSummary (mkModuleName "Test")
pm <- parseModule ms
let pp = showPpr dynflags (hsmodHaddockModHeader . unLoc $ pm_parsed_source pm)
liftIO $ putStrLn pp
But I got Nothing
— i.e. the parsed module does not have hsmodHaddockModHeader
. I'd be interested in learning what I did wrong there.