This addresses ticket Trac #8944 where the lexer stops with an error on an invalid haddock comment and when the haddock option is set.
See ticket for more details.
This is still not working correctly and I am running out of ideas considering that my knowledge of Alex is quite thin. The main open question is where should the new rule be added in Lexer.x. I have tried 3 different locations and I still get validate errors.
I think the option is unnecessary and it should always be on if running Haddock: it is not fun to start again each time. We would most likely always enable this from Haddock anyway.
EDIT: although I suppose if you already coded the option in then we might as well leave it in, I can see someone wanting to catch badly placed comments without having to scroll through the whole output.
This isn't a good message, the comment might be perfectly valid Haddock markup. The only problem we encounter here is that a Haddock comment appears at a location GHC is not expecting it in. The message should say something like “Not expecting Haddock comment at <location>, ignoring.” instead.
Any updates on this? I think I even hoped for it to go into 7.10.1 though if it gets merged in fast then I guess it doesn't change things enough to not be allowed into later 7.10.x release.