[GHC] #11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1

GHC ghc-devs at haskell.org
Mon Feb 15 07:53:27 UTC 2016


#11579: Bug in parser for named Haddock chunks since GHC 8.0.1-rc1
-------------------------------------+-------------------------------------
           Reporter:  SimonHengel    |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Steps to reproduce:

 {{{
 -- Foo.hs
 module Foo where

 -- $bar some
 -- named chunk
 }}}

 {{{
 -- Extract.hs

 module Extract where
 import Prelude hiding (mod)
 import Data.Generics
 import DynFlags
 import FastString
 import GHC
 import GHC.Paths

 extractDocStrings :: IO [String]
 extractDocStrings = do
   extract . pm_parsed_source <$> do
     runGhc (Just libdir) $ do
       _ <- getSessionDynFlags >>= setSessionDynFlags . setHaddockMode
       guessTarget "Foo.hs" Nothing >>= setTargets . return
       [mod] <- depanal [] False
       parseModule mod
   where
     setHaddockMode :: DynFlags -> DynFlags
     setHaddockMode dynflags = (gopt_set dynflags Opt_Haddock)

     extract :: ParsedSource -> [String]
     extract m = [unpackFS s | HsDocString s <- everything (++) ([] `mkQ`
 return) m]
 }}}

 Expected result: {{{extractDocStrings}}} returns {{{" some\n named
 chunk"}}}

 Actual result: it returns {{{" some"}}} instead

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11579>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list