[GHC] #8822: Allow -- ^ Haddock syntax on record constructors

GHC ghc-devs at haskell.org
Wed Feb 26 16:07:03 UTC 2014


#8822: Allow -- ^ Haddock syntax on record constructors
-------------------------------------+-------------------------------------
        Reporter:  Fuuzetsu          |            Owner:
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.9
  (Parser)                           |         Keywords:
      Resolution:                    |     Architecture:  Unknown/Multiple
Operating System:  Unknown/Multiple  |       Difficulty:  Moderate (less
 Type of failure:  None/Unknown      |  than a day)
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+-------------------------------------
Changes (by goldfire):

 * difficulty:  Unknown => Moderate (less than a day)


Comment:

 I took a look at this, and it requires more happy-fu than I've got at the
 moment. Suppose that we implemented parsing as requested, Then, the
 problem is that the parser gets mightily confused when it sees

 {{{
   data Foo = Bar  -- ^ urk
 }}}

 What should it expect next? A `|` and another constructor? Or a `{` and a
 list of fields? Given the current way constructors are parsed (as
 ''types'', to allow the possibility of infix constructors), there's not an
 easy way to restructure things to answer this question (that I can see).

 On the plus side, I think that solving this problem would make it easier
 to implement something I've wanted: the ability to annotate individual
 constructor arguments, like so:

 {{{
 data Foo = Bar Int    -- ^ urk
                Double -- ^ blah
 }}}

 which would currently be difficult to parse. If someone wants to
 restructure this section of the parser, please go for it! :)

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


More information about the ghc-tickets mailing list