haddock icon indicating copy to clipboard operation
haddock copied to clipboard

Nested block comments are elided

Open sjakobi opened this issue 5 years ago • 3 comments

For example, in these haddocks, the following bit within a haddock {-|--}-comment,

For example,

> { {- A -} x {- B -} : {- C -} T }

... or

> { {- A -} x {- B -} = {- C -} T }

will be instantiated as follows:

…is rendered like this:

For example,

{ x : T } ... or

{ x = T }

The nested block comments like {- A -} and {- B -} are missing.

sjakobi avatar Nov 16 '20 20:11 sjakobi

As a workaround, one can use line comment syntax (--|) to ensure that internal block comments are preserved. (See https://github.com/dhall-lang/dhall-haskell/pull/2098 for an example.)

sjakobi avatar Nov 16 '20 20:11 sjakobi

I found that this also concerns pragmas, e.g.

{-| ...

> {-# FOREIGN GHC import Prelude (Char, Double, Integer, String) #-}
> {-# FOREIGN GHC import qualified Data.Text #-}
> {-# FOREIGN GHC import qualified CPP.Abs #-}
> {-# FOREIGN GHC import CPP.Print (printTree) #-}
>
> data Ident : Set where
>   ident : #String → Ident

-}

just drops all the pragmas in the rendering (apologies for the Agda syntax...).

andreasabel avatar Dec 28 '20 11:12 andreasabel

https://gitlab.haskell.org/ghc/ghc/-/issues/20336 is related.

sjakobi avatar Sep 11 '21 11:09 sjakobi