[Haddock] Help with parsing Haskell modules for documentation

Michael Pankov mkpankov at gmail.com
Mon Apr 14 19:53:49 BST 2014

Hello everyone,

I'm working on an experimental tool that integrates with Git and tracks
updates to documentation as the source code is changing. It's early in
development and I'm not ready to show anything yet, but would like to ask
for some help instead.

On the most basic level, I intend to notify the programmer in case they
change the source code and do not change the documentation comment of
top-level functions. I do understand that this will create a lot of false
positives, and it quite limited, but that's the first step I want to take.

Then, I'm going to try to detect changes of arguments lists of the
functions as in source and as documented, and notify about that.

Parsing the module itself already proved to be difficult to do in a
sensible or moderately complete way. I tried to use Haskell.Language.Exts
parser. But there are cases when you have multiple functions with same type
signature, don't have any type signature at all, etc.

I started to look into Haddock's source code to see how it handles this
stuff, but it's pretty hard to me to even find the place. To me, it seems
like there should be a map of entities to their comments.

Maybe someone could point me to the right source files and functions?

I also think that having Haddock API would be great and I noticed it's in
quite incomplete state now. To use the Haddock's API is not my primary
interest, however. I could try at least looking on Haddock's way to handle
the ambiguities.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://projects.haskell.org/pipermail/haddock/attachments/20140414/f6081ebc/attachment.htm>

More information about the Haddock mailing list