Skip to content

Allow -- ^ Haddock syntax on record constructors

Original ticket is on Haddock Trac here which I'm opening here as it requires lexer/parser changes.

The idea is that given something like

-- | A tree with labeled internal nodes
data Tree =
    Empty                -- ^ Leaf
  | Branch               -- ^ Internal node
    { label :: a         -- ^ Node label
    , subtrees :: [Tree] -- ^ List of subtrees
    }

we'd like it to parse as the user would expect instead of failing. We're currently forced to do something like

-- | A tree with labeled internal nodes
data Tree =
    Empty                -- ^ Leaf
  | -- | Internal node
    Branch
    { label :: a         -- ^ Node label
    , subtrees :: [Tree] -- ^ List of subtrees
    }

which is quite ugly. I can't think of a reason why the first form wouldn't be allowed.

Trac metadata
Trac field Value
Version 7.9
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information