[Haskell-cafe] Retrieving Haddock comments with haskell-src-exts

Niklas Broberg niklas.broberg at gmail.com
Fri Aug 16 10:36:14 CEST 2013

Hi again,

Hmm. I see the difficulty here, and eventually I would want to have support
for this, but alas, not yet. If you come up with any solution that doesn't
involve GHC (or only marginally so), I'd love to hear it.

Cheers, Niklas

On Wed, Aug 14, 2013 at 8:57 PM, Mateusz Kowalczyk
<fuuzetsu at fuuzetsu.co.uk>wrote:

> On 14/08/13 19:02, Niklas Broberg wrote:
> > Hi Mateusz,
> >
> > haskell-src-exts is not haddock-aware I'm afraid, so I don't have any
> real
> > solution for you. The one you mention, i.e. going through the whole parse
> > result and stiching things together manually seems like the best bet if
> you
> > want to use haskell-src-exts throughout.
> The main problem with this approach is that we get comments (and their
> SrcLoc) as a separate list. While it's trivial to check whether the
> comment starts with a ‘|’ or ‘^’ and it's not even hard to find any lines
> immediately following it, Haddock comments can appear in weird
> positions and trail until a line of code is encountered. Right now,
> it's rather hard to tell
>   -- | Foo
>   -- bar
> and
>   -- | Foo
>   someCode = undefined
>   -- bar
> apart. I think this is the only option at the moment if I'm to use
> haskell-src-exts.
> >
> > In the longer run, it would be nice to have haddock support in
> > haskell-src-exts, so ideas regarding what kind of interface you would
> like
> > to see are most welcome. :-)
> For my use, I do not care about anything but Haddock comments. I don't
> care where or why they appear, what they are attached to &c. With my
> current method, I just throw all this information away (it's given by
> GHC).
> For general use, I imagine that it'd be useful for the program to
> combine multi-line Haddock comments into a single one and attach it to
> whatever it is documenting. I'm not sure how haskell-src-exts is
> implemented but I don't think it's plausible to do this without going
> out to GHC and asking it for the information. Incidentally, this is
> precisely the problem I'm trying to solve with help of haskell-src-exts.
> >
> > Cheers, Niklas
> >
> Thanks!
> --
> Mateusz K.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130816/e90ad59d/attachment.htm>

More information about the Haskell-Cafe mailing list