Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,861
    • Issues 4,861
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 457
    • Merge requests 457
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17302
Closed
Open
Created Oct 04, 2019 by Roman Cheplyaka@romanc

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.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking