This repository was archived by the owner on Aug 3, 2024. It is now read-only.
This repository was archived by the owner on Aug 3, 2024. It is now read-only.
Give a useful warning message instead of a cryptic parse error when encountering unexpected Haddock comments #94
Open
Description
Original reporter: david.waern@
See this failure when processing XMonad:
XMonad/Layout.hs:55:19: parse error on input `!' haddock: Failed to check module: XMonad.Layout
The relevant lines:
data Tall a = Tall !Int -- ^ The default number of windows in the master pane (default: 1)
!Rational -- ^ Default proportion of screen occupied by master pane (default: 1/2)
!Rational; -- ^ Percent of screen to increment by when resizing panes (default: 3/100)
Since we don't support Haddock comments on individual arguments of constructors, this just fails with a parse error. Perhaps we should give a warning message instead. In general, it would be good if we give a warning message instead of a parse error whenever a Haddock comment is encountered where it is not expected.
I think implementing this is hard, given the way things currently work. Haddock comments are just ordinary tokens that are fed to the parser in GHC, and we clearly don't want put them all over the grammar. If we should move to a design where Haddock comments are not in the grammar, but are collected elsewhere, implementing this ticket would be easier.