Ticket #203 (new defect)

Opened 13 months ago

Last modified 8 months ago

very difficult to list pragmas in haddock code blocks

Reported by: JeremyShaw Owned by:
Priority: minor Milestone:
Version: 2.9.4 Keywords:
Cc:

Description

I would like to embed this as a code block in haddock:

> {-# LANGUAGE QuasiQuotes #-}
> import Data.Char        (toUpper)
> import HSX.QQ           (hsx)
> import HSX.XMLGenerator
>
> html :: (XMLGenerator m) => XMLGenT m (XMLType m)
> html = [hsx| <p><% map toUpper "hello, world!"  %></p> |]

But, the LANGUAGE pragma gets stripped out. I can do this inside the normal part of the haddock comment:

{&#45;\# LANGUAGE QuasiQuotes? \#&#45;}

And it renders as desired. However, if I put that inside the code block, it does not get stripped out, but it also does not get unescaped. So, it shows up exactly like that.

As far as I can tell, there is no way to actually show the pragma in the code block.

Change History

Changed 13 months ago by SimonHengel

That's weird, it seems to me that this only happens if you use {- ... -}-style comments.

I think the following can be used to work around this (for now).

-- |
-- > {-# LANGUAGE QuasiQuotes #-}
-- > import Data.Char        (toUpper)
-- > import HSX.QQ           (hsx)
-- > import HSX.XMLGenerator
-- >
-- > html :: (XMLGenerator m) => XMLGenT m (XMLType m)
-- > html = [hsx| <p><% map toUpper "hello, world!"  %></p> |]

Changed 8 months ago by anonymous

  • milestone 2.10.0 deleted

Milestone 2.10.0 deleted

Note: See TracTickets for help on using tickets.